Add multiple animations to AI

Hello.I need some help please where I can add some animations to my AI (I can still be considered as “new” to Unreal Engine, I just started some weeks ago, anyway).
So I have an AI that is patroling the area , stops for a few seconds, and after that he continues to walk and stops again and so on. When he sees the player, he comes at him and if the AI touches the player, game over.
Now, I want to add a skeletal mesh and some animations to this AI. There will be 5 animations:

  1. When he is roaming the area, there is a walk animation
  2. When he stops for some seconds, a “look around” animation
  3. When he sees the player, a “prepare” animation (an example is like when a bull is moving his back feet before charging)
  4. After that, there is the run animation
  5. And if he reaches the player and is near him, an attack animation (just a simple one, like a punch)

I added the skeletal mesh to the AI, I imported the animations with that skeletal mesh, so all good up to this point. But the next thing is that I have to add those animations so please, If you could tell me how can it be done, I appreciate it:)

Thank you and take care!

Seeing as this is AI, I pray you’ve implemented this in a Behavior Tree.
If you have, it’s as easy as adding some play animation nodes- the logic won’t continue until your provided animation has finished or gets aborted.

Here’s a brief overview on the node itself by the ever so helpful Mathew Wadstein:




If you haven’t implemented it in behavior trees, here’s a tutorial by Unreal I highly recommend as an introduction:

1 Like

Hi rokenrock.
First of all, thank you for taking your time to answer.

Second, if I don’t implemented the behavior tree, I have to make one right?:slight_smile:

And third, just to learn and know, the behavior tree is the only way that a person can make the AI to have those animations, even if that person is a beginner or a professional?

Thank you again!

Hey there

Behavior trees aren’t the only way to make an AI at all, but that’s the most efficient way to do it and I suggest you at least try if you want to make AIs for your games. Once you get how BT works it’s simple for the most part.

About animations, you have different ways to implement them. It depends on how you’re making your AI and what are the animations for.

If you are scripting all AI logic in Blueprint you can create montages of your animations and play them. You have by default Play Anim Montage for characters and Play Montage for Skeletal Meshes.
You can also use Animation Blueprints, which is better for behaviors and reactions. You can control animation blending by Skeleton parts and/or by intensity.

1 Like

Hello GRIM_Warlock
Thank you for taking your time to answer:)

I understand what you told me and I am going to try these steps.
One thing that I forgot to mention: If my project is made from scratch, so Blank,
And I want my game to be in First-Person and I want to see the AI roaming around and coming towards me, should I migrate the default manequin from a Third Person project and put animations on it?
Or is it enough if I have the skeletal mesh that I want, plus the animations and I just have to put them on the AI?

Thank you!