Override Names without Dialogue Actor Component

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
SystemId
Posts: 30
Joined: Thu Aug 08, 2019 1:31 pm

Override Names without Dialogue Actor Component

Post by SystemId »

I tried looking around, but only found a really Old Legacy component to Override an Actor's name. A little more reading, and I think this was replaced with the Dialogue Actor component.
What's the best way to Override an Actor's name, in a Dialogue Entry?

I know I can assign names to Variables.
like: [var=Name_Player]
to replace the Players name if I inserted this into the Display name.

Can I add a Sequence Command to straight up replace a name with a Variable?

Ideally I was looking for something like a Component I could tack onto my Game Object holding the Standard Bark UI that would just outright replace the name of whatever is Barking. I want to avoid using the Dialogue Actor component for doing this because those are being used for something else.
User avatar
Tony Li
Posts: 21980
Joined: Thu Jul 18, 2013 1:27 pm

Re: Override Names without Dialogue Actor Component

Post by Tony Li »

Hi,

There are a few ways you can do this. I'm not sure exactly what you need to do, so I'll outline some options.

- You could add a custom field to the actor, such as "Bark Name". So your actor might have these fields:
  • Name: "Herald"
  • Display Name: "Thomas the Herald"
  • Bark Name: "Yelling Man"
In regular conversations, this actor's portrait name will be "Thomas the Herald".

---

- If you want to use the actor's Bark Name in Dialogue Text, you can use the [lua(code)] markup tag. For example, assuming this actor is the conversation actor:
  • Dialogue Text: "[lua(Actor[Variable["ActorIndex"]].Bark_Name)]: Hear ye! Hear ye!"
The bark UI will show the text: "Yelling Man: Hear ye! Hear ye!"


If your bark UI is configured to show the barker's name in the Name Text UI element, you can change it by adding an OnBarkLine() method to the character or its child bark UI GameObject:

Code: Select all

void OnBarkLine(Subtitle subtitle)
{
    var actor = DialogueManager.masterDatabase.GetActor(subtitle.speakerInfo.id);
    subtitle.speakerInfo.Name = actor.LookupValue("Bark Name");
}
SystemId
Posts: 30
Joined: Thu Aug 08, 2019 1:31 pm

Re: Override Names without Dialogue Actor Component

Post by SystemId »

Thxs Tony .. it helped me think on what I wanted.to happen.

I got the name to swap out with an Actor Bark UI override. Would you know how I get the "Display Name" rather than the Actor name?

In the Override:


public string actor;


Actor dialogueActor = DialogueManager.masterDatabase.GetActor(actor);
nameText.text = dialogueActor.LocalizedName;
User avatar
Tony Li
Posts: 21980
Joined: Thu Jul 18, 2013 1:27 pm

Re: Override Names without Dialogue Actor Component

Post by Tony Li »

To the localized display name (example):

Code: Select all

string actor = "Herald";
string localizedDisplayName = DialogueLua.GetLocalizedActorField(actor, "Display Name");
Post Reply