[AI] Best way to detect an animation completion

Hey there!

I’m trying to add a simple melee attack inside my behavior tree but instead of adding a simple “play animation” node, I want a few more control, so I created a custom task, the problem is that I’m sending a function call to the BP to start the attack animation (montage animation) but if I add a success node it continue with the next task not displaying the full animation.

I created this task that works just fine but I feel that is not the best solution and want to know your thoughts or a cleaner way to do it.

Thanks!

Update: Found this related question [https://answers.unrealengine.com/questions/464622/ai-best-way-to-detect-an-animation-completion.html#comment-464622-form][2]

What I would do is add a anim notify on the end of the animation and then when it fires use “try to get pawn owner” and cast/message via interface it to your ai character this can be done in the animation BP.

Note I am not very good with animations.

-Erik

Thanks for the answer, my main concern is about how and when to call the task success so the behavior three can continue allowing the full animation to play.
Found another related question that helps me:
[https://answers.unrealengine.com/questions/24707/play-montage-bp-from-behavior-tree-when-return-suc.html][1]

So the current state is this one: