#Why wont this work?
1 messages · Page 1 of 1 (latest)
what not working is there a error
no error
thats not possible a code needs to out put something
nothing at all
do you have content log on
yh
ok what not working
no errors
do you have script api enabled
and the pack on
There are 2 errors in this [code](#1130573432573132931 message):
[36mindex.js[0m:[33m12[0m:[33m20[0m - [31merror[0m[30m TS2532: [0mObject is possibly 'undefined'.
[7m12[0m const health = hit.getComponent("minecraft:health").current;
[7m [0m [31m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
``````ansi
[36mindex.js[0m:[33m12[0m:[33m57[0m - [31merror[0m[30m TS2339: [0mProperty 'current' does not exist on type 'EntityHealthComponent'.
[7m12[0m const health = hit.getComponent("minecraft:health").current;
[7m [0m [31m ~~~~~~~[0m
.current ===> .currentValue
Ok so i got a reading finally
it wasnt working cus i had a comma , of a . in the manifest
omg
ffs
@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?
.getComponent("minecraft:health").current ==> .getComponent("minecraft:health").currentValue
this guy even told you earlier
yk what that means?
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"
}
]
thats my dependencies
cus i used bridge editor to make the pack so i didnt create the manifest
i only know how to do maifests on recources
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
yeah
But you change the uuid when you make another addon or script addon