Conditions (condition)
Conditions are a universal language used literally everywhere: in stage text variants (texts), in transfers
(transfers), in points on the map, in NPC squads, and in quest checkpoints. Learn it once and you can control
the visibility and availability of anything in the game — without code.
A condition is an object of the form { key: [value] }. An empty object {} means "the condition is always
satisfied."
Checking for presence (has / !has)
{ "has": ["sidorovich_job"] }
{ "!has": ["sidorovich_job"] }
has checks whether the player has an item or an arbitrary text flag in their inventory. A flag is just a
label string with no visual representation, which can be granted by the add action
and used as a story's "state variable" (for example, "sidorovich_job" as a "quest started" marker). !has is
the negation: the condition is satisfied if the player does not have that item/flag.
This is the most common way to store story progress: there's no need for a separate "state stages" mechanism — progress is fully described by a set of flags and items in the inventory.
Comparing variables
{ "money>=": ["500"] }
{ "xp<": ["1000"] }
{ "Sanity>=": ["1"] }
The key is <variable_name><operator>, with available operators: =, ==, ===, !=, <, <=, >, >=.
The built-in variables are money and xp, but you can also use your own variable name, introduced by
the story's author (like Sanity in the example above) — the engine stores such custom counters in the
player's parameters (parametersMap) right alongside the built-in ones.
Your own numeric variables are handy for a character's morale/reputation, a counter of completed faction
quests, a specific NPC's trust level, and anything else that doesn't reduce to a simple "has/doesn't have an
item." Such variables are changed with the add action using a numeric value.
How a matching variant is chosen
Conditions in lists (texts, transfers) are checked in order, and the first matching item wins. That's
why specific conditions are usually placed at the start of the list, with the "default" variant
(condition: {}) at the end.
Where else conditions are used
| Where | Effect of the condition |
|---|---|
texts[].condition | Which text variant to show |
transfers[].condition | Whether to show this reply/transfer option |
A point on the map (points[].condition) | Whether the point is currently visible to the player on the map |
An NPC squad (spawns[].condition) | Whether the squad appears at the location |
A quest checkpoint (checkpoints[].condition) | Whether the quest step is counted as complete |
For example, a point on the map with the condition { "has": ["warehouse_key"] } is physically not shown on
the map until the player gets the key — and appears on its own, with no extra code, as soon as the condition
is met.
Next
- Actions — what changes the flags/variables that conditions check.
- Variables and Flags — how to design a story's flag system.