Forum rules - please read before posting.

Trigger additional idle anims after random set period

I'd like for my character to do some additional anims (like looking bored) when they've been in idle for a long period. I'm using Sprites Unity Complex and I've made the default Idle animation to be very long, which then transitions into the new anims. I would like to randomise this wait time though so it feels more dynamic.

Using a parameter within the anim controller can achieve this, but I'm not sure how and where to setup a random timer and variable that will trigger this parameter. Any help is appreciated!

Comments

  • edited July 2024

    A short custom script could handle this, but you can also make use of this custom Action on the AC wiki to wait a random amount of time:

    https://adventure-creator.fandom.com/wiki/Wait_a_random_time_within_an_specified_time_range_(Action)

    An ActionList that runs in the background could wait a random time, then update a parameter in your Player's Animator to trigger the idle anims.

    The easiest way to automate this is to run these from an ActionList Asset, and then use the Events Editor to trigger this asset from the "Scene/Change/After" event.

  • Is the wait_a_random_time custom action in the wiki the same as the built-in action Engine>Wait Random?

    Because the extra idle anim should only run after the player has been in regular idle continously for a certain time, what's a good way to reset that timer?

    Example:
    Goal: Play extra idle anim at some random time after 60s of regular idle.
    If char is in idle for 50s and then does something else, timer is reset back to zero.

  • Is the wait_a_random_time custom action in the wiki the same as the built-in action Engine>Wait Random?

    There's no such built-in Action - the wiki Action is "Engine: Wait random".

    Because the extra idle anim should only run after the player has been in regular idle continously for a certain time, what's a good way to reset that timer?

    Gotcha.

    You could do this with an Animaton Event at the start of your Idle animation, set to trigger a function that in turn runs the ActionList, i.e.:

    AC.ActionListAsset actionList;
    public void StartRandomWait ()
    {
        actionList.Interact ();
    }
    
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.