Skip to content

Conditional block

A conditional block directs the player to different branches of the story tree. The conditions check the values of story variables to determine which branch the player follows.

Add a condition

Select the conditional block to open its settings.

Branch

The table starts out empty. Click + to add a condition. Each condition you add creates a new output on the block.

Branch table in the conditional block with the + button and a configured condition

Out

The first column shows the output number for each condition. If a row's condition is met, the block sends the player to the output shown in that row.

Value

Click the icon in the first Value column to choose the first value to compare.

  • Z

    Enter an integer.

  • Die icon

    Choose this option to generate a random number.

  • Project variable

    Select a variable to use its value.

OP

Choose the symbol for the comparison you want to make. The options are greater than, less than, equal to, not equal to and greater than or equal to.

Value

Use the Value column after OP to choose the second value to compare. As in the first Value column, you can enter an integer with Z, generate a random number with the die icon or use the value of a project variable.

Default output

The block always has a default output. If no conditions are met, the block sends the player to that output. Its number appears at the bottom of the table.

Delete a condition

Click the trash icon in the row for the condition you want to delete.

Write conditions in a script

Code

Click this button to open the script editor. If you have already added conditions to the Branch table, the block automatically converts them to code.

Conditional block script editor after conditions conversion

You can write more complex conditions with if, else if and else.

Choose an output in the script

Use the out variable to choose the output. For example, out = 1 sends the player to output 1, and out = 2 sends the player to output 2.

Create the output before using it

Make sure the output exists on the block before assigning its number to out.