Continue to different nodes programatically based on condition.
Continue to different nodes programatically based on condition.
Hi. I have a Success and a Fail node after showing a puzzle. A Success() function gets called if the user succeeds, and vice versa. What would be the best practice way to enter the correct node in each respective method? My continue Continue Button is set to "Always", which might be giving me problems, but I'm not sure.
Re: Continue to different nodes programatically based on condition.
Hi,
If the puzzle is part of the conversation, such as a riddle, then two links will be helpful:
1. In a dialogue entry node, tell the conversation to wait until it receives a sequencer message. You can choose the message string; it's arbitrary. Maybe something like:
3. In the Failure() function, set a Dialogue System variable and send the sequencer message:
4. Add an empty node after the node above. (See the 'Conversations Evaluate Conditions One Extra Level Ahead' note.) Set the Sequence to "Continue()" to simulate a continue button click and automatically move past the node.
5. Link the empty node to two nodes, each of whose Conditions fields checks the DS variable and goes down the success or failure path.
If the puzzle is part of the conversation, such as a riddle, then two links will be helpful:
- Conversation Conditions Tutorial
- Special Note: Conversations Evaluate Conditions One Extra Level Ahead
1. In a dialogue entry node, tell the conversation to wait until it receives a sequencer message. You can choose the message string; it's arbitrary. Maybe something like:
- Sequence:
Code: Select all
SendMessage(Open,,Puzzle); // Call the Open() method on scripts on Puzzle GameObject WaitForMessage(DoneWithPuzzle) // Stay on this node until message "DoneWithPuzzle"
Code: Select all
void Success()
{
DialogueLua.SetVariable("SolvedPuzzle", true);
Sequencer.Message("DoneWithPuzzle");
}
Code: Select all
void Success()
{
DialogueLua.SetVariable("SolvedPuzzle", false);
Sequencer.Message("DoneWithPuzzle");
}
5. Link the empty node to two nodes, each of whose Conditions fields checks the DS variable and goes down the success or failure path.
Re: Continue to different nodes programatically based on condition.
The solution mostly works, except for one hiccup. The dialogue doesn't progress forward automatically when the puzzle is finished, even after adding a WaitForMessage(Answered) sequence to the node that launches the puzzle. I'm calling Sequencer.Message("Answered"); in the success method.
Re: Continue to different nodes programatically based on condition.
If you're using continue buttons, change:
to:
Code: Select all
WaitForMessage(Answered)
Code: Select all
Continue()@Message(Answered)
Re: Continue to different nodes programatically based on condition.
Perfect solution, thank you sir!