i want the game to auto heal the player when they are at less then 10 hp, and i want it to do that only 3 times, is there a way?
i did that but it didn’t work
We can’t see what you’re doing wrong.
Do you already know how to work with varibals?
If you can already add damage, you can also add healing the same way.
yeh i know how to work with varibals, and so it’s really weird
You want to do it 3 times in the whole game? Even if it changes scene?
no every time the scene is restarted then the 3 times are restored
In fact, it is quite simple. Let me show you with an example:
- At the beginning of the scene we define the amount of health and number of times that the game will restore health automatically.
- In the example, if our character collides with an enemy, we subtract 12 health points from the variable that defines the amount of health.
- If the value of said variable is equal to or less than 10 and the value of the variable that defines the number of times that the game will restore health is greater than 0, then the variable health is returned to 100 and 1 is subtracted from the variable that defines the times the game will restore health.
In short: at the beginning of the scene we tell the game that we have 100 health points and 3 health restoration “vouchers”. Every time the health is equal to or less than 10 and the number of “vouchers” is greater than 0, the game restores health and takes away a “voucher”.
Some improvements to this system can be:
- Use of a global variable for health if you intend to maintain the level of health between scenes.
- Isolate these events on an event sheet and link them to the beginning of each scene to avoid copying them over and over.
i did pretty much exactly that, but nothing worked
That works, I know. The only way we can help you further is if you show us your events to understand what you’re doing wrong (otherwise we are blind). You can also share your project with us in this thread.
Are you properly setting the ItemsUsed variable to 3 at the start of each scene?
I strongly recommend to use scene variables.
i do set it, and it doesn’t help
i tried to use scene variables, but it didn’t seem to help
If you want further help, you have to consider show more of your events or share your project.