Started by
Muzaki
on
Topic category: Help with Minecraft modding (Java Edition)
Ok so heres the code i cant seem to figure out, (i would send a screenshot and send it but idk how lol) any help is very appreciated!
Event trigger: entity attacked
if source entity is sub(type) if entityplayer
do set global stamina to global stamina - 10
I mean it should work. Have no clue why it doesn't...
Hers a reference image link: https://mcreator.net/sites/default/files/attachments/sourceandtarget.PNG
Maybe that will help?
I'm not sure why it isnt either, I think its probably because its trying to set the stamina of the attacker to stamina-10 instead of the player, but i cant seem to figure out how to make it target the player instead.....
Maybe its because of the variable type.. (global, player lifetime, ect)
Try this instead. It may work. Go to the entity and in the triggers section add the procedure to "when entity is hurt". Set the Event trigger type back to "no additional triggers".
Event trigger: no additional triggers
if source entity is sub(type) if entityplayer
do set global stamina to global stamina - 10
Other options
set food saturation
set food level
GL,
Chew
I found out that "global" variables are kinda buggy, so I'd recommend using scoreboards instead. Everytime I use them, they appear to be more reliable (and if I remember correctly, they should support negative values, on which I'm unsure with global variables)