Get A Variable From Actor

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Littlenorwegians
Posts: 40
Joined: Sun Aug 04, 2024 3:06 pm

Get A Variable From Actor

Post by Littlenorwegians »

I have a setup with FMOD where when a letter appears in the dialogue, a short sound byte is played. Simple stuff to mimic speech. Here's the kicker,

I need some kind of system to basically detect the current speaker (The actor) and set an FMOD variable. Don't worry about the FMOD side of thing, that I can handle. I have ended up using the Text Animator

So, basically it's just kind of finding an EASY way to have a float variable (The pitch) associated with each invididual actor and have some way of another script to "get" that variable off the actor.
User avatar
Tony Li
Posts: 23393
Joined: Thu Jul 18, 2013 1:27 pm

Re: Get A Variable From Actor

Post by Tony Li »

Hi,

Add a script with an OnConversationLine(Subtitle) method to a GameObject in the Dialogue Manager's hierarchy. In it, you can check the speaker. Example:

Code: Select all

void OnConversationLine(Subtitle subtitle)
{
    Actor actor = DialogueManager.masterDatabase.GetActor(subtitle.speakerInfo.id);
    float fmodVariable = actor.LookupFloat("FMODVariable");
}
User avatar
Littlenorwegians
Posts: 40
Joined: Sun Aug 04, 2024 3:06 pm

Re: Get A Variable From Actor

Post by Littlenorwegians »

Perfect. That got exactly what I wanted.
Post Reply