How to make low HP stop events?

I have a farming system implemented in my game and i want to make it so if the player wants to harvest and has less than 20 HP a message will pop up that says "you're too tired..."


Below is my event page for the farm. I am assuming that i have to make player HP (in this case energy since my game doesn't use hp) a variable but thats the extent of my knowledge. I've been hunting around and searching google and i haven't found anything,,


Originally my else branch had "if : Player Energy < 20" with "you're too tired" being underneath and all the other info under the "else" but that didn't work either. The farming works just fine but even if you have 1 EP you can still harvest and i don't know how to stop that! If you guys have any info on that i'd love to hear it <3

Farming.png
Originally my else branch had "if : Player Energy < 20" with "you're too tired" being underneath and all the other info under the "else" but that didn't work either.

Then you need to check where you made a mistake there, because that is exactly how it should work.


Your first command always sets the energy to 200, you need to remove that into a different event where the energy is restored. This event can never result in exhaustion because you set the player energy to 200 as the first step, before checking if the player has enough energy left...
Yes. If you want to check hp you need to set the variable's value to current no, not total


That means making it set as actor's hp. Not the value by hand.
i'm not quite sure i understand (about the first part not the second part). sorry i didn't specify earlier but with my first attempt i did not have the controlled variable for player energy. it still did not result in exhaustion with it removed. how would i make it so the player can't still harvest once EP is low enough? is there something wrong with having double conditional branches right under each other? (edit: removing the variable from this current event page also doesn't result in the right thing)


do i need a variable for HP at all?

Then you need to check where you made a mistake there, because that is exactly how it should work.



are you saying i should switch it back to "player energy < 20" instead of "player energy  ≥  20" because its not clear,,,
@Vavelu...


When running this, after having made the choice 'Yes', use 'F9' to invoke the 'spy' which will show you the value of your Switches and Variables. Scroll down to see Variable 21, and see what its value is. If the Event is not responding as anticipated, it's because that value is being made to be above 20 by something or other. Find that 'something' to fix it.


You may also, artificially, modify the value before the 'if' test to a value below 20, and you'll see that the test works correctly.


Hope this helps.
You put at the beginning to set the variable as 200. That means it is not the player hp, but will forever be 200.


Instead of setting the variable to a constant, set to game data, click the ... button and set to actor h.p.


Sorry, autocorrect keeps turniturning h.p. into go
@Waterguy !!!!


thank you so much for clarifying that i had no idea how to do what you said but i just tried it and that fixed it completely! You're a life saver <3
Maybe try {If: yes (check player energy >20)}


Idk if it''ll work but it's a thought

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-low-hp-stop-events.68680/