Progressive food

Started by Jaysonsup on

Topic category: Help with modding (Java Edition)

Last seen on 01:47, 20. Apr 2024
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Progressive food

Does anybody know how to make a food that makes you stronger everytime you eat it? so lets say the food is a green apple and you eat the green apple and you get 3 extra hearts. How do I make it where the next time you eat that green apple, you get 4 more extra hearts? Who ever can help thanks 

Last seen on 22:14, 25. Apr 2024
Joined Feb 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can use a global…
Fri, 01/21/2022 - 21:41

You can use a global variable player scoped called for example "eatenApples" (number) or whatever you wanna call it. Then every time you consume your food make a procedure on food consumed that adds +1 to the eatenApples global variable. Then simply check for the number of the variable and make some if statements for controlling the healing. You can also make like a multiplier instead of making like 20 different levels. Just make ["heal the target by [get current health] + 1 x eatenApples]. Hope this helps