Page 1 of 1

Race condition for SetVariable and Sequencer.Message

Posted: Wed May 12, 2021 11:16 am
by mageizlude
Hi, I want to have a system where:
1. Conversation for player and NPC to negotiate for an item
2. Player has to key in a price
3. Conversation continues depending on whether it is too low/high

I have a Continue()@Message(NegotiationContinue)

This will then check against two nodes using a Success boolean.

Right now, in my script I have:
DialogueLua.SetVariable("Success", true);
Sequencer.Message("NegotiationContinue");

But using the debugger, it seems like the Sequencer is running a continue BEFORE the DialogueLua.SetVariable

I expected:
1. Success bool = true
2. Sequencer message to continue
3. Proceed to "Okay, that will do."

but instead it was:
1. Sequencer message to continue
2. Proceed to "That is too expensive."
3. Success bool = true
4. Linked back to empty node
5. Proceed to "Okay that will do."

Any workaround/correct usage for this?

Re: Race condition for SetVariable and Sequencer.Message

Posted: Wed May 12, 2021 11:26 am
by Tony Li
Hi,

Add an empty node between node 3 and the two conditional nodes.

See: Conversations Evaluate Conditions One Extra Level Ahead

Re: Race condition for SetVariable and Sequencer.Message

Posted: Wed May 12, 2021 8:40 pm
by mageizlude
That worked! Thank you!

Re: Race condition for SetVariable and Sequencer.Message

Posted: Wed May 12, 2021 9:29 pm
by Tony Li
Glad to help!