How do you make a top down character attack on click?

So I have my Ai and my character, with a weapon, and now in order to make it playable I just need to be able to attack the Ai. However the tutorials I’ve looked up and seen are damaging with a projectile or bullets. How would I apply damage with a melee attack on click rather than pressing a button and having a collision. I don’t have enough knowledge with the program to understand how to do this and I can’t find any tutorials online either so it would be nice for those that could help.

Just Add a box collision to what ever you want to hit with, and have a attacking animation and check on overlap of the box attached to your fist or sword or axe or whatever your trying to use as a weapon.

when you click, you can check if you’re clicking on an enemy and if you are, do your attack animation and deal damage, etc.

Thank you so much for answering the question. I get what you are saying about the box collision and all, however how do I click the enemy and make the engine know I am clicking an enemy and not to just swing my sword randomly. As you may tell I have searched far and wide for a direct tutorial to find answers but haven’t found any. Any place you know where I can find a blueprint tutorial for this or explain precisely how to do this?

Take League of legends for example. How would replicate an auto attack like that?

well you would have to get your mouse for one clicking correctly in the world. Unfortanely the mouse to world space or whatever it is called does not get proper clicks and you have to do some math to get it right a search you should be able to find it. I would have to dig through my projects to find where I did it and what I did to get the proper click locations. And from there you would need to get a reference on what your clicking on so any attacks knows the location of their destination. Which the attack would be on a timed loop.

if you need help on setting up a loop on a bool I have a video I uploaded for someone here is my youtube link

Thank you so much for the tips. I know what I have to do to get all the components to work such as knowing where i am clicking and if it is an enemy, to actually go up and melee them. However i have no idea as how to do this. You said something about math and searching for the mouse locations? i don’t get how to do that. Thank you for the tutorial by the way.

I could probably make a tutorial for you but it might be a couple of days before I can get it done.

So I’ve done some more scavenging and haven’t really found anything. There are 20 views on this question already so a tutorial would probably help out more than just me.

Alright I will try to get it done as soon as I can.

Is it on youtube? If so I’ll make sure to subscribe so I can see it as soon as possible.

I’m going to have to make it. I hadn’t even started it cause you had said rather you wanted it or not, but it will be on the channel of the link I put in before I will also upload the link for the video in here once its done. But I definitely don’t have time to get to it today. I will see if I can get it made tomorrow

ok, I just got it made and am uploading now. Here is the link, it got split into two videos, because my computer crashed while recording.

Anyone viewing this page definitely should check out this you tube channel.