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

**URL:** <https://forum.choiceofgames.com/t/how-can-i-make-a-character-die-at-any-place-in-the-story/23464>\
**Category:** ChoiceScript Help\
**Created:** [January 22, 2017, 2:55pm UTC](https://forum.choiceofgames.com/t/how-can-i-make-a-character-die-at-any-place-in-the-story/23464 "2017-01-22T14:55:51Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tm21](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Tm21](https://forum.choiceofgames.com/u/Tm21)\
**Post date:** [January 22, 2017, 2:55pm UTC](https://forum.choiceofgames.com/t/how-can-i-make-a-character-die-at-any-place-in-the-story/23464/1 "2017-01-22T14:55:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![FairyGodfeather](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fairygodfeather/32/16709_2.png) [@FairyGodfeather](https://forum.choiceofgames.com/u/FairyGodfeather)\
**Post date:** [January 22, 2017, 3:01pm UTC](https://forum.choiceofgames.com/t/how-can-i-make-a-character-die-at-any-place-in-the-story/23464/2 "2017-01-22T15:01:28Z")

</div>

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

```

* * *

> **[Gosub](https://choicescriptdev.fandom.com/wiki/Gosub)**
>
> ChoiceScript supports a simple form of subroutines. A subroutine is a section of code able to be accessed (using the\*gosub command) where& when required at many different points within the same scene file. This essentially negates the need to...

  

> **[Gosub scene](https://choicescriptdev.fandom.com/wiki/Gosub_scene)**
>
> \*gosub\_scene is an extension of the basic\*gosub command. Whereas an ordinary\*gosub requires that its subroutine be located somewhere within the same scene file,\*gosub\_scene grants the ability to'call' (i.e. load and run) a subroutine from any game...

---

<div class="post-metadata">

**Author:** ![ChibaHateme](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/chibahateme/32/18011_2.png) [@ChibaHateme](https://forum.choiceofgames.com/u/ChibaHateme)\
**Post date:** [January 22, 2017, 3:05pm UTC](https://forum.choiceofgames.com/t/how-can-i-make-a-character-die-at-any-place-in-the-story/23464/3 "2017-01-22T15:05:44Z")

</div>

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. 😥

---

<div class="post-metadata">

**Author:** ![FairyGodfeather](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fairygodfeather/32/16709_2.png) [@FairyGodfeather](https://forum.choiceofgames.com/u/FairyGodfeather)\
**Post date:** [January 22, 2017, 3:11pm UTC](https://forum.choiceofgames.com/t/how-can-i-make-a-character-die-at-any-place-in-the-story/23464/4 "2017-01-22T15:11:55Z")

</div>

Lalallaa nothing to see here. 🙂

> [@ChibaHateme](#):
>
> 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.

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

---

<div class="post-metadata">

**Author:** ![MasqCrew](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/masqcrew/32/23943_2.png) [@MasqCrew](https://forum.choiceofgames.com/u/MasqCrew)\
**Post date:** [January 22, 2017, 3:32pm UTC](https://forum.choiceofgames.com/t/how-can-i-make-a-character-die-at-any-place-in-the-story/23464/5 "2017-01-22T15:32:46Z")

</div>

> [@FairyGodfeather](#):
>
> I’d generally suggest against doing this.

I like the way [Paranoia](https://www.choiceofgames.com/user-contributed/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.

---

<div class="post-metadata">

**Author:** ![ChibaHateme](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/chibahateme/32/18011_2.png) [@ChibaHateme](https://forum.choiceofgames.com/u/ChibaHateme)\
**Post date:** [January 22, 2017, 3:48pm UTC](https://forum.choiceofgames.com/t/how-can-i-make-a-character-die-at-any-place-in-the-story/23464/6 "2017-01-22T15:48:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MasqCrew](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/masqcrew/32/23943_2.png) [@MasqCrew](https://forum.choiceofgames.com/u/MasqCrew)\
**Post date:** [January 22, 2017, 4:02pm UTC](https://forum.choiceofgames.com/t/how-can-i-make-a-character-die-at-any-place-in-the-story/23464/7 "2017-01-22T16:02:47Z")

</div>

> [@ChibaHateme](#):
>
> 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.

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.

> [@](#):
>
> \*choice  
> [tab]\*if has\_potion true  
> [tab][tab]#Take potion
> 
> [tab]#Go back to Chapter 2

Or something to that effect.

> [@ChibaHateme](#):
>
> 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.

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.

> [@ChibaHateme](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![Tm21](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Tm21](https://forum.choiceofgames.com/u/Tm21)\
**Post date:** [January 22, 2017, 4:11pm UTC](https://forum.choiceofgames.com/t/how-can-i-make-a-character-die-at-any-place-in-the-story/23464/8 "2017-01-22T16:11:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![FairyGodfeather](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fairygodfeather/32/16709_2.png) [@FairyGodfeather](https://forum.choiceofgames.com/u/FairyGodfeather)\
**Post date:** [January 22, 2017, 4:12pm UTC](https://forum.choiceofgames.com/t/how-can-i-make-a-character-die-at-any-place-in-the-story/23464/9 "2017-01-22T16:12:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tm21](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Tm21](https://forum.choiceofgames.com/u/Tm21)\
**Post date:** [January 22, 2017, 4:18pm UTC](https://forum.choiceofgames.com/t/how-can-i-make-a-character-die-at-any-place-in-the-story/23464/10 "2017-01-22T16:18:37Z")

</div>

Ah, yes!

Strive for shorter codes!
