Need help with checking conditions: "All must be true"

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Shleo
Posts: 1
Joined: Mon Apr 29, 2024 1:26 am

Need help with checking conditions: "All must be true"

Post by Shleo »

Hi everyone, would love to get help on a murder mystery game I am working on.

What I want to happen
I want the player to find three different clues in the dialogue. When they find all three clues, the true identity of the killer can be revealed through a new dialogue option. If they only find one or two of the clues, the usual dialogue tree appears.


What's actually happening
For some reason, the new dialogue option gets triggered after finding only one clue.


How it's currently set up.

Here is the Conversation tree. I want 2 to trigger when three clues are found.



Here are the conditions for 1:

Code: Select all

Variable["clue1"] ~= true and (Variable["clue2"] ~= true) and (Variable["clue3"] ~= true) 
False condition action: Block

Here are the conditions for 2:

Code: Select all

Variable["clue1"] == true and (Variable["clue2"] == true) and (Variable["clue3"] == true) 
False condition action: Block


Each clue is set to true once the relevant dialogue kicks in. For example, a character will say "I have the weapon" and the script have:

Code: Select all

Variable["clue1"] = true


So can anyone help me figure out how to get 2 to trigger ONLY when all three clues have been found? Thank you!
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Need help with checking conditions: "All must be true"

Post by Tony Li »

Hmm, it looks like that should work. Here's how to debug it:

1. Use the Watches tab or Variable View window to check the variable values at runtime. Make sure they're actually all true.

2. Temporarily set the Dialogue Manager's Other Settings > Debug Level to Info. When the conversation starts, keep an eye on the Console window. The nodes will report either "Dialogue System: Block on False Link" or "Dialogue System: Add Link".

3. You can also temporarily add a Lua Console component to your scene. When you run the conversation and it goes down the wrong path, press ~+L to open the Lua Console. Then enter:

Code: Select all

return Variable
This will show the values of all variables.

Then enter:

Code: Select all

return Variable["clue1"] ~= true and (Variable["clue2"] ~= true) and (Variable["clue3"] ~= true) 
and

Code: Select all

return Variable["clue1"] == true and (Variable["clue2"] == true) and (Variable["clue3"] == true) 
to see what values they return.
Post Reply