Cutscene Triggers
A cutscene trigger is a zone that starts a scene when the player is inside and a condition holds. The scene takes control away and always ends at its length. A skip counts as finished, so results still apply, and a scene that may repeat waits until the player has left the zone.

Paste this to your AI
Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.
Add "Cutscene Triggers" to my game.
What it should do: A trigger starts a scene at the right moment and in the right place, so the story takes the stage exactly when the player has reached it, and never twice by accident or half done.
Build it exactly as this state machine. First check that it fits my game, then build it like this:
```mermaid
stateDiagram-v2
[*] --> armed
armed: Ready
playing: Playing
spent: Must leave first
done: Finished for good
armed --> armed: nothing to start it
armed --> playing: enters, condition met
playing --> playing: scene goes on
playing --> done: ends, no plays left
playing --> spent: ends, still inside
playing --> armed: ends, player outside
spent --> spent: still inside
spent --> armed: player leaves
done --> done: never again
done --> [*]
```
Use these starting values:
- length: 6 s
- skipAfter: 1 s
- maxPlays: 1 plays
Watch out for these common mistakes:
- A skipped scene leaves the story half done: Tell your AI: when a scene is skipped, apply its results just as when it ends, and report both with the same answer.
- The scene plays again at once: Tell your AI: after a scene ends with the player inside, wait until the player has left the zone before it can start again.
- A button press skips a scene nobody saw: Tell your AI: accept a skip only after the scene has run for a short time, and do not remember presses that came too early.
- The player walks out and the scene stops: Tell your AI: once a scene has begun, only its own length or a skip may end it, never where the player is or what the condition says.
- The save remembers a scene that was never finished: Tell your AI: count a scene as played only when it ends or is skipped, and save that count, so a save made during a scene plays it again.
Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP
What it does
A trigger starts a scene at the right moment and in the right place, so the story takes the stage exactly when the player has reached it, and never twice by accident or half done.
How it runs, as a diagram
Everything it can be in, and what moves it on. Your AI builds from exactly this.
How it runs, as a diagram
- Ready → Ready: nothing to start it
- Ready → Playing: enters, condition met
- Playing → Playing: scene goes on
- Playing → Finished for good: ends, no plays left
- Playing → Must leave first: ends, still inside
- Playing → Ready: ends, player outside
- Must leave first → Must leave first: still inside
- Must leave first → Ready: player leaves
- Finished for good → Finished for good: never again
Good starting values
| Value | Start with | What it changes |
|---|---|---|
| length | 6 s | How long the scene runs. A scene always ends at this time, so the player always gets control back. |
| skipAfter | 1 s | How far into the scene a skip is accepted. It keeps a player who is mashing a button from skipping a scene they never saw. Zero allows skipping at once. |
| maxPlays | 1 plays | How many times the scene may play in all. One means once only. More needs the player to leave the zone and come back. |
What usually goes wrong
A skipped scene leaves the story half done
The scene was meant to hand the player a key and set "met the queen". Skipping cuts the scene off before that line, and the door can never be opened.
Fix: Tell your AI: when a scene is skipped, apply its results just as when it ends, and report both with the same answer.
The scene plays again at once
A scene that may repeat ends while the player is still inside the zone, and starts again in the next moment, over and over.
Fix: Tell your AI: after a scene ends with the player inside, wait until the player has left the zone before it can start again.
A button press skips a scene nobody saw
The player is fighting and pressing the skip key by habit when a scene starts. It disappears in the first second.
Fix: Tell your AI: accept a skip only after the scene has run for a short time, and do not remember presses that came too early.
The player walks out and the scene stops
The zone is a doorway. The scene starts, the player is carried or pushed out of it, and the scene stops with the story half told.
Fix: Tell your AI: once a scene has begun, only its own length or a skip may end it, never where the player is or what the condition says.
The save remembers a scene that was never finished
The game saves in the middle of a scene and stores "played". After loading, the story acts as if the scene was seen, though the player only saw half.
Fix: Tell your AI: count a scene as played only when it ends or is skipped, and save that count, so a save made during a scene plays it again.
How to check it works
- A player outside the zone and a condition that holds. the player steps into the zone: the scene starts, the player has no control, and the game is told it has started.
- A player in the zone and a condition that does not hold yet. two seconds pass, then the condition starts to hold: nothing happens in the meantime, the scene starts as soon as the condition holds, and a player outside the zone never starts it.
- A scene of 6 seconds. it has run for 5.5 seconds, then 1 more: it is still running at 5.5 seconds, it has ended after the extra second, it counts as played once, and it will not play again.
- A scene is running and the player stays in the zone. it runs out and time goes on: the game hears "finished" exactly once and nothing else after it.
- A once-only scene that has played. the player leaves the zone and comes back: nothing starts, and the count of plays stays at one.
- A scene that accepts a skip after 1 second. the player presses skip in the first half second, and later stops pressing: the scene goes on, and the early press is not remembered.
- A scene that has run for 1.5 seconds. the player presses skip: the scene ends, the game hears "skipped", the scene counts as played once, and a once-only scene is done.
- A scene that may play twice has just ended while the player stands in the zone. the player stays for three seconds, then steps out, then back in: nothing starts while the player stays, the scene is ready again after the step out, and it starts on the way back in.
- A scene that may play twice has played once. it plays a second time: the count of plays is two, the scene is done, and it never starts again.
- A scene is running. the player leaves the zone and the condition turns false: the scene runs on to its end and counts as played once.
- A scene of 6 seconds and a time step of 30 seconds. the scene starts, and the next tick is also 30 seconds: it starts in the first tick and ends in the second, never both in the same tick.
- A once-only scene whose play was saved, and another saved in the middle of its run. both saves are loaded and the player stands in the zone: the first does not play again, and the second plays from the start.
- A scene about to run out. the player presses skip in the tick in which it runs out: the game hears "finished" and the scene counts once.
Works well with
- World State Flags: A scene often needs a flag to start ("has the amulet") and sets another when it ends ("met the queen"). Setting it on both finish and skip is what keeps the story whole. Set the flags when the scene ends or is skipped, and ask for them in the condition.
- Dialogue System: A scene can end in a conversation. Make sure the player is given control back once, by one of the two, and never by both. Hand control to the conversation when the scene ends, not before.
- Ability Gates: A scene that needs the player to hold a skill can use the same gate as a door does, so the two never disagree. Check the gate before the scene, not during it.
Common questions
how do cutscene triggers work
A trigger is an area in the world plus a condition. When the player is inside and the condition holds, the scene starts, the player loses control, and the game remembers that the scene was played.
what happens if the player skips a cutscene
Skipping must give the same result as watching to the end: the same items, the same flags, the same place for the player. Treat a skip as a fast finish, not as a cancel.
what do i tell my ai to add a cutscene trigger
Paste this: Add a cutscene trigger zone. The scene starts when the player is inside and a flag is set, takes control, can be skipped after 1 second, and applies its results the same way when skipped. Play it once, and never start it during another scene.
should a cutscene be skippable
Yes, almost always. Players who replay the game or lose the thread will thank you. Allow the skip after a moment, so a button press from before the scene started does not skip it.
Where it comes from
We could not find a reliable origin for this one yet.
What was checked
- 15 tests pass on the reference code.
- The state diagram was checked against the code, at the default values and at every listed low and high value.
Your AI gets the code
Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it