Page 1 of 1

Change NPC Name During Dialogue

Posted: Thu Apr 21, 2022 6:09 pm
by WizardMonke
Hello!

I'm new to the dialogue system and I was wondering if there was a way to change the name of an NPC that the player is talking to after they engage in dialogue? For example, the player may walk up to someone named "Stranger", and then in the dialogue, the NPC introduces themselves, and so now the player can see their name when looking at them.

Any help is appreciated. Thank you!

Re: Change NPC Name During Dialogue

Posted: Thu Apr 21, 2022 9:17 pm
by Tony Li
Hi,

Please see the "Discover Name" example package (direct download) on the Dialogue System Extras page.

Re: Change NPC Name During Dialogue

Posted: Tue Apr 26, 2022 1:08 pm
by WizardMonke
This is exactly what I was looking for. Thank you!

Re: Change NPC Name During Dialogue

Posted: Tue Apr 26, 2022 1:33 pm
by Tony Li
Glad to help!

Re: Change NPC Name During Dialogue

Posted: Fri Nov 24, 2023 1:37 am
by suisei
How can I localize this new Display Name?

Re: Change NPC Name During Dialogue

Posted: Fri Nov 24, 2023 11:01 am
by Tony Li
Hi,

Set the field "Display Name LN" where LN is the language, such as "Display Name zh" for Chinese, "Display Name es" for Spanish, etc.

Re: Change NPC Name During Dialogue

Posted: Fri Nov 24, 2023 4:03 pm
by suisei
Sorry Tony, I should give more details for the question.

I'm asking about localizing new display name, changed in lua function:

Code: Select all

ChangeActorName("Mephistopheles", "Mephistopheles")
Display Name localization can only localize "Stranger", but not "Mephistopheles".

Obviously this new name is not going through localization system... What is the best way to properly localize it?

Re: Change NPC Name During Dialogue

Posted: Fri Nov 24, 2023 4:15 pm
by Tony Li
Hi,

You will need to set it for each language in this case, such as:

Code: Select all

Actor["Captain"].Display_Name_es = "El capitán";
Actor["Captain"].Display_Name_zh = "船長";
ChangeActorName("Captain", "The Captain")
Use the ChangeActorName() function last, since it also updates the active conversation's UI.