I’m having trouble with creating a System where you die when your health reaches Zero. Is there a way to make it automated so the player dies as a soon as it reaches zero or do i have to manually check to see if they died.
You could create a subroutine you call at every health decrease that checks if it reaches zero (and then acts accordingly), I’d think.
How would you do that
For subroutine, there’s wiki article. As to how to make that happen at health decrease, you can’t have one happen without coding it in, right? So you know where they happen.
Name a .txt file DeathCheck (or whatever you want).
The following code is a simple check to put in that file.
*if PlayerHeath <= 0 *page_break *ending *return
During the actual story call for this file right after you applied damage. Example.
The attack hit me with the force of a bull. *set PlayerHealth -3 *gosub_scene DeathCheck Somehow, I had managed to live through the attack.
This is a very basic breakdown for how you could do it. Right after doing the damage call for DeathCheck. If they are at 0 health it’ll end the game on the next page. If not at 0 it’ll continue where you left off.
I’d actually probably do the health decrease in the subroutine as well, but that’d be more complex.
That’s funny I was just making an example to do just that.
… what did I miss? The way I see it, you do the health decrease, then call the subroutine.
(Although okay, this probably is beyond the scope of the topic.)
Sorry I had the wrong text highlighted when I responded.
Here we go. How to do it in one line. The sub scene can do the damage calculation then check for death.
Once more Make a DeathCheck.txt file. Put in the following code. Same concept.
DeathCheck file gets this:
*label DamageCalc *params *set PlayerHealth -param_1 *if PlayerHealth <= 0 *page_break *ending *return
During the actual story you do the following. The 3 is the damage value being dealt to the character.
The attack hit me with the force of a bull. *gosub_scene DeathCheck DamageCalc 3 Somehow, I had managed to live through the attack.
Either example I gave would do the basics of what you are looking for @crazy
That is genuis i am going to do that as it would help with the weapon system i am going to add, Thank you for the help to
This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.