Conditions
Build conditions from resources, flags, achievements, formulas, expressions and system states, and combine them with All, Any and NOT.
Conditions
Conditions decide when something may happen. The same condition editor appears everywhere Leap Studio needs one:
- the Unlock condition of an achievement
- the Conditions in an entitlement's Availability
- the Conditions of a custom operation
- the Conditions of an operation inside a system
- the Conditions of an exit in a system
Instead of describing the condition editor with screenshots, this page embeds the real one from Leap Studio, set up with the example game used throughout these docs.
Demo mode: the editors below are fully interactive, but nothing you do here is saved. Use the Reset button at the top-right of each demo to restore its starting state.
Adding a Condition
Click + Add condition. A new row reads "Select element…" >= 0. Pick what to compare under "Select element…" — the picker searches every kind of element at once — and the kind you pick decides the rest of the row:
- Resource, constant or achievement — an operator (
<,<=,==,>=,>or!=) and a value to Compare against. The value can be a plain number or an expression — see Values and Expressions. - Formula — the formula's current value, compared the same way as a resource. Pick it under Formula in the picker, or click ƒ ("Use an existing formula") next to the picker — see Formulas.
- Flag — the row switches to is true or is false.
- System — the row switches to is or is not, and a state picked from "— state —".
If a formula exists but this element can't use it, it isn't listed: the bottom of the picker says how many formulas that applies to, and why — e.g. "2 formulas can’t be used here — a formula must be ungrouped, or in the same top-level group as this element." When no formula can be used at all, ƒ is disabled and its tooltip gives the same reason. A formula that is already on the left side but can't be used there — for example after the element moved to another group — stays shown, ringed in red, until you replace it.
The example below passes while the player holds at least 100 gold. Try changing the operator or the amount, or pick a different element:
Comparing an Expression
A row can also compare a calculation instead of a single element — for example, gold and gems together. On a row that compares values, the left side has the same two buttons as the value you compare against:
- ƒ ("Use an existing formula") puts a formula on the left side.
- # ("Build an expression (elements, curves, arithmetic)") opens the expression builder with the left side already in it — the picked element or formula, or nothing on a new row. Extend it, then click Done.
Flag and system rows don't have these buttons. Using ƒ or # keeps the operator and the value you compare against — unless the result is a single flag, which turns the row into a flag row. The example below passes once gold and gems together reach 300:
Once the left side is an expression, the row shows it in place of the picker: click it to edit it again, or click ƒ to replace it with a formula. If you reduce it to a single element or formula, the row shows the picker again.
To remove a formula or an expression from the left side, open the builder — click # next to a formula, or click the expression — delete every block and click Done. Only the left side is cleared: it goes back to "Select element…", and the operator, the value you compare against and the rest of the condition stay as they were.
Combining Conditions
With two or more rows, Match appears above them:
- All — "Every row must pass (AND)".
- Any — "At least one row must pass (OR)".
+ Group adds a nested group of rows with its own Match setting, so you can mix the two. The example below passes with 250 gold together with 100 XP (a nested All group), or with 30 gems:
Click the NOT pill at the start of a group to negate the whole group. Rows have no NOT pill: to negate a single row, use the opposite operator (!= for ==, < for >=), is false or is not. A row that is already negated still shows the pill; click it to remove the negation. The example below requires the tutorial to be done and NOT (no energy left, or less than 10 gold):
Checking a System's State
Pick a system to ask which state a player is in. Only states are listed — never randomizers, because a player is never in one. The example below passes while Main Quest is in Chapter 2:
Empty Conditions
A condition with no rows always passes, so leaving one empty means "always". The one exception is an achievement's Unlock condition: an achievement with an empty unlock condition never unlocks on its own — see Creating Achievements.
Copying Conditions
Where a Conditions section offers them — on operations, exits and custom operations — Copy these conditions copies its rows, and Replace with the copied conditions pastes them over another section's. Copied conditions stay available in the same browser tab.
Next Steps
Continue to Values and Expressions to learn what you can compare against.