Countdown Timer

The game I’m working on (my first) has a time limit in game time. You have 1 hour to get out before the explosion, so I put in *set time -1 (or more) at various places, and give the time remaining at the end of each scene.

I can put in a time check regularly:
*if time <1 goto_scene explosion

Or I can put this in a subroutine in each scene, and refer to it regularly.

But can I put in some kind of universal time check to cover the entire game that takes me to the explosion scene, to avoid repeating this check numerous times?

Thanks!

The easiest way would be to have a check every time the time changes. Just copy/paste the code where you need it.

*set time -1
*if time<1
*goto_scene explosion

Does the MC have a whatch? If yes could make time a regular stat, having a start value of 60 at the beginning and decreasing with every scene exactly like @andymwhy proposed.

The short answer is no, ChoiceScript does not support continually running checks. All checks have to be done in line with the rest of the game. Assuming you want a relatively simple, ‘timer hits zero and you lose’, the best way is probably to stick it in as part of a gosub that also reduces the time.

*gosub countdown_timer

*label countdown_timer
*set time -1
*if time <= 0
  *goto boom_you_die
*return

If you want to reduce time more than 1 tick at a time, just preface the *gosub with a *set time - #.

1 Like

Thanks all - it looks like I was thinking along the right lines initially.