Forum rules - please read before posting.

Expression function before dialogue to make player animate whilst speaking

Is it possible to have a syntax function similar to [expression:Name] that animates portrait lipsync, to animate the player whilst speaking dialogue from a chosen animation? So it would have to come before the dialogue rather than after as the [expression:Name] one is. so something like [animate:Name] dialogue"


  • Portrait graphics can be set to animate based on lip-syncing automatically - see this tutorial.

    Custom tokens within speech text is also possible - see the Manual's "Speech event tokens" chapter.

  • Hi Chris, so we are attempting to get an expression to animate the player whilst dialogue happens. And have adapted this code from the ACSpineExpressions script to support the tokens:

     DirectionMapper directionMapper = speakingCharacter.GetComponent<DirectionMapper>();
              directionMapper.skeletonAnimation.AnimationState.SetAnimation(99, animationName, true);

    However, my player is doing crazy twists on the animation, plus they loop. I think this is due to the because engine keeps playing the other animations every frame.
    Tried PlayClip but doesn't work.

    Can you help? Here is link to video and full script:

  • I think this is due to the because engine keeps playing the other animations every frame.

    That's what your code is set up to do - your Update function is playing a new animation every frame.

  • Ah ok so how best to change that? So it will work? I can pass on the info to the person helping me with the script. Thanks

  • edited February 6

    Hey, friend dev here.

    I'm using Spine for almost 5 years. I know what's happening, but don't know how to solve it.

    I want to play a spine animation from code and the AC engine is blending/replacing animations. If I use track 0, the engine replaces it with one of the 'idle,walk' animations. If I use a higher track, I get blending, even though I try to disable it.

    This is how is supposed to look:

    This is in game:

    This is the spine window, idle on track 0 and animation on track 1

    What is the right function call to play spine animations programatically? (One that is supported by AC engine, of course)

  • If you're using the Spine Integration on the AC wiki, then it behaves similar to AC's "Sprites Unity" animation mode in that it plays idle/walk etc animations automatically.

    When using its Character: Animate Action, AC understands that this is a custom animation and so will prevent the "standard" animations from playing during this time.

    If you want to play a full-body custom animation through script, you'll need to tell AC that the character is in a "custom" state - which will have it bypass the regular standard animation calls.

    This can be done by accessing the NPC/Player script's charState variable:

    gameObject.GetComponent<AC.Char> ().charState = AC.CharState.Custom;

    And back again once the animation is complete:

    gameObject.GetComponent<AC.Char> ().charState = AC.CharState.Idle;
  • Worked great, 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.