Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Ending game on a timer?

This is a two-in-one question. Firstly, is there an official 'end game' script, or do I just send them to a dead-end passage which says 'You're dead' or whatever?

Secondly, I have a set-piece where the player is being shot at from a distance. I want to give them a little time to choose an option which will provide cover from the gunfire, but if they're too slow have them hit by a bullet.

Would the easiest way to do this just be with the <<timed>> macro, or is there a 'proper'/better way to do this kind of thing?

Comments

  • Handle a loss/game over however you want—there is no one-size-fits-all solution. That said, a common way to handle the situation is with some kind of game over passage, yes.


    As to the timed event. Your two best choices here would probably be either the the <<timed>> macro or the time() function, both of which are specifically for timed events such as you describe. You didn't state exactly how you wish to handle the situation, so I can't really say which would be the best fit.

    That said, I suspect that you should look at the time() function. For example:
    In the darkness, something wicked this way comes.  Quickly!  Do you
    \ <<link "try to run back into the light">>
    	<<if time() lt 5000>>
    		/* The player clicked the link in under 5s, so they escape. */
    		<<goto "Well lit passageway">>
    	<<else>>
    		/* Elsewise, they're eaten by a grue. */
    		<<goto "Eaten by a grue">>
    	<</if>>
    <</link>>
    \ or [[stand your ground|Eaten by a grue]]?
    
  • Thanks, TME. I'd just hunted down the above code shortly before I had to leave the house, but in my rush to test it was getting a few errors, so don't know yet if it does what I need. It very much looks like it will so I'm just about to have another go now.
  • edited November 2016
    This doesn't do what I want, and as usually my brain has gone to mush trying to work out how to do what I want.

    Player arrives at passage and three seconds later a shot ring out.
    They have two options: advance on the house or dive behind a wall for cover.

    I want a timer on this passage which after X seconds throws the player to a 'you are dead' passage (if they've taken too long to make a decision).

    I don't want the timer to give the result of their decision AFTER they've chosen, but to kick in automatically if they fail to choose an option in time.

    [EDIT] As usual, I was over-thinking things. The solution is as simple as:
    As the house grows nearer something starts to feel wrong.
    <<timed 3s>><<audio "gun_shot" play>><br>Suddenly a shot rings out.
    <br>The stone [[wall|wall2]] is nearby.
    <br>The [[house|housenear]] is within sprinting distance.<</timed>>
    <<timed 20s>><<goto "dead">><</timed>>
    
  • Jud_Casper wrote: »
    [EDIT] As usual, I was over-thinking things. The solution is as simple as:
    As the house grows nearer something starts to feel wrong.
    <<timed 3s>><<audio "gun_shot" play>><br>Suddenly a shot rings out.
    <br>The stone [[wall|wall2]] is nearby.
    <br>The [[house|housenear]] is within sprinting distance.<</timed>>
    <<timed 20s>><<goto "dead">><</timed>>
    
    You don't need separate <<timed>> invocations here. One is sufficient as long as you use its <<next>> tag. For example:
    As the house grows nearer something starts to feel wrong.
    <<timed 3s>><<audio "gun_shot" play>>
    Suddenly a shot rings out.
    
    The stone [[wall|wall2]] is nearby.
    
    The [[house|housenear]] is within sprinting distance.
    \<<next 17s>><<goto "dead">><</timed>>
    
  • Thank you, TME. Noted.
Sign In or Register to comment.