Attacking Multiple Overlapping actors (melee attack setup)

Hello everyone,

hope you are having a great day, i need help regards melee attack setup.

I have multiple enemy actors in the same scene, when my character attacks them with an axe. The closest enemy actor takes the damage, while the other remain at full health.

please find my setup attached bellow by this post.

Thank you!

What’s the point of the DoOnce node here? I’d say it’s exactly the reason why the damage applied only to a single character. It’s not clear when the Eco/Deco events are triggered, so hard to say…

UPD.: Ah, there is a mistake – you’re applying the damage only to the single specific actor from the overlap event instead of taking actors from the loop.

After checking the screenshots again, I think the issue is here, try to apply the damage to actors from the loop:

UPD.: But the whole logic is unclear: this will be triggered at the first overlap with an actor, so probably you will get only the single actor in Overlapped Actors array.
If you want to damage the actors who’s really overlapped with the weapon, then you need to remove the DoOnce node, as well as the GetOverlappingActors and the loop nodes. To avoid double damage in that case, add the affected actors to a separate array, check for it on each new overlap and clear the array when attack ends.

Great, I removed DoOnce node, as well as the GetOverlappingActors and the loop nodes, and it worked perfectly fine. Now, i am able to attack multiple targets with one swing only, which was what i am aiming for.

About the logic, basically, I made a collision box that is being controlled by two different variables, specifically referring to Eco_sword and Deco_sword. These two variables trigger on and off the collision box of the sword based on frames that i chose while playing the attack animation to avoid damaging enemies while standing still/or passing by them without the intentions of killing them. because at the early stages of my development, i had an issue where every time i come across a target, the target dies as soon as my sword overlaps with his body. That is basically why i have Eco_sword and Deco_sword variables :).

I really do appreciate the time that you spent on fixing my issue, again thanks! <3 .

apparently, i over-complicate things.

You’re welcome! BTW it may be a bit overkill to switch the collision on and off. You can add a boolean variable and change it’s state, while checking it before doing the damage. I’m not 100% sure but I think switching the collision have some side-effects and additional costs.