Anyway to reference actors stored name without using var=Actor or var=Conversant?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
RetroVertigo
Posts: 55
Joined: Fri Apr 16, 2021 4:32 pm

Anyway to reference actors stored name without using var=Actor or var=Conversant?

Post by RetroVertigo »

I am running into some problems creating cutscene and wanting to reference my actors names. The names can be changed, so I need to reference the variable for the Actor name, but I have scenarios where I have to reference more than 2 characters names, etc.
So I wanted to ask, is there anyway I can reference the Actors variable name or something to pull them up in the convo? i.e. [var=Knight] or something like that?
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Anyway to reference actors stored name without using var=Actor or var=Conversant?

Post by Tony Li »

Hi,

It might need a tiny bit of scripting. If you know the actor's Name field, you can get the current Display Name or localized Display Name in C# with:

Code: Select all

string displayName = DialogueLua.GetLocalizedActorField("Knight", "Display Name").asString;
If the characters in the cutscene are interchangeable, and not just their names, let me know. You might need a little more code to get the GameObject (character) currently associated with a given Timeline track.
RetroVertigo
Posts: 55
Joined: Fri Apr 16, 2021 4:32 pm

Re: Anyway to reference actors stored name without using var=Actor or var=Conversant?

Post by RetroVertigo »

Thanks Tony
Is this something I can put directly in the dialog to pull the name, or do I need to setup a script that would act like a word bank or something? Just trying to figure out how in my dialog I can put something like [var=Conversant] to pull the corresponding Actor name. I am good with further coding, just not sure how to go about grabbing it etc.
Also, not sure what you mean by the characters being interchangeable. My cutsceneEntities are the same prefab that I duplicate depending on the cutscene. I just update the name, sprite, etc. and use that same prefab for all my actors.
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Anyway to reference actors stored name without using var=Actor or var=Conversant?

Post by Tony Li »

Hi,

If you know you want to reference the Knight's current Display Name, you can use this:

[lua(Actor["Knight"].Display_Name)]

Of course, if the Knight is the primary conversation actor or conversant, it's shorter to use [var=Actor] or [var=Conversant].
RetroVertigo
Posts: 55
Joined: Fri Apr 16, 2021 4:32 pm

Re: Anyway to reference actors stored name without using var=Actor or var=Conversant?

Post by RetroVertigo »

That was what I was looking for! Thank you! Didn't know it was that easy.
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Anyway to reference actors stored name without using var=Actor or var=Conversant?

Post by Tony Li »

Glad to help!
Post Reply