Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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:

alt text

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:

alt text

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.

Product Version: UE 4.13
more ▼

asked Oct 07 '16 at 07:48 PM in Blueprint Scripting

avatar image

28 2 5 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

alt text

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

more ▼

answered Oct 07 '16 at 08:38 PM

avatar image

251 7 3 11

avatar image LX3 Oct 08 '16 at 08:47 AM

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:

alt text

avatar image Razer313 Oct 08 '16 at 10:59 AM

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!

alt text

alt text

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-

anydamage.png (22.8 kB)
anydamage2.png (18.4 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question