Top dawn template, how to make an attack

Hi everyone, I think the solution to this issue is easy, but I can’t figure out how. And so there is a ready-made Blueprint Top Dawn template in controller player, I want to make it so that my character stops in front of the actor (enemy) at a certain distance in order to make an attack in the future. All I can do is calculate the distance between controlled pawn/cursor and enemy, but I don’t know how to fit it into the existing code (Top Dawn) and am I doing it right at all?!

Hey there @FIReeeee46! I’d recommend breaking down the pieces and then adjusting them to your needs. Since the top down template already has movement handled, most of what you need to focus on is:

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

Getting the target with a trace:

Finding the closest navigable location to the enemy (though I’d use a for loop instead of a delay when checking but this is still a solid example)

Then finally calling the move to and attack when you are close enough. For the actual attacking portion, here’s a resource to help with that (though I’d recommend using the advanced input system like the template uses instead of direct calls):