End a scheme when the target dies or leaves
The goal
Section titled “The goal”A scheme stops, with the result you choose, when its target dies or leaves the game.
Do it, step by step
Section titled “Do it, step by step”The quick way: a switch
Section titled “The quick way: a switch”- Open the scheme’s settings and find the Requirements section.
- Turn on Ends if target is gone. When the target dies or is removed, the scheme ends with No Result. Ends if conspirator is gone does the same for the Conspirator.
A scheme made in the Studio starts with both on.
One made before keeps what it had.
The way you control: a requirement
Section titled “The way you control: a requirement”- In Requirements, click Add requirement, name it, for example Target is alive, and add the condition and a Reason.
- Set Counts to While it runs, or to To start and while it runs.
- Set If it breaks:
| If it breaks | What happens |
|---|---|
| Run its output | The requirement’s output runs. The other flows go on. |
| Stop everything, then run its output | Every flow stops first, then the output runs. |
- On the canvas, add When a Requirement Breaks. It has one output for each requirement that counts while the scheme runs, named like the requirement.
- Link the output of your requirement to Fail Scheme, to Succeed Scheme, or to a dialogue first.
The demo scheme Offer a Token does this: its requirement Target is alive counts both ways and stops everything when it breaks, and in its When a Requirement Breaks node the output Target is alive leads to a Fail Scheme node, which sets the result and lets the closing flow run.
What you will see
Section titled “What you will see”A requirement reacts once, when it stops being met. After one that stops everything, no other flow runs, and then the output runs.
The End flow is not stopped by a broken requirement, so the closing nodes still run. End takes the output that matches the result, On Failure after a Fail Scheme.
What can go wrong
Section titled “What can go wrong”- The output never runs. The requirement counts To start only, which never breaks while the scheme runs. The node’s card warns.
- Two requirements break in the same check. If one of them stops everything, the output of one that only runs its output does not run in that check.
- The result is No Result. The switch ends the scheme without one. Use a requirement and Fail Scheme when the story needs a failure.
- No target. With Target Not Required on and no target, Ends if target is gone does nothing.
How it connects
Section titled “How it connects”- Timing and the two choices are on Requirements, the editor on Scheme settings.
- The nodes are When a Requirement Breaks, Fail Scheme, Succeed Scheme and End.
- To keep a scheme from starting at all, see Hide a scheme the player cannot start.