Response Menu Sequence delay

Announcements, support questions, and discussion for the Dialogue System.
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Response Menu Sequence delay

Post by fkkcloud »

Hi,

I am trying to put a delay after the Response Menu is selected.
123.png
123.png (50.98 KiB) Viewed 1840 times
this does not work.

I don't know if the Response Menu would care if my Subtitle Setting's Continue Button is set to 'Always'?

What should I do if I want to put a delay right after the Response Menu is selected - before NPC respond?
So:
1) Player press on the choice in the Response Menu
2) Response Menu dismiss
3) There is a Delay of 1 second - that does not show anything (Kinda like a fake so it looks like NPC is thinking to respond)
4) NPC dialogue appears after the delay above.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Response Menu Sequence delay

Post by Tony Li »

The Default Response Menu Sequence plays while the response menu is visible. But when the player clicks a response the Dialogue System will automatically stop the sequence if it's still playing.

Instead, if you want to delay after the player clicks a response, make a subclass of StandardUIResponseButton. Override OnClick() to wait:

Code: Select all

public class MyResponseButton : StandardUIResponseButton
{
    public override void OnClick()
    {
        StartCoroutine(DelayThenClick());
    }
    IEnumerator DelayThenClick()
    {
        yield return new WaitForSeconds(1);
        base.OnClick();
    }
}
Put this on your response buttons instead of StandardUIResponseButton.
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: Response Menu Sequence delay

Post by fkkcloud »

But this would not dismiss the Dialogue box but just wait for delay then dismiss it, right?

This is what is expected result.
The choice goes away right after selection.
Player does an animation (but skipping PC subtitle as you can see in the video)
Then, after 1 second delay, NPC respond.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Response Menu Sequence delay

Post by Tony Li »

To do that, use SetDialoguePanel() in the player response's Sequence field. For example:
  • Menu Text: "I wish I could squeeze you."
  • Sequence:

    Code: Select all

    SetDialoguePanel(false);
    AnimatorPlayWait(WaveHand)->Message(Done);
    SetDialoguePanel(true)@Message(Done)
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: Response Menu Sequence delay

Post by fkkcloud »

and for the general setting of the dialogue, would this still be valid?
test.png
test.png (160.89 KiB) Viewed 1811 times
So, basically no on SKip PC subtitles I assume

Also, I am implementing a bunch of custom facial/body animation with my custom Sequences.
In order to implement proper Wait, would I want to call

Code: Select all

Stop();
after watching its animator state enough? in

Code: Select all

 private IEnumerator MonitorState(Animator animator, string stateName)
of

Code: Select all

public class SequencerCommandAnimatorPlayWait : SequencerCommand
or can I put a manual delay after PC's response sequence like below?

Code: Select all

SetDialoguePanel(false);
Anim(Player, AnimTrigger); // this is my custom animation sequence without any "Wait" feature 
SetDialoguePanel(true)@2
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Response Menu Sequence delay

Post by Tony Li »

fkkcloud wrote: Tue Jan 05, 2021 3:01 pmSo, basically no on SKip PC subtitles I assume
You can still keep the Skip PC Subtitle After Response Menu checkbox ticked. This only makes it skip the subtitle text. But the response node's Sequence will always play. It's not affected by the checkbox.
fkkcloud wrote: Tue Jan 05, 2021 3:01 pmAlso, I am implementing a bunch of custom facial/body animation with my custom Sequences....
That's correct; call Stop() after the animation is done. Then you can use ->Message and @Message:

Code: Select all

SetDialoguePanel(false);
Anim(Player, AnimTrigger)->Message(Done);
SetDialoguePanel(true)@Done
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: Response Menu Sequence delay

Post by fkkcloud »

What if I really want to set an arbitrary delay like an exact 2 seconds.

Code: Select all


Anim(Player, AnimTrigger); // since this is just calling  animTrigger - calling Stop() right after should be good for me
SetDialoguePanel(false);
Continue()@2.1; // No continue button for PC subtitle so manually calling Continue here. I have Continue button for all the other subtitles btw.
SetDialoguePanel(true)@2; // so this will show NPC subtitle, correct?

I also made the PC Subtitle's Internal Panel's gameObject to be disabled in the prefab so its completely invisible.
Otherwise, I get a "briefly hide/how animation triggered" for the subtitle UI.
The problem is when I want to show PC subtitle with 1 choice (which becomes just general subtitle) but it gets disabled as well..
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Response Menu Sequence delay

Post by Tony Li »

If there is only one choice and you want to show it in a response menu anyway, include the markup tag "[f]" in the text. This forces it to show a menu.
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: Response Menu Sequence delay

Post by fkkcloud »

No, I want to show the PC subtitle than menu for a single player choice.

For now, I ticked Skip PC subtitle so I don't have to disable the panel itself of PC on multiple choices.
Then, I ticked Show subtitle for PC line so it shows for single PC choice.

Only problem is that, if I have
[ Single PC Line ]
show PC subtitle here (which is desired)
then I have 2 choices
[ PC Choice 1 ] [ PC Choice 2 ]
it does not show PC subtitle based on the choice here (which is also desired)
but this somehow briefly shows the [ Single PC Line] a bit then show NPC subtitle.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Response Menu Sequence delay

Post by Tony Li »

If you want to show the PC subtitle after the player selects a response menu button, tick Skip PC Subtitle After Response Menu. (Sorry if I misunderstand.)
Post Reply