Race condition for SetVariable and Sequencer.Message

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
mageizlude
Posts: 2
Joined: Wed May 12, 2021 10:55 am

Race condition for SetVariable and Sequencer.Message

Post 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?
Attachments
dialoguesystem1.png
dialoguesystem1.png (607.37 KiB) Viewed 134 times
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Race condition for SetVariable and Sequencer.Message

Post by Tony Li »

Hi,

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

See: Conversations Evaluate Conditions One Extra Level Ahead
mageizlude
Posts: 2
Joined: Wed May 12, 2021 10:55 am

Re: Race condition for SetVariable and Sequencer.Message

Post by mageizlude »

That worked! Thank you!
User avatar
Tony Li
Posts: 22037
Joined: Thu Jul 18, 2013 1:27 pm

Re: Race condition for SetVariable and Sequencer.Message

Post by Tony Li »

Glad to help!
Post Reply