Race condition for SetVariable and Sequencer.Message
Posted: Wed May 12, 2021 11:16 am
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?
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?