Wait/Pause for a second in the middle of a conversation

Announcements, support questions, and discussion for the Dialogue System.
pblenkarn
Posts: 4
Joined: Thu Mar 11, 2021 4:26 pm

Re: Wait/Pause for a second in the middle of a conversation

Post by pblenkarn »

Hi Tony!

Thanks for your prompt reply earlier. It's a step in the direction I'm heading—and in my understanding how Lua works here.

I have a couple follow ups.
(And for anyone else who might read this later, I'll try to outline what I think might be a common setup. I want to develop a SequenceCommand flow that could be make for flexible events inside of dialogue conversation. I'd rather not use Timeline, mostly because I don't want to be managing all a huge number of TimelineManagers.)

First, I'm using a Continue button in all of my dialogues. So when we call SetDialoguePanel(false), where do I find the documentation for saying something like @Continue and not @Message(Typed)? I've looked through https://www.pixelcrushers.com/dialogue- ... mentation/ and am missing it...

I know that I can call Events on the start of a conversation Node. But how can an Event or Method be called within the Sequencer? To call/invoke a Method through the Sequencer from a GameObject (or ScriptableObject), do I need to make a custom SequencerCommand for each of these types of calls?

I guess, in short, I'm really looking for a way to be able to tie calling Events directly into the Sequencer. The following isn't proper Lua, but in the end something like:

[End of First node of dialogue]
SetDialoguePanel(false)@Continue
Delay(2)
SceneEvent(OfMyChoice)
Delay(5)
AnimatorPlay()
AudioSourcePlay()
Delay(1)
SetDialoguePanel(True)
[Second node of dialogue]

Is this possible?

Thanks for the help!
Patrick
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Wait/Pause for a second in the middle of a conversation

Post by Tony Li »

Hi Patrick,

To simulate a continue button click, use the Continue() sequencer command. Example:

Code: Select all

Continue()@Message(Typed)
To continue 2 seconds after the typewriter has finished:

Code: Select all

Delay(2)@Message(Typed)->Message(Delayed);
Continue()@Message(Delayed)
To run arbitrary an arbitrary method in a sequence, you can write a custom sequencer command (tutorial) or use the SendMessage() sequencer command. The SendMessage() command is equivalent to Unity's GameObject.SendMessage() method. It can pass a string parameter or no parameter. For example, if a GameObject named "Bomb" that has a script with a method named "Explode()", you can call it like this:

Code: Select all

SendMessage(Explode,,Bomb)
Note the two commas between Explode and Bomb. That's for the optional string parameter, which in this case I'm omitting because the method doesn't accept a string parameter.

Your sequence might look something like:

Node 1:
  • Dialogue Text: "I'm going to take a long pause."
Node 2:
  • Dialogue Text: (blank)
  • Sequence:

    Code: Select all

    SetDialoguePanel(false);
    SendMessage(YourMethod,,YourGameObject);
    Delay(5)->Message(Animate);
    
    AnimatorPlay(someAnimation)@Message(Animate);
    Audio(someAudio)@Message(Animate);
    Delay(1)@Message(Animate)->Message(AllDone);
    
    required SetDialoguePanel(true)@Message(AllDone);
    Continue()@Message(AllDone);
Node 3:
  • Dialogue Text: "Here's my next line"
A few notes:
  • I added the "required" keyword in front of SetDialoguePanel(true) to make absolutely sure it runs that command at the end.
  • AnimatorPlay() and Audio() are run-and-forget commands. They don't wait for the animation or audio to finish. If you want to wait for them to finish, use AnimatorPlayWait() and AudioPlayWait().
pblenkarn
Posts: 4
Joined: Thu Mar 11, 2021 4:26 pm

Re: Wait/Pause for a second in the middle of a conversation

Post by pblenkarn »

Thanks Tony! That's helpful and I'll keep working with it.

For anyone else reading this, another option I'm using until I totally grasp the Sequencer is to use empty notes as Event nodes. It calls the Event at the beginning of the Node, then each of these Nodes has a Delay() call of an appropriate length and a Continue() call.
Attachments
Screen Shot 2021-03-17 at 10.14.07 AM.png
Screen Shot 2021-03-17 at 10.14.07 AM.png (267.43 KiB) Viewed 608 times
Post Reply