Changing Display Name runtime doesn't work with NPCs

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Taank
Posts: 5
Joined: Tue Sep 15, 2020 12:32 pm

Changing Display Name runtime doesn't work with NPCs

Post by Taank »

Hi there,
I've been working with display name the whole project cause its easier to change the the texts without destroying any logic.
My protagonist is named "???" at the beginning until a certain dialogue appears. After that the actor is called "Reid". That works just fine.
But I have a NPC thats also called "???" at the beginning until he introduces himself.

Code: Select all

Actor["Desmond"].Display_Name = "Desmond"
This is what I have inside the Script part of that dialogue. I have also Assigned myself as the Actor and Desmond as the Conversant. Both have Actor scripts. But it does not change Desmonds name to "Desmond". It stays "???"

Am I missing something?

Best,
Taank
User avatar
Tony Li
Posts: 22148
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing Display Name runtime doesn't work with NPCs

Post by Tony Li »

Hi,

Display Names are cached at the start of the conversation. To update the cache in the middle of the conversation so they’re reflected right away in the dialogue UI, use the Lua function provided in the Discover Name example on the Dialogue System Extras page.
Taank
Posts: 5
Joined: Tue Sep 15, 2020 12:32 pm

Re: Changing Display Name runtime doesn't work with NPCs

Post by Taank »

Hi Tony,

thanks for your response. It's not about changing it in the middle. But thats nice to know it works :D I somehow thought it would be cached somewhere but didnt bother with it.

I have one conversation where Reid gets her name and where Desmond gets his name. Reid keeps her name after the conversation. Desmonds name never changes in any other conversations.
User avatar
Tony Li
Posts: 22148
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing Display Name runtime doesn't work with NPCs

Post by Tony Li »

Hi,

When Actor["Desmond"].Display_Name = "Desmond" runs, are there any errors or warnings in the Console window?

On the Watches tab, please add a watch on the Lua expression: Actor["Desmond"].Display_Name
Does it change to the correct display name?

If not, maybe a different GameObject than you expect is being used for Desmond. See: Character GameObject Assignments.
Post Reply