Replace character name

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
DragoonHP
Posts: 62
Joined: Tue Jan 15, 2019 8:17 am

Replace character name

Post by DragoonHP »

In the same vein as the subtitle replace question, is there any easy way of replacing a speaking character name?
Based on past choices, a character can name either be visible or be just ??? and I'm not sure how to go about doing that

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

Re: Replace character name

Post by Tony Li »

Hi,

In the Dialogue Editor, inspect the actor. Tick Use Display Name. Set Display Name to "???".

When the player learns the character's name, use the Script field to set the actor's Display Name:

Actor["Name"].Display_Name = "Discovered Name"

The Dialogue System Extras page has an example: Discover Name Example. It adds a Lua function that sets the new display name and updates the UI immediately.
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: Replace character name

Post by AoF »

I tried to do this a little differently and it didn't work. I set my actor's name to "Eva" because I want to be able to start any conversation and have her named correctly. Then in the intro conversation before you know her, I had a script on the first node that says:

Code: Select all

Actor["Eva"].Display_Name = "???"
The last line of that conversation has a script that says:

Code: Select all

Actor["Eva"].Display_Name = "Eva"
But these scripts don't seem to be having any effect that I can see. Her name remains "Eva" throughout the conversation:

Image

Here's how I configured the actor:

Image

Here's how I configured the node:

Image

I am using a Dialogue Actor script and a modified version of the VN Dialogue UI, I don't know if that interferes with this.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Replace character name

Post by Tony Li »

Are you by any chance using Dialogue System version 2.0.8? There was a bug in 2.0.8 with Display Name.

If not, then temporarily set the Dialogue Manager's Debug Level to Info. This will log when a Script field is run. Make sure that the Script fields on those nodes are actually being run.
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: Replace character name

Post by AoF »

Tony Li wrote: Sun May 26, 2019 7:07 pm Are you by any chance using Dialogue System version 2.0.8? There was a bug in 2.0.8 with Display Name.
I don't think so, but I don't know how to check for sure. I bought it May 12th and that version number sounds like it's from a very long time ago.
If not, then temporarily set the Dialogue Manager's Debug Level to Info. This will log when a Script field is run. Make sure that the Script fields on those nodes are actually being run.
It seems like it's being run here:

Image

I asked this in another thread, but is it normal to have duplicates in there like I seem to have? Let me know if there's something more I can show you to help.

BTW, the parts I've blacked out are naughty words, I'm not sure if you care, but I'm trying to keep the forum SFW.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Replace character name

Post by Tony Li »

Thanks for redacting the naughty words. I personally don't mind, but it's probably better to omit them from a public forum.

For efficiency, when the conversation starts it caches the characters' names. If you were to stop and restart the conversation after setting the Display Name field in Lua, the cache would be updated so it would show the correct name.

The Dialogue System Extras page has a small script that adds a Lua function that sets Display Name and also updates the cache. Here's a direct download: Discover Name Example.


BTW, disregard the version 2.0.8 question. I forgot who I was replying to. Version 2.0.8 came out last October. If you ever need to check your current version number, you can view Plugins / Pixel Crushers / Dialogue System / _README.txt or menu item Tools > Pixel Crushers > Dialogue System > Welcome Window.

There's a reason why sequencer commands show twice in the Console window when you set Debug Level to Info. The first line shows the command as the sequencer's parser understands it. This appears as soon as the dialogue entry node's Sequence is sent to the sequencer. The second line shows the command at the time it's run, with special keywords such as 'speaker' replaced by their actual values.
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: Replace character name

Post by AoF »

That script worked for me.

Is there a way to make this also apply to the "Usable (script)"?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Replace character name

Post by Tony Li »

That would be a good idea. I'll update the Usable script to check if the GameObject has a Dialogue Actor component. If the Usable script's Override Name is blank, it will use the display name of the Dialogue Actor's actor if possible. Otherwise it will use the GameObject name.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Replace character name

Post by Tony Li »

It's a one line change. Here's a patch: DS_UsablePatch_2019-08-08.unitypackage
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: Replace character name

Post by AoF »

Great, thanks!
Post Reply