Page 1 of 1

Changing Display Name runtime doesn't work with NPCs

Posted: Tue May 31, 2022 5:18 am
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

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

Posted: Tue May 31, 2022 9:04 am
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.

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

Posted: Tue May 31, 2022 9:13 am
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.

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

Posted: Tue May 31, 2022 9:52 am
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.