Page 1 of 1

Replace character name

Posted: Tue Apr 09, 2019 3:40 pm
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.

Re: Replace character name

Posted: Tue Apr 09, 2019 4:07 pm
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.

Re: Replace character name

Posted: Sun May 26, 2019 6:30 pm
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.

Re: Replace character name

Posted: Sun May 26, 2019 7:07 pm
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.

Re: Replace character name

Posted: Mon May 27, 2019 12:15 am
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.

Re: Replace character name

Posted: Mon May 27, 2019 8:28 am
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.

Re: Replace character name

Posted: Thu Aug 08, 2019 10:49 pm
by AoF
That script worked for me.

Is there a way to make this also apply to the "Usable (script)"?

Re: Replace character name

Posted: Thu Aug 08, 2019 10:56 pm
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.

Re: Replace character name

Posted: Thu Aug 08, 2019 11:02 pm
by Tony Li
It's a one line change. Here's a patch: DS_UsablePatch_2019-08-08.unitypackage

Re: Replace character name

Posted: Fri Aug 09, 2019 1:33 am
by AoF
Great, thanks!