How to add delaythat prevents continue

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
shshwdr
Posts: 20
Joined: Wed Feb 02, 2022 10:00 pm

How to add delaythat prevents continue

Post by shshwdr »

In my dialogues, I set it to always have a continue button. And sometimes I want to wait 5 seconds after one line, even the player clicked continue, I want the dialogue to hide but still wait until the time is up to show the next sentence. I tried delay() but it does not work. I also tried AudioWait() but it only stops the music when I click continue. Any suggestions? thanks!
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to add delaythat prevents continue

Post by Tony Li »

Hi,

You can use the SetContinueMode() sequencer command. For example, to prevent the continue button for the first 3 seconds:

Code: Select all

SetContinueMode(false);
SetContinueMode(true)@3;
{{default}}
(The third line above tells the sequence to also include the Dialogue Manager's Default Sequence.)

This conversation will show a subtitle, then hide the dialogue UI for 3 seconds, and then show another subtitle:
  • Dialogue Text: "The dialogue UI will hide when you click continue."
  • Sequence:

    Code: Select all

    required SetDialoguePanel(false)@Message(Continued)
|
v
  • Dialogue Text: (blank)
  • Sequence:

    Code: Select all

    SetContinueMode(false); 
    Continue()@3;
    required SetContinueMode(true)@Message(Continued);
    required SetDialoguePanel(true)@Message(Continued)
|
v
  • Dialogue Text: "The dialogue UI has reappeared."
shshwdr
Posts: 20
Joined: Wed Feb 02, 2022 10:00 pm

Re: How to add delaythat prevents continue

Post by shshwdr »

That's very helpful! thanks a lot!
Just curious what is the required keyword is for?
Also I noticed there is a little dialogue fade in and out as if it tries to fade in the empty dialogue, but then fade out it because of the SetDialoguePanel, any suggestion about it?
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to add delaythat prevents continue

Post by Tony Li »

Hi,

The 'required' keyword guarantees that the command runs even if the @ condition isn't reached.

In this example:

Code: Select all

required Audio(beep)@2
Audio(beep) will normally play at the 2-second mark. However, if the player advances the conversation before the 2-second mark, the required keyword guarantees that Audio(beep) will still play.

In the case of:

Code: Select all

required SetDialoguePanel(false)@Message(Continued)
The command waits for something to send the message "Continued". Nothing actually sends this message. (The continue button doesn't send any message.) When the player clicks the continue button, the required keyword guarantees that it runs anyway.


To eliminate the fade out, use:

Code: Select all

required SetDialoguePanel(false, immediate)@Message(Continued)
shshwdr
Posts: 20
Joined: Wed Feb 02, 2022 10:00 pm

Re: How to add delaythat prevents continue

Post by shshwdr »

Thanks a lot! It does not flash when the previous one hide, but still faded in and out when the new panel re-appeared.
I tried to replace the set to true one with immediate too but the result is still the same.
required SetDialoguePanel(true,immediate)@Message(Continued);
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to add delaythat prevents continue

Post by Tony Li »

Hi,

You can fiddle with your dialogue UI's animator setup (it's possible you need to adjust transition conditions), or you can disable the Dialogue Manager's Canvas instead of using SetDialoguePanel(). This might be easier. To do that, give your Dialogue Manager's Canvas a unique name such as DialogueCanvas. Then, instead of this:

Code: Select all

required SetDialoguePanel(false)@Message(Continued)
use this:

Code: Select all

required SetEnabled(Canvas, false, DialogueCanvas)@Message(Continued)
And instead of this:

Code: Select all

SetContinueMode(false); 
Continue()@3;
required SetContinueMode(true)@Message(Continued);
required SetDialoguePanel(true)@Message(Continued)
use this:

Code: Select all

SetContinueMode(false); 
Continue()@3;
required SetContinueMode(true)@Message(Continued);
required SetEnabled(Canvas, true, DialogueCanvas)@Message(Continued)
Post Reply