Can i do a procedure that every times a player eat 20 times an item he dies

Started by Azzie on Fri, 04/09/2021 - 09:02

Topic category: Help with modding (Java Edition)

Last seen on 13:03, 16. Apr 2021
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Can i do a procedure that every times a player eat 20 times an item he dies
Fri, 04/09/2021 - 09:02

So i'm making a mod where a food is supposed to kill you if you eat it 20 times but i can't do it using procedure so if you know how to do it help me.

Last seen on 05:35, 13. May 2021
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
yes, make a global variable…
Sat, 04/10/2021 - 10:35

yes,

make a global variable with numbers

do when item eaten , add 1 to global variable

check if global variable > 19 , if yes

then kill entity or deal damage like 1000

Last seen on 06:12, 13. May 2021
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
for the kill entity…
Sat, 04/10/2021 - 11:13

for the kill entity procedure, you can do: 

"deal [max health of event/target entity] damage to [event/target entity] type: [any damage type]"

and it would work just fine. but this, unlike dealing a limited amount of damage, would still kill the player even if their health is higher than usual.