Melee Combat System Question

I’m doing a multiplayer melee combat system where the enemy has to be overlapping a sphere collision in order to do damage to him. Here’s a picture of the setup:

The attack event is called from a notify event at a certain point of the punching animation. This is what the attack event looks like:

At the moment I can damage the other player when he steps into the collision. But I can also damage him after he leaves the collision. So my question is, what would be the best way to see if there is someone colliding with the sphere? I honestly have no idea how to create logic that would constantly be checking for it.

I hope ive understood your problem, this is a quick thing I came up with which might be a solution. I create a timer by event and set it to loop, then you make that timer a variable so you can clear it later on, then using the node ‘get overlapping actors’ you can filter for the other player type, and by getting the length of that array you can detect if they are still within the attack range, I think this will be better than just cancelling it using a EndOverlap as it means you can have multiple people in the attack range and someone leaving the range won’t prevent you from attacking! If there is no-one in the array, then it clears the timer and unsets the bool so the timer can be reactivated. Otherwise you can loop through the array and make them attack-able.

It might need some changing around to get it working on a server, but I hope this helps!

Thanks for the reply, that actually looks really promising! I was playing around with the get overlapping actors and I was wondering why something like this wouldn’t work:

I think I understand now, so the Attack custom event is triggered when the player attacks? If so then that should work, every time the player wants to attack it will check the overlapping actors and only be able to add damage to those actors, which makes sense.

What you could also try if you could use the EventAnyDamage to add damage to your target enemy which you can trigger by a “Apply Damage” node. Its a great system for networking because ApplyDamage can only be triggered from Authority, but what you’ve got so far is great!

110113-anydamage.png

110114-anydamage2.png

Apply damage is put where you’ve got MakeDamage unless you need more checks involved.

You put this event on the actor that can be damaged and do the damage handling code here-