Topic category: Help with Minecraft modding (Java Edition)
I have been trying to set up a procedure that gives you a potion effect for an infinite amount of time until you lose half of your health (The procedure also makes use of the Health Boost potion effect, essentially giving you the health boost & jump boost potion effects then the idea is that you lose both once you run out of all of the health you gained from the Health Boost.)
I have been trying to use an if statement with the "current health of" block, if the current health of the player is equal to or less than 20 the if statement is triggered.
The log doesn't appear in console when the player has 20 or less health, and the player doesn't lose the potion effects either.
I don't know why it isn't working, anyone care to enlighten me?
My procedure is below.
I think I may be able to help, though I need to ask a few questions first.
1. What would be calling upon the procedure? Armour, an item in the player's inventory? Have to know specifics like this because even though you would think MCreator automatically only calls upon the procedure when applied to those, you still need to add checks for whatever item is causing the procedure.
2. Is there a reason you have the potion effects set to 999999? If the procedure is for armour or an item in the inventory, it will be called every tick so you don't need to set the numbers so high, about 25 ticks for both will do the trick.
it is not for armor or an item in the inventory, it is for a food item that you eat, and the procedure is called when you eat the food item.
Ah, okay. The issue here is that since the procedure isn't going to be called for every single tick, it's not checking what the player's health is. It only checks what their health is when they eat the food item, because that's when the procedure is called.
That makes a lot of sense... I hadn't even considered that. Do you know how I might go about fixing this? maybe with another procedure that references this one?
I'm not entirely sure, unfortunately, as I'm fairly new to MCreator myself. But you would definitely need a health-check procedure running every tick.