Response Menu Sequence delay

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Response Menu Sequence delay

Post by Tony Li »

Hi,
fkkcloud wrote: Sat Jan 09, 2021 12:39 pmDefault Response Menu Sequence is only for player's response menu, right?
Default Player Sequence is for the single PC subtitle (like NPC's one), correct?
No, it's a little different.

When an NPC node has a Response Menu Sequence, it will play while the response menu is visible. It will stop playing when the player chooses a response.

If you set the Dialogue Manager's Default Response Menu Sequence and the NPC node does not have a Response Menu Sequence, then it will play the Default Response Menu Sequence while the response menu is visible.

The Default Player Sequence will play when the player chooses a response, or when a PC subtitle plays. If the Default Player Sequence is blank, it will use the Default Sequence. (But if no PC subtitle is supposed to play, it won't use the Default Sequence either.)
fkkcloud wrote: Sat Jan 09, 2021 12:39 pmAlso, is there any way to put a shortcut or set of Sequence command always attached to the Response Menu Sequence?
Because {{default}} is needed when I have extra sequence in the Response Menu's seqeunece command section.
Yes, you can use a {{shortcut}} in the Response Menu Sequence.
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: Response Menu Sequence delay

Post by fkkcloud »

I see. so there is no Default Player Responsive Menu sequence setting. If I want to play something only for Player's responsive menu has been selected. (not for PC subtitle)

What would be easy way to automatically add a shortcut no matter what to the Player's responsive menu (only for its selected).

What I mean is, I have {{pc}} short cut which does the thing we've discussed all along in this thread. (skipping PC subtitle and putting proper delay to it), but I am afraid that I would forget to put {{pc}} for some responsive menu one day.

If I enable the "Responsive Menu Sequence" in the Player's Responsive Menu, then that will play when I hover on that specific choice, right?

and if I enable the "Responsive Menu Sequence" in the NPC's, then that will be played while PC's responsive menu is visible, correct?
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Response Menu Sequence delay

Post by Tony Li »

fkkcloud wrote: Sat Jan 09, 2021 1:47 pmIf I enable the "Responsive Menu Sequence" in the Player's Responsive Menu, then that will play when I hover on that specific choice, right?

and if I enable the "Responsive Menu Sequence" in the NPC's, then that will be played while PC's responsive menu is visible, correct?
Yes, both statements are correct. The Response Menu Sequence is only used when showing the response menu, not when the player chooses a response.

You could add a script to the Dialogue Manager that adds a sequence to the player's response nodes. Example:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class AddPlayerResponseSequence : MonoBehaviour
{
    public string playerResponseSequence; //<-- Set in inspector.
    
    private bool showedMenu;
    
    void OnConversationStart(Transform actor)
    {
         showedMenu = false;
    }
    
    void OnConversationResponseMenu(Response[] responses)
    {
        showedMenu = true;
    }
    
    void OnConversationLine(Subtitle subtitle)
    {
        if (subtitle.speakerInfo.isPlayer && showedMenu)
        {
            // This line is from a player response menu choice. Add sequence if necessary:
            if (string.IsNullOrEmpty(subtitle.sequence))
            {
                subtitle.sequence = playerResponseSequence;
            }
        }
        showedMenu = false;
    }
}
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: Response Menu Sequence delay

Post by fkkcloud »

If I have multiple Response Menu (not multiple choices but just response situation count)during the conversation,
how do I reset the showedMenu?
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Response Menu Sequence delay

Post by Tony Li »

I forgot to add that line to the script. I just added it above. (showedMenu = false)
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: Response Menu Sequence delay

Post by fkkcloud »

This is what I choose to do so I can add it to the existing sequence that I have for the Response Menu Sequence rather than replacing it.

Code: Select all

void OnConversationLine(Subtitle subtitle)
    {
        if (subtitle.speakerInfo.isPlayer && _showedMenu)
        {
              subtitle.sequence += "{{pc2}}";
            _showedMenu = false;
        }
        
    }
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Response Menu Sequence delay

Post by Tony Li »

Looks good!
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: Response Menu Sequence delay

Post by fkkcloud »

Sorry one more thing..!

If I dont want to add this only for any of last PC response menu nodes, what would be the right thing to call?

I kinda looked up the forum and did this but not quite sure this is 100% valid.

Code: Select all

var isLastNode = !DialogueManager.currentConversationState.hasAnyResponses;
        // Add pc subtitle to it
        if (subtitle.speakerInfo.isPlayer && _showedMenu)
        {
            if (isLastNode)
            {
                subtitle.sequence += "Continue();";
            }
            else
            {
                subtitle.sequence += "{{pc2}}";
            }
            
            _showedMenu = false;
        }
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Response Menu Sequence delay

Post by Tony Li »

Yes, I think that should work.
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: Response Menu Sequence delay

Post by fkkcloud »

I am setting an actor's dialogue panel to a panel like below on OnConverstionStart

Code: Select all

DialogueManager.PlaySequence("SetPanel(SCENE_EVENT, 3);");
and somehow, after the below sequence is called on Player Response Menu, the panel id gets set back to 0.
or at least, it is forcing it to use panel 0.

Code: Select all

HidePanel(1);
SetDialoguePanel(false);
Continue()@2;
required SetDialoguePanel(true)@2;

FYI panel 1 is just PC subtitle
Post Reply