x

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"

dealing damage melee multiplayer 2 playercharacters

Hi

I'm making a 1 vs 1 swordfighting game and have been tackling with several issues. Recently I've been having an issue with getting my katana/sword to deal damage only to the other player. I suspect it has something to do with how i'm spawning the katana/sword to the actors or how i'm enabling/disabling the colliders on it.

Basicly what happens is when i hit the other player from far, that player loses health correctly, but if i get too close the enemies sword and attack, they both take damage. Should I be using some sort of tagging system to determine which character ignores the damage? And if so how would i go about doing it.

Thanks in advance Samuel Brooke

max hp = 2.0

pictures: hit from far http://imgur.com/a/uaVgB

hit from close http://imgur.com/a/3JwpH

Product Version: UE 4.14
Tags:
more ▼

asked Feb 08 '17 at 12:54 PM in Blueprint Scripting

avatar image

Samuelb
283 9 19 22

avatar image StillAlive039 Feb 09 '17 at 10:49 AM

Maybe if you're too close the collider of the other katana hits your character, as I can see in the hit from close picture your character is very near the enemies katana.

avatar image Samuelb Feb 09 '17 at 11:11 AM

Hi thanks for the reply and yes, thats exactly what is happening. My point was that I am spawning the same katana, even though i activate the katana on player1 it also activates the katana on player 2.

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

1 answer: sort voted first

can you show the code where you actually do the hit detection - does the "hit" require the player be swinging the weapon? you can also maybe check to see if the weapon is hitting its holding player

perhaps check out ramas weapon plugin, might be worth using, or pulling apart to learn from - https://www.youtube.com/watch?v=aufEB4TCf30

more ▼

answered Feb 09 '17 at 11:04 AM

avatar image

BPANDREW
1k 22 27 125

avatar image Samuelb Feb 09 '17 at 11:20 AM

Hi and thanks for the reply, The collider is enabled using rep notifies on the animation. So when the Hit animation is activated, the katana's collider will activate and deactivate between "rep enable collider"," rep Disable collider" if that makes any sense. I'll provide the requested code for you in abit. As for using ramas plugins, I've thought of that before, but I would like to leave that as a last resort. I don't recall there being anything about player vs player hit detection in that?

  • SamuelB

avatar image Samuelb Feb 09 '17 at 11:29 AM

Here are some screenshots, hopefully they will help to clarify the situations. - SamuelB alt text alt text

alt text

charhandledmg.png (326.1 kB)
ontakedamage.png (293.2 kB)
avatar image Samuelb Feb 09 '17 at 12:39 PM

I've also tested that the collider is not hitting the players own collider, I had that issue earlier and solved it by making the notify threshold alot smaller (so it only activates at the very end of the swing) and by moving the sword collider more towards the end of the katana.

(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