Advanced: a nested conditional in raw data
The runtime supports an IfVariable action with nested then and else arrays. Existing project data can contain this form. It is not a condition row offered by the normal shared sequence picker. A visual graph is easier to edit and inspect for most authors.
{
"type":"IfVariable",
"name":"key_taken",
"equals":true,
"then":[
{"type":"ShowMessage", "text":"I have the key.",
"duration":2.2}
],
"else":[
{"type":"ShowMessage", "text":"I need the key.",
"duration":2.2}
]
}Only the selected nested branch runs. After it finishes, the outer list continues with its next action. Do not confuse that branch selection with a returned false value from some other action; the ordinary list runner does not interpret every result as a condition.
The example was checked in the runtime. For a new authoring workflow, use If Variable, Has Inventory or If Compare in a graph, then call the graph from the inspector.
A story flag such as key_taken answers whether the pickup happened. Has Inventory answers whether the character currently carries the item. Choose the condition that matches the rule; those can differ after an item is consumed or transferred.
