Delay a subtitle from showing

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Delay a subtitle from showing

Post by AoF »

I have an animation of a character leaving the room then coming back. I'd like to play the animation then have the dialogue start, but I'm not sure how to do this. I thought it would be done by the Delay(3) sequence, but when I put that on a node, it just made it so that clicking on the continue button didn't do anything the first time.
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Delay a subtitle from showing

Post by Tony Li »

If the animation is part of the conversation, and if the dialogue panel didn't have any visible parts except for the subtitle and menu panels, then the first node could have been set up like this:
  • Dialogue Text: (none)
  • Menu Text: (none)
  • Sequence:

    Code: Select all

    AnimatorPlayWait(CharacterLeaveAndReturn)->Message(Done);
    Continue()@Message(Done)
Since the Dialogue Text and Menu Text are blank, the conversation won't open a subtitle panel. (The exception is if a subtitle panel's Visibility dropdown is set to Always From Start.) When the animation is done, it will continue to the next node.

However, if I recall correctly, in your project the dialogue panel has visible parts. The sequence above won't work. Even though the individual subtitle panels won't appear, the dialogue panel's visible parts will still appear. The solution is to change the Sequence to something like this:
  • Dialogue Text: (none)
  • Menu Text: (none)
  • Sequence:

    Code: Select all

    SetEnabled(Canvas,false,Dialogue Manager/Canvas);
    AnimatorPlayWait(CharacterLeaveAndReturn)->Message(Done);
    Continue()@Message(Done);
    SetEnabled(Canvas,true,Dialogue Manager/Canvas)@Message(Done);
This sequence keeps the Dialogue Manager's Canvas invisible during the first node.

---

On the other hand, if the animation isn't part of the conversation, then you can set up a Dialogue System Trigger set to OnUse. When the animation is done, call the Dialogue System Trigger's OnUse() method -- for example in a Timed Event component, or using the SendMessage() sequencer command in a sequence. Here's an example of the latter:

Code: Select all

AnimatorPlay(CharacterLeaveAndReturn);
SendMessage(OnUse,,My Conversation Trigger)@3
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: Delay a subtitle from showing

Post by AoF »

Cool, thanks. FWIW, in this case, I don't care if the panel is visible the whole time. This is something that's going to happen in the middle of a conversation.
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Delay a subtitle from showing

Post by Tony Li »

Oh, in that case the sequence is much simpler. Leave the Dialogue Text and Menu Text blank, and use Continue() to progress when the animation is done. And if you do want to hide the dialogue panel in the middle of a conversation, you can use the SetDialoguePanel() sequencer command. You just can't use it as the very first thing in a conversation because the dialogue panel is still in the process of appearing (e.g., playing its Show animation).
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: Delay a subtitle from showing

Post by AoF »

ok, and normally I would want to use a required Continue(); but that won't be supported until .8, right?
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Delay a subtitle from showing

Post by Tony Li »

I don't think you ever need "required" in front of Continue().

The required keyword is useful for other commands that might not have run by the time Continue() runs or the player clicks the continue button.
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: Delay a subtitle from showing

Post by AoF »

Tony Li wrote: Sun Jun 16, 2019 10:39 pm I don't think you ever need "required" in front of Continue().
What about for this situation: viewtopic.php?f=3&t=2324&p=12780#p12766

Should I have put the required on the LoadLevel instead?
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Delay a subtitle from showing

Post by Tony Li »

You still don't need "required" in front of Continue().

If LoadLevel() runs right away -- in other words, it doesn't have a "@" after it -- then it doesn't need "required" either.

However, if LoadLevel() is going to wait for a specified time or message, then put "required" in front. This way it's guaranteed to run even if the player clicks the continue button before the time or message occurs.
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: Delay a subtitle from showing

Post by AoF »

OK, but if we were talking about animations instead, would a required be needed or else it could be interrupted in the middle and stop short? Or, if a sequence starts, does that mean it can't be interrupted?
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Delay a subtitle from showing

Post by Tony Li »

Any sequence can be interrupted (for example, when the player clicks the continue button). If a sequencer command has "required" in front and it hasn't started yet, then if the sequence is interrupted the command will start. However, since the sequence has been interrupted, the command will only be given 1 frame to act.

Some commands, such as AudioWait(), "clean up" when they finish, including when the sequence is interrupted. AudioWait() will stop the audio playback. The Audio() command, on the other hand, kicks off the audio playback and then leaves it on its own. If you want the audio to keep playing even if the sequence is interrupted, use Audio().

AnimatorPlayWait(), on the other hand, doesn't do any cleanup because this is typically handled by an animator transition or by another Animator sequencer command. It wouldn't know what to clean up on its own. So if you use any Animator sequencer commands, you can assume that they will continue even if the sequence is interrupted.
Post Reply