Playing an animation through a Behavior Tree/BTTask

Hi,
I’m trying to create a basic monster AI which would start chasing the player when in line of sight and attack once it reaches the player.
I have followed the Behavior Tree Quick Start Guide and got the chasing working nicely. I have a custom character (one of the Mixamo pack) following me when in line of sight and it all works well.
Now I am attempting a play an animation on this character after he reaches the player (A Swing animation that the mixamo character has), but it simply doesnt play the animation and I’m unable to figure out how to get it to work.

In the RapidMoveTo task ( As seen in Step 10 https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/10/index.html) , I added a reference to the AI Character (named Imp Character) and I called a play animation on it after it reaches the player. (image attached). But this animation simply doesnt play, I even tried creating an Anim Montage and playing it, but that doesnt work either.

https://docs.unrealengine.com/latest/images/Engine/AI/BehaviorTrees/QuickStart/12/fullTree.jpg

I would ideally create an “Attack” task and have it run through the BT, but I’m just trying to test it before I extend it as its own BTTask.

I am able to call an animation on the character through the character’s Event Graph, but I’d like to be able to have this work through BTs.

I apologize if this is a very basic thing, but after several hours of searching the wiki, I’m yet to get a simple “Play animation” to work through a Behavior Tree/BTTask. Any help would be greatly appreciated, thanks!

Have you tried debugging your blueprint task? How/where do you set your Imp Character in the blueprint?

–mieszko

@Mieszko : Thanks for taking out your time! :slight_smile: Yes,I have checked the debugger in the blueprint task (RapidMoveTo) on the ImpAIController, it does trigger the animation,but doesnt really play it ingame.
Here is a screen showing the Imp Character setup as a variable in the blueprint task :

Also, as I mentioned earlier, I have no problem calling the animation directly from the Imp Character blueprint (seen below)

When debugging blueprints you can put breakpoints on nodes and mouse over variables to read their current value. I bet that if you put a breakpoint on the PlayAnimation node the value of ImpCharacter would be ‘None’. You need to set it, at runtime, to your AIController's Pawn (with possible casting here and there).

@Mieszko : That was it, works perfectly now! thank you very much :slight_smile:
My anim graph after the fix :

Now I can continue exploring the possibility of making the Attack as its own BTTask!

Hey, what is your AI con reference that you have connected to the target of the controlled pawn, I am trying to do something similar to yourself?