Hello again!
I'm trying to use sequencer code to reference my speaker, and it looks like this:
The problem is, despite that my speaker exists as well as this field, I am receiving that this subject is null:
Am I doing this right? I will trace back over all my variables again in a little bit to make sure I didn't make any small mistakes, but I wanted to check with you to make sure this is even the correct format.
Thanks,
DC
Speaker Sequencer Command Returning Null
Re: Speaker Sequencer Command Returning Null
Hi,
Variable["ActorIndex"] is the Actor[] table index of the conversation's actor. If the conversation's conversant or another character is speaking a particular dialogue entry, Variable["ActorIndex"] won't match the speaker.
You can add a Lua Console component to your scene and press ~+L to open it when that dialogue entry is visible. Then enter:
to see its current value. You can also enter:
to see what the field's value is. The value should match the name of a GameObject in the scene.
BTW, to reference the speaker's GameObject, you can just do:
Or, since speaker is the default value for the second parameter, this is the same as:
If the speaker's actor name doesn't match the GameObject name, add a Dialogue Actor component to the GameObject and select the actor it's associated with.
If you don't want to use a Lua Console component, you can enter those Lua expressions into the bottom bar of the Dialogue Editor's Watches page.
Variable["ActorIndex"] is the Actor[] table index of the conversation's actor. If the conversation's conversant or another character is speaking a particular dialogue entry, Variable["ActorIndex"] won't match the speaker.
You can add a Lua Console component to your scene and press ~+L to open it when that dialogue entry is visible. Then enter:
Code: Select all
return Variable["ActorIndex"]
Code: Select all
return Actor[Variable["ActorIndex"]].CurrentVNLocation
BTW, to reference the speaker's GameObject, you can just do:
Code: Select all
AnimatorPlay(Talk, speaker)
Code: Select all
AnimatorPlay(Talk)
If you don't want to use a Lua Console component, you can enter those Lua expressions into the bottom bar of the Dialogue Editor's Watches page.
Re: Speaker Sequencer Command Returning Null
Ok that is all very helpful! I will certainly be using the Lua console in the future!
So there is no way to access the current speaker actor fields directly from the lua code? The way I have my system set up, this would be very helpful to me, but if I need to find a work around, that is no problem!
Thanks,
-DC
So there is no way to access the current speaker actor fields directly from the lua code? The way I have my system set up, this would be very helpful to me, but if I need to find a work around, that is no problem!
Thanks,
-DC
Re: Speaker Sequencer Command Returning Null
That's correct. Of course, if you know the speaker ahead of time, you can always include the speaker's actor name explicitly:
Code: Select all
AnimatorPlay(Talk, [lua(Actor["Bob"].CurrentVNLocation)])
Re: Speaker Sequencer Command Returning Null
Understandable!
I will look into a work around tomorrow!
As always, thanks for the quick responses
-DC
I will look into a work around tomorrow!
As always, thanks for the quick responses
-DC
Re: Speaker Sequencer Command Returning Null
Glad to help. You could always write a custom sequencer command. In your custom sequencer command, you can get the current speaker's actor name like this:
Then you can get that actor's field(s):
Code: Select all
string speakerActorName = DialogueManager.currentConversationState.subtitle.speakerInfo.nameInDatabase;
Code: Select all
string currentVNLocation = DialogueLua.GetActorField(speakerActorName, "CurrentVNLocation");