Checking if multiple things are true in dialogue condition...

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Zappy
Posts: 4
Joined: Thu Sep 12, 2024 4:14 pm

Checking if multiple things are true in dialogue condition...

Post by Zappy »

I want a dialogue option to only show if all the conditions below are met. Is this the correct way to do it? I have also been trying to use "or" and have had no luck with that either. When I use the code below The text never shows up, even if all the conditions are met. What do I need to do differently? I am importing from articy draft if that makes a difference....
Variable["player_stats.Thing"] >= Variable["difficulty.very_easy"] and
Variable["player_stats.Thing"] < Variable["difficulty.easy"] and
isInRange(Variable["player_stats.DifferentThing"], 0, 40)

Thank you in advance !!!
User avatar
Tony Li
Posts: 22034
Joined: Thu Jul 18, 2013 1:27 pm

Re: Checking if multiple things are true in dialogue condition...

Post by Tony Li »

Hi,

That conditional expression looks fine to me.

Are there any errors or warnings in the Console window?

Please try this:

1. Play the conversation in the Unity editor's play mode.

2. At the point where those Conditions will be checked, open the Dialogue Editor window to the conversation. The current dialogue entry node will be colored green. Links from the current node will be red if the Conditions are false, green if the Conditions are true or blank.

3. Change the Dialogue Editor window to the Watches tab, or add a Lua Console component to the scene and press ~+L in the Game view to open it.

4a. If you're using the Watches tab, enter each line below individually in the Run field at the bottom and click Run, or enter them into the Lua Console if you're using that.

Code: Select all

print(Variable["player_stats.Thing"] >= Variable["difficulty.very_easy"])

Code: Select all

print(Variable["player_stats.Thing"] < Variable["difficulty.easy"])

Code: Select all

print(isInRange(Variable["player_stats.DifferentThing"], 0, 40))
Verify that the value printed in the Console window is what you expect.

4b. If you're using the Lua Console, enter each line below individually and check the return values:

Code: Select all

return Variable["player_stats.Thing"] >= Variable["difficulty.very_easy"]

Code: Select all

return Variable["player_stats.Thing"] < Variable["difficulty.easy"]

Code: Select all

return isInRange(Variable["player_stats.DifferentThing"], 0, 40)
Verify that the value printed in the Console window is what you expect.

5. If those individual conditions are all true, try the entire expression:

Code: Select all

return Variable["player_stats.Thing"] >= Variable["difficulty.very_easy"] and Variable["player_stats.Thing"] < Variable["difficulty.easy"] and isInRange(Variable["player_stats.DifferentThing"], 0, 40)
Post Reply