Setting Dialogue Panels Per Character

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
ko_games
Posts: 29
Joined: Wed Jan 08, 2020 3:20 am

Setting Dialogue Panels Per Character

Post by ko_games »

I have created a separate dialogue panel for each NPC to make things a little simpler for portrait placements (since the character portraits are not all the same size and I wanted to position a few portraits differently than others when appearing).

Is there an easy way to assign a panel to a character in the database? That way I don't need to add code to the dialogue text to set the panel. I know you can use the Dialogue Actor component to set panels too, but this causes a few other issues in my game as noted below.

In my game, I make dialogue appear by using a dialogue system trigger using the OnUse trigger. In a scene, I might have several Dialogue System Triggers for the same character. Each Dialogue System Trigger will play a specific dialogue conversation. I use the OnConversationStart and End events on each of these dialogue system triggers to do various things in the scene.

The problem I have when adding a dialogue actor component to each dialogue system trigger is that there could be say 3 different dialogue system triggers each with the same dialogue actor component (with the same character selected).
This seems to cause bugs with the OnCovnersationStart and End events. They don't seem to be getting called consistently due to multiple gameobjects with the same character assigned.

It is my understanding, that this is because any gameobject with the dialogue actor component with the actor that is currently speaking will try to call the OnCovnersationStart and End unity events.

The simple solution I came up with was to not add the dialogue actor component to dialogue triggers. Instead, I just drag in the dialogue system trigger itself into the conversation Actor spot on the start conversation dialogue system trigger.

This all seems to work well. The OnConversationStart and end seem to be called consistently on each gameobject in the scene. The issue now is that I can't assign the dialogue panel for that character speaking.

What do you think? Is there something I missing above that is overcomplicating things? Or is there a simple way to assign a character to a specific panel in the dialogue database, so no need to assign the panel for the character in scenes?
User avatar
Tony Li
Posts: 21684
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting Dialogue Panels Per Character

Post by Tony Li »

Hi,

Use only one Dialogue Actor component per character. If your character is represented by a GameObject, add the Dialogue Actor to that. Otherwise create an empty GameObject for the character. Set the Actor dropdown and the panel number.

Then, in your Dialogue System Trigger, you can either assign this GameObject to the Conversation Conversant field, or leave the Conversation Conversant field unassigned and it will find the Dialogue Actor automatically and use the specified panel.
Post Reply