#Why wont this work?

1 messages · Page 1 of 1 (latest)

normal storm
lament fulcrum
#

what not working is there a error

normal storm
#

no error

lament fulcrum
#

no putput

#

nothing

normal storm
#

no

#

nothing ingame

lament fulcrum
#

thats not possible a code needs to out put something

normal storm
#

nothing at all

lament fulcrum
#

do you have content log on

normal storm
#

yh

lament fulcrum
#

ok what not working

normal storm
obtuse terrace
#

work

normal storm
#

nothing works at all

#

nothing shows up in game

#

just weird tbf

wary marsh
#

do you have multiple entityHurt events in the file

#

?

obtuse terrace
#

and the pack on

frozen stirrupBOT
#
Debug Result

There are 2 errors in this [code](#1130573432573132931 message):

index.js:12:20 - error TS2532: Object is possibly 'undefined'.

12     const health = hit.getComponent("minecraft:health").current;
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

``````ansi
index.js:12:57 - error TS2339: Property 'current' does not exist on type 'EntityHealthComponent'.

12     const health = hit.getComponent("minecraft:health").current;
                                                           ~~~~~~~

waxen solar
#
.current ===> .currentValue
normal storm
#

Ok so i got a reading finally

#

it wasnt working cus i had a comma , of a . in the manifest

#

omg

#

ffs

normal storm
#

@here

#

const health = hit.getComponent("minecraft:health").current;
if (hit.typeId !== "minecraft:player" || attacker?.typeId !== "minecraft:player") return;
if (health <= 0) {
hit.runCommandAsync(function playerhit);
attacker.runCommandAsync(function playerhit);

    attacker.runCommandAsync('scoreboard players add @s Kills 1');
    attacker.runCommandAsync('scoreboard players add @s Streak 1');
    attacker.runCommandAsync('effect @s instant_health 255 1 true');
    attacker.runCommandAsync('scoreboard players add @s money 200');
    attacker.runCommandAsync('title @s actionbar §cKill:§a +$200');

    attacker.runCommandAsync('playsound random.orb @s');
    attacker.runCommandAsync('scoreboard players set @s Combat 0');
    hit.runCommandAsync('scoreboard players set @s Streak 0');
    hit.runCommandAsync('scoreboard players add @s Deaths 1');
    hit.runCommandAsync('scoreboard players set @s Combat 0');
}

});

#

does anyone know why this part of the script does not work?

wary marsh
wary marsh
normal storm
wary marsh
#

the manifest is fucked

#

no jk but like theres a missing dependency in the behaviour pack

#

put these

#

"dependencies": [
{
"module_name": "@minecraft/server",
"version": "1.4.0-beta"
},
{
"module_name": "@minecraft/server-ui",
"version": "1.2.0-beta"
}
]

normal storm
#

thats my dependencies

wary marsh
#

uhh

#

damn

#

why do you have

#

uuid and version inside dependencies

normal storm
#

cus i used bridge editor to make the pack so i didnt create the manifest

#

i only know how to do maifests on recources

wary marsh
#

it should be something like js { "format_version": 2, "metadata": { "authors": [ "Strm5932" ] }, "header": { "name": "pack.name", "description": "pack.description", "min_engine_version": [ 1, 20, 0 ], "uuid": "6caa0634-ebd4-4229-9309-20a10eebc9e1", "version": [ 1, 0, 0 ] }, "modules": [ { "type": "data", "uuid": "ffda2b98-ffb8-4845-a545-4cc359caef3c", "version": [ 1, 0, 0 ] }, { "type": "script", "language": "javascript", "uuid": "e0194ff3-300e-4135-8c17-613ab5ea6e43", "entry": "scripts/main.js", "version": [ 1, 0, 0 ] } ], "dependencies": [ { "module_name": "@minecraft/server", "version": "1.4.0-beta" }, { "module_name": "@minecraft/server-ui", "version": "1.2.0-beta" } ] }

#

on modules

#

type: script

#

entry

#

make it your file path to the main script

#

copy all of it if u want

#

but change the uuid

normal storm
#

this the whole manifest?

#

dw it is

wary marsh
#

yeah

charred atlas
#

But you change the uuid when you make another addon or script addon