Conditional checks variable values and runs actions when a condition matches.
Use Conditional for story logic based on variables, such as route flags or values that change where the story goes.
Conditional does not show choices to the player. Use Choices when the player should select an option.
Requirements
Conditional needs a variable before you can add a variable branch.
The command-line Conditional editor supports these variable types:
- String
- Number
- Boolean
The editor can create these condition operators:
- Equals
- Does Not Equal
If a string variable uses enum values, the condition value is selected from those enum values.
Add a Conditional action
To add a Conditional action to a scene line:
- Add a Conditional action.
- Click
Add Branch. - Select the variable to check.
- Select
EqualsorDoes Not Equal. - Enter or select the comparison value.
- Add the actions that should run when the branch matches.
- Click
Save Branch. - Add more branches if needed.
- Add a default branch if the line needs fallback behavior.
- Click
Submit.
Branches
A branch has a condition and a set of actions.
When the line runs, RouteVN checks branches from top to bottom. It runs the actions in the first matching branch, then stops checking the rest.
If no branch matches, RouteVN runs the default branch when one exists. If there is no default branch, Conditional runs no actions.
Default branch
The default branch is the fallback branch. It does not have a condition.
Use it when the story should always do something even if no condition matches.
The default branch must be the last branch. RouteVN Creator keeps new condition branches above the default branch.
Branch actions
The command-line Conditional editor currently supports these branch actions:
Use Section Transition when a matching branch should move the story to another section.
Use Reset Story At Section when a matching branch should jump to a section and reset story context.
Use Update Variable when a matching branch should set or change another variable.
Examples
Route by a boolean flag:
- Create a boolean variable named
Helped Aki. - Add a Conditional action.
- Add a branch where
Helped Akiequalstrue. - Add a Section Transition action to the Aki route section.
- Add a default branch.
- Add a Section Transition action to the common route section.
- Click
Submit.
Route by a string enum:
- Create a string variable named
Selected Route. - Enable enum values such as
common,aki, andren. - Add one branch for each route value.
- Add a Section Transition action inside each branch.
- Add a default branch if unknown values should go to a safe section.
- Click
Submit.