Page 1 of 1

A Question about Conditionals, and the Order of Operations in Nodes and Sequencers

Posted: Fri Feb 17, 2023 3:27 pm
by CJWilson
Hi, everyone!

I've been building a sort of detective game in Unity. A key part of the game is that you'll be prompted to present evidence, and only go down certain conversation paths if you pick the right piece of evidence. Think of it like Ace Attorney. I emailed the support email and got help figuring out how to set this up. I built the UI, wrote the sequencer command, and got it to change the variables checked by conditionals in the code. For the most part, it's all working as it should.... but with one weird thing.

If the branching nodes come immediately after the node where the UI is opened and the variable is changed, then it doesn't seem to register the change. I've got debug messages showing that the variable is, in fact, changing, and seemingly before the first sequence on the next node can run. If there's an empty node right after the UI one, then it all works as expected. But, if the branching nodes come immediately after the UI one follows conditional paths as though the variables hadn't been changed until after the conditional was tested.

It seems almost like the conditional for the next node is being tested before the code in the the current node's sequences has finished. Now, I can obviously work around this, either just by adding empty nodes or with some creative writing. But, I would like to understand why this is happening and see if I can learn a little bit more about the ins and outs of Dialogue System.

I have the sequence on the UI node set up like this:
SendMessage(TurnOnEvidenceUI, , Evidence UI);
WaitForMessage(PickedEvidence);
Delay(1);
TurnOnEvidenceUI does exactly that: makes the UI visible, then waits for the player to click a choice on the UI. PickedEvidence sets the variable, then sends a message to continue on.
Screenshot (1050).png
Screenshot (1050).png (262.42 KiB) Viewed 123 times
Like I said: It's all working almost exactly as I wanted it to, just with this little oddity about branches coming right after the UI node. So, can anyone tell me why this is happening, and maybe help me learn something cool?

One way or the other, thanks for the help!

Re: A Question about Conditionals, and the Order of Operations in Nodes and Sequencers

Posted: Fri Feb 17, 2023 5:26 pm
by Tony Li
Hi,

> It seems almost like the conditional for the next node is being tested before the code in the the current node's sequences has finished.

That is precisely the case. Conversations Evaluate Conditions One Extra Level Ahead