Page 1 of 1

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

Posted: Mon Apr 04, 2022 12:01 pm
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?

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

Posted: Mon Apr 04, 2022 2:51 pm
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.

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

Posted: Mon Apr 04, 2022 4:11 pm
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.

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

Posted: Mon Apr 04, 2022 4:35 pm
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].

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

Posted: Wed Apr 06, 2022 4:48 pm
by RetroVertigo
That was what I was looking for! Thank you! Didn't know it was that easy.

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

Posted: Wed Apr 06, 2022 5:07 pm
by Tony Li
Glad to help!