start a simaltaneous conversation in an entry

Announcements, support questions, and discussion for the Dialogue System.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: start a simaltaneous conversation in an entry

Post by CHOPJZL »

So I will use ShowResponses() when necessary. By the way, is it necessary that the InstantiateButton() in StandardUIMenuPanel class is not virtual?

Like the response button, how to properly change the subtitle panel before a line starts? SetPanel() command will take effect in the next entry, but sometimes we don't know what the next entry is when branching.
I think this time I could use OnConversationLine(), but what should I put in it to achieve this?
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: start a simaltaneous conversation in an entry

Post by Tony Li »

It's not necessary for InstantiateButton() to not be virtual. That just happens to be the way it's implemented. I'll make it virtual in the next release.

You can use [panel=#] to tell a dialogue entry to use a specific panel. If you must use OnConversationLine(), call StandardDialogueUI's conversationUIElements.standardSubtitleControls.OverrideActorPanel().
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: start a simaltaneous conversation in an entry

Post by CHOPJZL »

Ohh, how can I forget [panel=#].

But how to determin what index my target panel is? Or is there a way to set the panel by name?
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: start a simaltaneous conversation in an entry

Post by Tony Li »

Hi,
panelNumber.png
panelNumber.png (22.8 KiB) Viewed 697 times
Here's a "hack" to set it by name:

1. In the Dialogue Editor, add number variables such as Variable["NPC_Panel"] = 0, Variable["PC_Panel"] = 1, etc.

2. In your dialogue text, use [var=variable] tags: "This is in the NPC panel. [panel=[var=NPC_Panel]]"
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: start a simaltaneous conversation in an entry

Post by CHOPJZL »

In my situation I may add or remove panels in the scene at runtime, so the index for the same panel could be different. I think I can modify the Variable of the panel to keep it update.

But the subtitlePanels is an array, not a list. So it seems not able to add or remove elements. Maybe the m_builtinPanels is the right list to modify. I think I'd better write my own controls scripts, but I am worried to miss the update in the future
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: start a simaltaneous conversation in an entry

Post by Tony Li »

There's no need to modify the array. You can use panels that aren't part of the StandardDialogueUI's Conversation UI Elements > Subtitle Panels list.

Add a Dialogue Actor component to an actor's GameObject. Set the Dialogue UI Settings > Subtitle Panel Number to Custom, and assign your subtitle panel to the Custom Subtitle Panel field. In script, set DialogueActor.standardDialogueUISettings.subtitlePanelNumber and customSubtitlePanel.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: start a simaltaneous conversation in an entry

Post by CHOPJZL »

So this time I could add script in OnConversationLine() of an actor to change panel before showing text.

Code: Select all

var theActor = GetComponent<DialogueActor>();
            if (subtitle.speakerInfo.Name == theActor.GetName())
            {
                theActor.standardDialogueUISettings.subtitlePanelNumber = SubtitlePanelNumber.Custom;
                theActor.standardDialogueUISettings.customSubtitlePanel = certainSubtitlePanel;
            }
Am I right?

How to add sequence cutsecnes before or after the text? For example, start the text line after completely Fade in the portrait, and move to the next entry after completely fade out the text line
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: start a simaltaneous conversation in an entry

Post by Tony Li »

Hi,
CHOPJZL wrote: Sat Feb 27, 2021 8:58 pmSo this time I could add script in OnConversationLine() of an actor to change panel before showing text. ... Am I right?
Yes, if the DialogueActor's subtitle panel number is already set to Custom. The dialogue UI caches the subtitle panels at the start of the conversation. If you need to change panels in the middle of the conversation and you can't use SetPanel() or [panel=#], and if the actor's panel is not already set to Custom, use StandardDialogueUI.conversationUIElements.standardSubtitleControls.OverrideActorPanel:

Code: Select all

Actor actor = DialogueManager.masterDatabase.GetActor(theActor.actor);
dialogueUI.conversationUIElements.standardSubtitleControls.OverrideActorPanel(actor, SubtitlePanelNumber.Custom);
theActor.standardDialogueUISettings.customSubtitlePanel = certainSubtitlePanel;
CHOPJZL wrote: Sat Feb 27, 2021 8:58 pmHow to add sequence cutscenes before or after the text? For example, start the text line after completely Fade in the portrait, and move to the next entry after completely fade out the text line
The easiest way is to fade in the portrait in its own node. Then move to a node that types text and fades out the portrait when the text is done typing. (Listen for @Message(Typed) to know when the text is done typing.)

The details really depend on how your dialogue UI works. An alternative is to subclass StandardUISubtitlePanel and override methods such as SetContent. In your override of this method, you can wait until the portrait is faded in before starting the typewriter.

Also, if you're using separate panels for actors, you can tick Wait For Close to wait for one actor's panel to fade out before showing the next actor's panel.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: start a simaltaneous conversation in an entry

Post by CHOPJZL »

How to properly get thre reference of StandardDialogueUI?


I tried the script on livelyChatBubble, If I use my script only, the CustomSubtitlePanel changed but the actor still use the old one.

If I use OverrideActorPanel(actor, SubtitlePanelNumber.Custom), the actor uses the default panel. And this method seems just do that. Is it a mistake?

Code: Select all

public void OverrideActorPanel(Actor actor, SubtitlePanelNumber subtitlePanelNumber)
        {
            if (actor == null) return;
            var customPanel = actor.IsPlayer ? m_defaultPCPanel : m_defaultNPCPanel;
            m_actorIdOverridePanel[actor.id] = GetPanelFromNumber(subtitlePanelNumber, customPanel);
        }
        
case SubtitlePanelNumber.Custom:
                    if (!m_customPanels.Contains(customPanel)) m_customPanels.Add(customPanel);
                    return customPanel;
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: start a simaltaneous conversation in an entry

Post by Tony Li »

To get a reference to the StandardDialogueUI:

Code: Select all

StandardDialogueUI ui = DialogueManager.dialogueUI as StandardDialogueUI;
I steered you wrong with OverrideActorPanel. I'm not sure what exactly you want to do. If you leave the Dialogue Actor's Standard Dialogue UI Settings > Subtitle Panel Number set to Custom, then you can assign a different custom panel before any conversation.

If that doesn't help, would you please provide more specific details about what you want to accomplish?
Post Reply