Actor with no portrait

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
hipsterdufus
Posts: 95
Joined: Thu Aug 12, 2021 6:39 pm

Actor with no portrait

Post by hipsterdufus »

Hi, I've been having on and off issues with my no portrait dialogues maybe you can help me figure out if I'm doing things correctly. Basically I have 2 subtitle panels, one is for characters with portraits and the other is with the portrait panel disabled. I created NPC actors with portraits and an actor named no_portrait that is obviously meant to have the portrait panel disabled. I start a conversation using DialogueManager.StartConversation("conversation_name"). In the conversation the actor conversant is 'no_portrait', however sometimes it seems to use the regular subtitle with portrait. I guess this makes sense because there's no way for me to tell it that the no_portrait actor should use the no portrait subtitle without the portrait frame. Is there a nice way to do this? I do not want to use the Dialogue Actor component and a transform in the game to start conversations. I just need to trigger conversations in code.

Thank you for any help.
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: Actor with no portrait

Post by Tony Li »

The standard way is to use that Dialogue Actor component -- but since you don't want to do that, you can do it in code. Add a script with an OnConversationStart(Transform) method to the Dialogue Manager. Use the StandardDialogueUI.OverrideActorPanel() method to set the no_portrait actor's panel number. Example:

Code: Select all

void OnConversationStart(Transform actor)
{
    var no_portrait_Actor = DialogueManager.masterDatabase.GetActor("no_portrait");
    DialogueManager.standardDialogueUI.OverrideActorPanel(no_portrait_Actor, SubtitlePanelNumber.Panel2);
}
hipsterdufus
Posts: 95
Joined: Thu Aug 12, 2021 6:39 pm

Re: Actor with no portrait

Post by hipsterdufus »

Thanks I was able to get that part of it working using those event hooks however I have a new issue that's probably related to the fix. Now I'm noticing some strange behavior when I have an NPC conversation node followed by a No Portrait node - the NPC subtitle stays enabled behind the No Portrait subtitle and both remain open when I go back to an NPC node. Do I need to do something similar and tie into a conversation event to close out the subtitle? Any ideas as far as what to look for to debug this? Thank you.
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: Actor with no portrait

Post by Tony Li »

Hi,

Do you want one subtitle panel to close when the other subtitle panel opens? If so, inspect their Standard UI Subtitle Panel components and set the Visibility dropdown to Until Superceded.
hipsterdufus
Posts: 95
Joined: Thu Aug 12, 2021 6:39 pm

Re: Actor with no portrait

Post by hipsterdufus »

Yes that works perfectly, thank you!
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: Actor with no portrait

Post by Tony Li »

Glad to help!
Post Reply