Number variables and Boolean

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Mastodon
Posts: 4
Joined: Fri Jan 05, 2024 8:24 pm

Number variables and Boolean

Post by Mastodon »

Hello! I'm curious on how I would set a Boolean from to true or false based on a number value. Basically, keeping score. For example, if

Variable["Points"] = Variable["Points"] + 5

If the player does not meet the required X number of points, then they do not pass and cannot move on.
User avatar
Tony Li
Posts: 23250
Joined: Thu Jul 18, 2013 1:27 pm

Re: Number variables and Boolean

Post by Tony Li »

Hi,

If you want to do this in Lua (e.g., in a single dialogue entry Script field), you could use:

Code: Select all

Variable["Points"] = Variable["Points"] + 5
Variable["MyBoolean"] = Variable["Points"] >= 20
This will increment the Points variable by 5. Then it will set MyBoolean to true if Points is 20 or higher, otherwise false.

Alternatively, you could increment the Points variable (Variable["Points"] = Variable["Points"] + 5) and in another node's Conditions field check if Variable["Points"] >= 20.
Post Reply