Narrat Docs


Set Function

The set function allows you to create variables that will be kept (and saved), which can later be used in conditions.
It takes two parameters:
  • path: The path where you want to save your value. It can be a deep path and will automatically generate nested objects. For example: data.level_1.ending
  • value: The value you want to assign to the variable. For example: "good_ending"


In this example, we ask the player a question, store the answer in a variable, and then use that variable in a condition to play a line of dialogue only for players who like surprises
talk cat idle "Do you like surprises?"
set data.like_surprises true
set data.like_surprises false
talk cat idle "Since you like surprises, here's a surprise message"
Result of the above code