Coding variable death for player

The problem I’m running into is that I have no idea how to actually kill a player. I have created HP but after running a few test the HP just goes into the negatives. I wish I could add the code but I have no idea what code to put in or where.

*if (hp<1)
*Set hp 0
*Goto_scene player_died

3 Likes

Killing a player means “killing the story”.

I presume only way to do is once it reaches 0…you check the HP var with an IF and redirect reader to end scene…and use a *ending?

I was also actually trying to think of a way to set a “checkpoint” of sorts. Death would just send the player back to the beginning of the chapter. Any ideas on that?

1 Like

Put a label at the beginning of the chapter like *label chapterstart. In the event of a death, it would go something like:

*if (HP <= 0) 
        *goto deathscene

*label deathscene
You died! You feel your soul moving backwards through time...
*goto chapterstart

At the top of your file, at your chapter start, would be the label chapterstart, so the player would go back to the beginning.

5 Likes

Of course. Create a label. I do the same for my games. Like…

*label checkpoint1

Player dies here due to bad choice.
*page_break …
You died.
*page_break …
*goto checkpoint1

Edit: Eh, i got beat to it again. :laughing:

2 Likes

Can I actually use that verbatim? That sounded really nice.

3 Likes

Go for it!

4 Likes

Question resolved!