Dynamic Actor/Conversant Name

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
fr4231
Posts: 20
Joined: Sun Nov 28, 2021 9:44 am

Dynamic Actor/Conversant Name

Post by fr4231 »

Hi,
I would like to change the displayed names of my actors and conversants in specific dialogues, but can't really find a way to do it properly.

To make it easier to understand, in the dialogue database I have a few actors.
Let's say Actor A and Actor B.

In general I would like to display their names in most of the dialogues as set in the database (A and B), but in certain exceptional dialogues I want use these same actors and only change their displayed names during the dialoguess to something else (A and B for example).

What would be a good way to do that?
Thanks!
fr4231
Posts: 20
Joined: Sun Nov 28, 2021 9:44 am

Re: Dynamic Actor/Conversant Name

Post by fr4231 »

Simply adding this script to a node didn't seem to solve the situation.

Actor["Player_X"].Name = "My Custom Name";
fr4231
Posts: 20
Joined: Sun Nov 28, 2021 9:44 am

Re: Dynamic Actor/Conversant Name

Post by fr4231 »

Actor["Player_X"].Display_Name = "My Custom Name"

was the other thing I've tried (most likely much closer to what I want to do), and actually it seems both are working, but not initially.
If you trigger the conversation the second time it works, but in my case that's not really ideal.
Is there any way to display the set name in the first conversation as well correctly?

I set the script on the start node, but still no luck.
fr4231
Posts: 20
Joined: Sun Nov 28, 2021 9:44 am

Re: Dynamic Actor/Conversant Name

Post by fr4231 »

Got it, must set it from the dialogue trigger before starting the conversation and not from the dialogue editor through a sequence.
Now it seems to be working fine.
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dynamic Actor/Conversant Name

Post by Tony Li »

Sounds good. Yes, conversations identify the primary actor & conversant GameObjects when the conversation starts, so they should be set in the Dialogue System Trigger.
fr4231
Posts: 20
Joined: Sun Nov 28, 2021 9:44 am

Re: Dynamic Actor/Conversant Name

Post by fr4231 »

Thanks!
One more extra question.
Is it possible to set the name with this approach to variable and assign it from a script (for example in case of randomly generated names)?

Thanks!
User avatar
Tony Li
Posts: 22131
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dynamic Actor/Conversant Name

Post by Tony Li »

Yes. Use DialogueLua.SetActorField():

Code: Select all

DialogueLua.SetActorField("NPC1", "Display Name", "Fred");
Post Reply