Forum rules - please read before posting.

How do I play talking animations using fmod integration for dialog?

edited November 10 in Technical Q&A

Hello,
in our project we are using fmod for the audio and have been struggling a bit with the Dialog implementation.

The goal:
We want to use the Dialog, play Speech action like we did without the fmod dialog but the audio should be played over an event event.

The current setup:
1. We have unity audio disabled

2. Starting the Dialog
We are using the OnSpeechStarted(Speech) delelate to handle the fmod stuff. the Callback handles the fmod specifc stuff and gets the correct voiceline over the key.

void OnEnable()
{
EventManager.OnStartSpeech_Alt += StartSpeech;
}

void OnDisable()
{
EventManager.OnStartSpeech_Alt -= StartSpeech;
}

void StartSpeech(Speech speech)
{
    _acSpeech = speech;
    HandleFmodEventInstance(speech.speaker, speech.LineID);
}

private void HandleFmodEventInstance(AC.Char character, int lineID)
{
    _key = string.Concat(character.name, lineID.ToString());

    EventInstance eventInstance = RuntimeManager.CreateInstance(_speech);

    eventInstance.setCallback(_speechCallback);

    eventInstance.start();
    eventInstance.release();
}

3. Display the AC Subtitles unitl the voiceline is over
We want fmod to give the signla to end the dialog so we put the display time factor to a higher number

4. Ending the Dialog
We are also using the callback to get the info from fmod when the voiceline is done. This is used to end the Ac Dialog
case FMOD.Studio.EVENT_CALLBACK_TYPE.DESTROY_PROGRAMMER_SOUND:
{
Debug.Log("destroy programer sound");
CustomDialogueSpeech.instance._shouldEndSpeech = true;
break;
}

private void Update()
{
if (_shouldEndSpeech)
{
_shouldEndSpeech = false;
OnSpeechEnded();
}
}

public void OnSpeechEnded()
{
if (_acSpeech != null)
KickStarter.dialog.KillDialog(_acSpeech);
}

What works

  • plays the correct audio
  • displays the ac subtitles for the correct amount of time

What doesn't work

  • getting animations to play
  • currently IsTalking is set to true for a frame/ a few frames
  • seting the animator bool to true in update as long as the character is talking doesn't work

What we'd like to get help with

  • how do we set the IsTalking bool in the animator?
  • is there a better approach then the one we are currently trying?

Comments

  • Welcome to the community, @m0stlyvoid.

    I'm not familiar enough with FMOD scripting to comment on the implementation, but certainly the AC side of things - hooking into OnStartSpeech - looks good.

    So far as the talking animation goes: this may be down to the artificial lengthening of the speech duration, if I'm understanding you correctly.

    It's possible to force-set the character in "talk" mode using their ForceTalkingMode property. If you set this to true on your OnStartSpeech event, and then false in your OnSpeechEnded function, then their Animator parameter should be correctly set for the speech's duration.

  • @ChrisIceBox

    Thank you, this was exactly what I was looking for!
    The fmod specific stuff worked already and was mostly included for context.
    Huge help, thank you ^^

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.