Problem with Hunger/Thirst/Sleep system

EDIT: I solved the problems for now! 🙂

I followed this tutorial https://forums.rpgmakerweb.com/index.php?threads/hunger-thirst-sleepsystem-without-scripting.11073/
And it seems to be working, but:

The system seems to be working, but the items recovering the statuses recover more than they should, they go beyond max.

y1OpbDn.png


and the rest of the code:

TaqChsU.png


aV5dBzV.png


NpkLSHw.png
I'm not completely sure of how this works, are you having it so that you loose hunger overtime or gain hunger deficiency? Going with that, does the player die once the bar is full or empty?

Anyhow, one thing that I noticed is that the first common event "Predefinition HTS" has no switch or trigger. That would mean that that one will never run as the conditions are not set.
The player dies when the bars are empty and mine were empty at the start of the game. But I just fixed that (I made some mistake with the variables).

But now I have another problem where the items recover more hunger/thirst/sleep than they should. Meaning, it goes beyond max 😛

Alright, I just solved it too. Again, I made a mistake with the Item variable! So all my problems are solved for now 🙂
Well, here is a way you can fix that: you can check the amount of hunger/thirst/sleep before compared to the amount you will recover. If the amount you will recover will surpass the max amount of the gauge then set it to only heal up to the max. For example:

*uses item*
*calls common event* :
- set a variable to item's effectiveness ((how much it recovers))
- subtract max gauge level to the current gauge level to get the amount of empty space left
- if amount the item heals is greater than empty space then....
- subtract item healing amount variable by empty space variable
- set the recovery to the amount you have been left with from the subtraction above​
- else : heal the normal amount
​
If this is confusing to you or doesn't work, feel free to tell me and I'll try to manually make it in RPG maker, I am pretty tired so it may be wrong. 😮‍💨
Thanks! I followed the tutorial again (even more carefully this time...) and of course I made a mistake, I used steps thirst variable instead of just thirst, like on the picture below (second row). Now it's working (so far)!
But thank you so much for help!

8WIwUF2.png

6054feac-a319-4219-ac4a-f10d4646e19c
Ah, that's great to hear! Also something you can add just as a safety net: In your parallel event add in a code that checks if hunger/thirst/sleep is above their max. If it is set it back to the max. This is just in case something goes funky and somehow bypasses the max. :3

Good luck to you with your game! 😍
Good idea!

I have one more question, if anyone knows. Is it possible to make the hunger/sleep/thirst last longer/go down slower? I guess making the bar longer would be the only solution?
Just lower the amount the parallel event subtracts. :3
Of course... I feel stupid now xD Thank you AGAIN!

Original thread: https://forums.rpgmakerweb.com/threads/problem-with-hunger-thirst-sleep-system.94238/