Narrat Docs
Search…
Choice Function

Choice Function

The choice function allows for branching dialogue by letting the player pick an option.
It takes no parameters, but opens a block that needs to contain at least a text prompt, and one or more choice(s)

Example

Simple Choice

1
choice_example:
2
talk cat idle "This example shows how to use the choice command"
3
choice:
4
"This is the choice prompt text"
5
"This is the first option the player can select":
6
talk cat idle "I will say this if you select the first option"
7
"This is the second choice the player can pick":
8
talk cat idle "I see you picked the second choice!"
Copied!
Result of the above code

Choice with conditions or skill rolls

Choices can have conditions on them to control whether they should appear. Adding a condition to a choice is done by using the $if syntax at the end of the line with the condition of your choice. If the condition is true the choice will appear, otherwise it won't.
It is also possible to make options roll a skill check and then branch on success or failure. The syntax is:
roll [skillcheckid] [skill_id] [difficulty] [choice text prompt]
A skill roll needs at least a success branch inside it, and optionally a failure branch
1
choice_example_conditions:
2
talk cat idle "This example shows how to use conditions in choices"
3
choice:
4
"This is the choice prompt text"
5
"This choice will only appear if a condition is met" $if this.DATA.someFlag:
6
talk cat idle "Choice response"
7
roll someSkillCheck testSkill 50 "This choice will run a skill check":
8
success "Skill check succeeded":
9
"This line will appear if the skill check succeeds"
10
failure "Skill check failed":
11
"This line will appear if the skill check fails"
12
Copied!
In the example above, the first choice won't appear because the condition isn't met, and the second option will appear as a skill check.
Choice with a skill check