Show responses before the end of the default delay

Announcements, support questions, and discussion for the Dialogue System.
lgarczyn
Posts: 30
Joined: Fri May 05, 2023 5:28 am

Show responses before the end of the default delay

Post by lgarczyn »

Hello, I have nice animations for my response buttons, but they take enough time that I want to start them before the end of the usual dialogue delay

I don't want to set Delay(0) on every node before a PC choice, and besides, this command somehow breaks the typewriter animation.

The only somewhat satisfying result was to set every pre-response node sequence to Delay({{end}}/2) followed by a response sequence of Delay({{end}}/2)
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show responses before the end of the default delay

Post by Tony Li »

Hi,

Replace your subtitle panel's StandardUISubtitlePanel with this subclass, which doesn't stop the typewriter when advancing to the response menu:

Code: Select all

public class MenuWhileTypingSubtitlePanel : PixelCrushers.DialogueSystem.StandardUISubtitlePanel
{
    public override void FinishSubtitle()
    {
        HideContinueButton();
    }
}
lgarczyn
Posts: 30
Joined: Fri May 05, 2023 5:28 am

Re: Show responses before the end of the default delay

Post by lgarczyn »

Clean, elegant, I love it.

Don't know why I was set on using sequences.
lgarczyn
Posts: 30
Joined: Fri May 05, 2023 5:28 am

Re: Show responses before the end of the default delay

Post by lgarczyn »

I've set it up as described, but I do not get any different result, unless I manually set every single dialog entries with answers to have a delay of 0.

Is there any way to detect the number of responses in a Sequence ?
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show responses before the end of the default delay

Post by Tony Li »

Hi,

You could modify the Sequence in an OnConversationLine method in a script on your Dialogue Manager. For example, the method below checks if the current subtitle will lead to a response menu. If so, it modifies the Sequence to continue after 1 second:

Code: Select all

void OnConversationLine(Subtitle subtitle)
{
    var state = DialogueManager.currentConversationState;
    bool isMenuNext = !state.hasNPCResponse && state.hasPCResponses && !state.hasPCAutoResponse;
    if (isMenuNext)
    {
        subtitle.sequence = $"Continue()@1; {subtitle.sequence}";
    }
}
lgarczyn
Posts: 30
Joined: Fri May 05, 2023 5:28 am

Re: Show responses before the end of the default delay

Post by lgarczyn »

What's the purpose of the @1 ? To add a minimum delay before the response appears?
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show responses before the end of the default delay

Post by Tony Li »

Hi,

Yes, exactly. It simulates clicking the continue button after 1 second.
lgarczyn
Posts: 30
Joined: Fri May 05, 2023 5:28 am

Re: Show responses before the end of the default delay

Post by lgarczyn »

I found that it causes a lot less issues to run a separate sequencer command:

Code: Select all

public void SkipSubtitleAnimationIfResponses(Subtitle subtitle)
    {
      ConversationState state = DialogueManager.currentConversationState;
      bool isMenuNext = !state.hasNPCResponse && state.hasPCResponses;
      if (isMenuNext) SkipSubtitleAnimation();
    }

    void SkipSubtitleAnimation()
    {
      string delay = minDelay.ToString(CultureInfo.InvariantCulture);
      string continueSequence = $"Continue()@{delay}";
      DialogueManager.PlaySequence(continueSequence);
    }
    
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show responses before the end of the default delay

Post by Tony Li »

Hi,

What if you just set the Dialogue Manager's Subtitle Settings > Continue Button mode to "Not Before Response Menu"? Or "Optional Before Response Menu" if you want allow the player to click the continue button to skip to the response menu early.
lgarczyn
Posts: 30
Joined: Fri May 05, 2023 5:28 am

Re: Show responses before the end of the default delay

Post by lgarczyn »

No, that would cause more issues.

The continue button would disappear just before that actual part I wanted to skip in the first place.
Post Reply