Quick time events in Twine Sugarcube

Twine Version: 2.7.0

So, I am trying to create a quick time event in my game. I was thinking of having a bar with a pointer that moves back and forth and the player has to click a “Stop” button and if it lands in the green it’s a success.
Or, I was thinking of a kind of countdown game where a number starts from 100 and quickly counts down to 0. A random number is chosen as the “correct” one, on coming closer to that number the text becomes yellow and then green when the correct number is presented. The player has to stop the countdown on the green.

Not really a coder, not sure how to go about making either of these games. If anyone has any pointers please let me know.
I would also love to know whether you know games with quick time events similar or even completely different from the ones I just talked about above.

1 Like

I’ve done QTE before in SugarCube, for Goncharov Escapes! (source code).

The basic code to make a QTE is having a timer and an action after this:

<<timed 3s>>
    /* Code of what you want to happen */

In Goncharov, I sent the player to another passage:

<<timed 5s>><<goto "C">><</timed>>

You can do a visible countdown using the <<replace>> macro, like in the example on this page or on this page (it has a colour change too).

Or you can have a visible bar showing the time left, which can be done in plain css. There’s also Chapel’s Meter Macro that can do this too (with colour change irrc).

This is a bit more complicated, and would require some JavaScript. I’ve seen it being done on the Twine server a few years ago though.