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"

Multiplayer AnimNotify Activates on both characters

Hello to the Unreal community!

I've been working on fixing how my players deal damage to each other, and I think i figured out what the issues is, only I don't know how to fix it.. I have 2 players that I'm spawning in editor, both characters have the same sword equipped in a socket. When the player presses attack, it swings the weapon and activates/deactivates the collider with animnotifies. Damage is dealt to the enemy player if the sword hits, however, if you go too close to the enemy (enemy sword is colliding with your hitbox) when activating the swing, the enemies sword collider is activated also. How can i Define Which sword is activated based on who is swinging?

-SamuelB

Product Version: UE 4.14
Tags:
more ▼

asked Feb 13 '17 at 12:32 PM in Blueprint Scripting

avatar image

Samuelb
273 9 17 22

avatar image CometGoat Feb 13 '17 at 01:17 PM

Hi Samuelb, could include screenshots of your blueprinting please? :)

avatar image Samuelb Feb 13 '17 at 01:37 PM

Sure thing! If there is something specific you want to see, just tell me and I'll post it =)

  • Samuelb alt text

alt text

avatar image CometGoat Feb 13 '17 at 01:47 PM

Ah, the issue is that you're getting all of the Katana BPs and then setting the collision on all of them.

You should store a reference to the player in the animation blueprint. When you set the collision of the katanas then find the katana that's attached to the stored player reference. :)

avatar image Samuelb Feb 13 '17 at 01:57 PM

Do you mean something like this? See picture. Could I just cast off of 0_base bp in the animation blueprint? alt text

playerref.png (352.0 kB)
avatar image Samuelb Feb 13 '17 at 02:06 PM

I'm spawning the katana's into the socket on beginplay, that seems to be making them difficult to reference ;E.

alt text

initwep1.png (374.5 kB)
avatar image CometGoat Feb 13 '17 at 02:28 PM

Okay, it should be more like this: alt text

In your case you will want to get "current wep" from the player.

As a side-note: getting all actors of class won't necessarily order them in the way you'll need them. So getting the first player in the player array might not actually get player one.

avatar image Samuelb Feb 13 '17 at 03:28 PM

Hi again, thanks for that, i tried something similar without success, i'll give it another try. Do you mean that when i'm getting my players from class they will go in random order sometimes?

avatar image Samuelb Feb 13 '17 at 03:34 PM

This works for player 1 correctly, but player 2 can still die if he's too close to player 1

alt text

avatar image CometGoat Feb 13 '17 at 03:59 PM

You're still setting the collider for both players! If you have both players connected to the "Enable Katana Coll" node then they're both going to have their katana colliders enabled.

If you "get owner" from the animation blueprint then you'll be returned with the player that's swinging the sword. Get the katana collider from that player and set it.

avatar image Samuelb Feb 13 '17 at 04:21 PM

Could you show an example of what you mean? I don't quite understand, sorry. :(

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

alt text

Replace the "ronin" cast-to with whatever your player is. :)

more ▼

answered Feb 13 '17 at 04:34 PM

avatar image

CometGoat
259 4 8 13

avatar image Samuelb Feb 13 '17 at 04:41 PM

Wow, I'm always overcomplicating things for myself, it works now as intended! Thank you very much good sir! =)

avatar image CometGoat Feb 13 '17 at 04:47 PM

That's great to hear!

Could you mark that last picture as the correct answer so other people can easily see it? :)

(comments are locked)
10|2000 characters needed characters left
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