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?
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.
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.
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?
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.