Page 1 of 1

Pause conversation until custom UI button is clicked?

Posted: Thu Nov 28, 2019 6:29 am
by Icolino7
Hi, there. :)

Is there a way to pause conversation until a user hits a specific custom UI button?

Or end it and start a new conversation?

Re: Pause conversation until custom UI button is clicked?

Posted: Thu Nov 28, 2019 8:19 am
by Tony Li
Hi,
Icolino7 wrote: Thu Nov 28, 2019 6:29 amIs there a way to pause conversation until a user hits a specific custom UI button?
There are 2 ways:

1. Use a continue button.
  • If you want to do this for all dialogue entry nodes in the conversation, set the Dialogue Manager's Subtitle Settings > Continue Button dropdown to Always.
  • If you only want to do it in a specific node, use SetContinueMode() in the node's Sequence, such as:

    Code: Select all

    SetContinueMode(true);
    required SetContinueMode(false)@Message(Continue)
2. Or tell the Sequence to wait for a message. Configure your custom UI button to send that message. Set the node's Sequence to something like:

Code: Select all

WaitForMessage(MyMessage)
and configure your UI button's OnClick() event to call a C# script method with this line of code:

Code: Select all

PixelCrushers.DialogueSystem.Sequencer.Message("MyMessage");
Icolino7 wrote: Thu Nov 28, 2019 6:29 amOr end it and start a new conversation?
You can configure your custom UI button to run a C# method like this instead:

Code: Select all

using PixelCrushers.DialogueSystem; //<-- Include at top of script.
...
public void SwitchConversation(string newConversation)
{
    DialogueManager.StopConversation(); // End the current conversation.
    DialogueManager.StartConversation(newConversation); // Start the new conversation.
}

Re: Pause conversation until custom UI button is clicked?

Posted: Thu Nov 28, 2019 9:01 am
by Icolino7
Wow, great customer support. I appreciate this very much. Message system is working fine. Thanks learning here a lot.

Can you answer me one more question?

How can I make it that the last sequence of the dialog is not skippable, unless I send the message to skip it.

Right now if I click directly on the dialog it skips the last sequence without waiting for my message.

Re: Pause conversation until custom UI button is clicked?

Posted: Thu Nov 28, 2019 4:39 pm
by Tony Li
To wait for a message, put this in the Sequence field:

Code: Select all

WaitForMessage(msg)
where msg is the message to wait for. Send this message using C# code: Sequencer.Message(msg)

However, if you have enabled continue buttons, then the player can still skip ahead by clicking the continue button. To disable the continue button, put this in the Sequence field:

Code: Select all

SetContinueMode(false)
You can combine them in the Sequence:

Code: Select all

SetContinueMode(false);
WaitForMessage(msg)