I’m wondering how to go about having the protagonist of my game have multiple idles at random intervals when there is no player input to move.
I have my Idle/Run Set up in the Animation state Machine (Removed Jump as it’s a grounded character), but I’m not sure how to go about having multiple idles or how to get them to cycle randomly. (I’m a Complete Beginner so if possible a dumb-bed down answer would be perfect!).
It depends if you just would some adaptive animation to a part of your body (via some slots and layered blend per bone) or if you would play complete anims for the hole body random.
This is an easy (but by far not the only) way to do something like this. It ping pongs between a main idle anim, 2 anim loops and a further anim that plays only some short time and switches back afterwards … or switches always back to the blendspace if there is some movement (speed). Based on a third person anim blueprint:
What do you put in the return from idle nonlooping to idle/run? and the others? Sorry if it seems like a stupid question but I am new to Unreal Engine.
Just whatever condition should change the state. In this simple case of example it would be if IdleRandomizer == 0 (it’s what you can see on the right side). As you can see in the EventGraph this variable is set to 0 in case if Speed > 0 or if the delay from the non-looping anim passed. You could even enhance this with some other checks in the EventGraph (e.g. if isInAir is still set or something similar).
“Random Float in Range” is not replicated here I guess so variable is most likely random on client/server. Some animations like “blink” would not be worth to replicate. Others like “start interaction” must be checked by server first and most likely are starting somewhere in the character/controller logic so it’s already replicated from there. You can of course even add a controller-idependent server/multicast event in the AnimBP. It does not really differ to other BPs regarding that. CustomEvent → Replicate set to Server which does the “delay” or “set” of the variable stuff and then finally calling a CustomEvent → Replicate set to Multicast which finally does the job (if it’s not replicated somehow else already previously).