How can I make a character die at any place in the story?

Hello, I’ve looked at the forums for some help about this issue, but no luck so far.

My question is.

If I have a stat named “Health” and this goes to 0 or under. How can I make my character get directed to a death scene at any point of my story, if the character would so happen to lose too much health?

I’d generally suggest against doing this.

BUT every time you reduce a character’s health you use a *gosub (or a gosub_scene) to check if the health is below 0 and if it is send them to your death message.

You've been hit!
*set health -1
*gosub deathcheck

Stick this somewhere in every scene file.

*label deaththcheck
*if health > 0
    *return
*else 
    *goto_scene death

(Or you can use *gosub_scene instead, that way you only need the code in one scene file.)


death.txt 

You have died!

*ending


3 Likes

You also could just check in general every time the character takes damage if his health reaches 0 or lower. Just use:

*if health <= 0
     insert description of death here.
*else
     continue with the story as planed.

With this, you could also design a unique death scene for every event. However, FairyGodfeather’s suggestion is more relaxed if you just create a death scene which fits in general. Although I too would suggest you not giving your player a dead end by health. Sometimes you just get cornered in a death end this way without a solution no matter what choice you take.

Edit: Yes thanks. That’s why I have to double check my things all the time. I have a knack of using the wrong one whenever possible. :disappointed_relieved:

1 Like

Lalallaa nothing to see here. :slight_smile:

At least you’ll probably remember to doublecheck your greater than and less than signs now. :slight_smile: I usually have to triple check them, I find them tricky.

1 Like

I like the way Paranoia got around this by giving the reader another chance to make a better choice without going all the way back to the beginning.

Perhaps a death scene sub could give the reader choices on ways to deal with the exhausted health. Either going back to different sections of the story with some health automatically replenished, or in the case of a fantasy, using a health potion that was picked up earlier in the game and then returning to the spot the character died.

1 Like

Sounds like a “save system” which would be a good idea. However, at the same time, it demands some logic. In the example of a health potion, every death scene would have to happen after the check or the potion has to be consumed automatically.

Just imagine a scene where the PC gets hit by a fireball. I think after it hit the PC there is not much he/she could do. But maybe it is just me being picky.

If you create a savepoint system you maybe should also create a drawback. A player that died a certain number of times and used the system shouldn’t be able to reach the perfect ending for example. However, only if you really want to punish your players for making mistakes.

I don’t think I agree. If the character dies before finding the potion (which could be an achievement), then an if statement would make that choice unavailable. If a character dies after finding the potion, then the potion would be an option to choose from.

Or something to that effect.

Just depends on if you want the death scene to work with the plot or simply be a redneck save system. If you have one death scene, then there might be lots of variables (stats) involved to give the reader the right choices. If there’s a different death scene for each section/chapter etc… you could write something that works with that part of the plot.

If done right, I can see where this could have immense playback value. Especially if you aren’t forced to go all the way back to the beginning if you achieve the less-than-desired ending.

Yes, this is similar to how I did it. I placed the “death code” in its own scene file and the stats code.

*label clothes
*choice
#I’m going to the local tavern.
The cat went to the tavern, and threw up after too many a drink.
“You lost 30 health.”
*set health -30
*if health <= 0
*goto_scene death
*else
*goto clothes

1 Like

I used the sub routines because it’s easier if you have multiple possible deaths in a scene.

2 Likes

Ah, yes!

Strive for shorter codes!

1 Like