Forum rules - please read before posting.

Wait speech token turns off isTalking bool?

Since voice has been added to my game, I've noticed that the [wait:x] speech token turns off the isTalking bool in an NPCs animator. I understand that this is intended behaviour, but for the look of our game, I'd really like to turn it off, so that while speech scrolling pauses due to the wait, the talking animation continues. Our characters all have generic talking animations and expressions, and we use the wait tokens to time the scrolling of the speech text to roughly sync with the voice sample, but we want the characters to maintain the same expressions through the wait rather than return to their face idle animation.

I don't think this is available in the settings of AC, is their any way to rig up my game like this?

Cheers for your help,

Martyn

Comments

  • edited February 2021

    If you clear the "IsTalking" parameter from a character's Inspector, it's value in the Animator will no longer be set automatically - allowing you to set it manually through script.

    Try this. It'll set the parameter for all characters when they start/stop speaking complete lines - not during [wait] tokens.

    using UnityEngine;
    using AC;
    
    public class CustomTalking : MonoBehaviour
    {
    
        public string talkBool = "IsTalking";
    
        private void OnEnable ()
        {
            EventManager.OnStartSpeech += OnStartSpeech;
            EventManager.OnStopSpeech += OnStopSpeech;
        }
    
        private void OnDisable ()
        {
            EventManager.OnStartSpeech -= OnStartSpeech;
            EventManager.OnStopSpeech -= OnStopSpeech;
        }
    
        private void OnStartSpeech (Char speakingCharacter, string speechText, int lineID)
        {
            speakingCharacter.GetAnimator ().SetBool (talkBool, true);
        }
    
        private void OnStopSpeech (Char speakingCharacter)
        {
            speakingCharacter.GetAnimator ().SetBool (talkBool, false);
        }
    
    }
    
  • I'm testing this right now, and while this script does remove the issues I was having with waits (and that's great! Exactly what we wanted) It has some quite serious side effects - this script seems to be interfering with expressions - when the script is on persistent engine and the character's IsTalking inspector is empty, [expression:None] no longer works, and expressions seem to trigger one dialogue box "late", so a character does a shocked face a line later than they should for example, and expressions don't reset at the end of a line, even though they are set to. Removing the CustomTalking script and restoring the IsTalking bool in the NPC script resets all these behaviours to their previous (working) state.

    Is it possible that by circumventing ACs control of the wait token, we're also skipping a bunch of code that controls expressions? If so, is their a way around this, or perhaps I just implemented it wrong... Any help gratefully received, as we're getting sooo close to this working exactly as we envisioned.

    -M-

  • edited February 2021

    You'll need to provide details on how to recreate the original issue, in that case. Screenshots of everything: Speech, Settings Managers, a character's Inspector, Animator and relevant transitions, a sample speech line, and what occurs vs what's expected.

    Even better would be a PM with a link to a unitypackage of the relevant files.

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.