Hi! I'm new to mcreator, can I have some help with my code please?

Started by Muzaki on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi! I'm new to mcreator, can I have some help with my code please?

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

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm not sure why it isnt…
Thu, 07/29/2021 - 15:52

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.....

Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Maybe its because of the…
Thu, 07/29/2021 - 18:23

Maybe its because of the variable type.. (global, player lifetime, ect)

Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try this instead. It may…
Thu, 07/29/2021 - 22:23

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"…
Thu, 08/19/2021 - 05:46

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)