How To Tag Players in Multiplayer?

In regards to collisions, I imagine I need to setup tags for players. I believe I would need an Array to create a tag for each player, but I am not sure if this is best method.

Could someone point me in the right direction to handle how to tag players in a Multiplayer game? Right now, I have 2 players, I wish to be able to know which is which so bullets do not collide with the actor who fires them, and also to not hit myself, and the other player gets the event hit.

Hey DreamBotStudios,

If you are using a Line Trace to determine if you hit your target, there’s an option on that node to Ignore Self, so if your Fire event is in your Player Character blueprint, you can ignore self that way. Another option, and probably the best option, is to have an Enum variable on your Player Character blueprint that has a TeamA and TeamB option. When you get a hit on a player, have it check to see if the Player Character you hit has the opposite Team setting before applying damage.

Hope that helps!

-Steve

Thanks a bunch, I will try the Enum and do the check. I have never done a Enum check before, is there a place/doc/content example I can see an example?

Also, in regards to setting TeamA and TeamB?
I imagine I do this at Event Begin Play, but do I use an Array to do this.

I am not sure how to setup TeamA and TeamB when its for 2 player game.

Lastly, which would be in your opinion the best to use Event Hit or Overlap for bullet collisions in a multiplayer game ?(considering the players have jet packs and can run into their own bullets when falling downward in sky) side scroller

Thanks

I just got this to work today for a fighting game, I have one character VS a copy of itself for testing right now.

I have two custom collision IDs, one for Red Spheres = Attack volume, and Another ID for Blue spheres = Vulnerable area.

When a dummy throws a punch, there is a red sphere on his hand that has collision enabled when being used, and disabled when not.

When the Red collision Spheres enter the Blue Collision Spheres, you get an overlap event.

In the Character’s BP, I have an Event Actor Begin Overlap, that links to a “Branch”, which is preventing the players from hitting themselves.

The condition for that Branch, is a != test to check the Display name from the other actor against the Display name of Self.

If the Display names are not equal, then it’s okay to move ahead and do the hit reaction.

To get the specific reaction to different attacks, I made an Int Variable to work as an ID system.
When different moves are being performed, a different move ID is set.

Move ID for Punch = 1
Move ID for Kick = 2
etc.

I use that for a Switch Case.

The Branch links to the Switch, and that links to the different get hit functions.

This is how I got it to work after a lot of stumbling around, so I don’t know if this is a good way to do it, I haven’t been able to find a clear answer either.

Thanks bud for sharing. I will try to put this concept to work and see how it does. Much appreciated… will post back if I find anything to help out.

I wanted to share the process which I was able to get my players on a team for a 2 player multiplayer.
It happens in 3 steps:

  1. Setup Teams (On Begin Play On MyCharacter BP or Game BP)
  2. Check If Hit Yourself or Team B (Event Hit on Projectile BP)
  3. Hitting Other Player Effects/Stuff (Event Hit on Projectile BP)

I am posting the blue print images below, I am not sure if this is great solution, but is working so far and will update if it does not.

Setup Teams (On Begin Play On MyCharacter BP or Game BP)

Check If Hit Yourself (Team A) or Hit Other Player (Team B) – (Event Hit on Projectile BP)
Hitting Other Player Effects – (Event Hit on Projectile BP)

Hi Does this method work? I’ve been testing it out abit on my multiplayer sword fighting game with no luck 8(