Projectile need to ignore team mates

Hello.

How Can I get my projectile owner? I’m making team shooter and I need, that team sniper can’t hit his team member. Projectile recognize in that team is the hit actor. but I don’t know how to check it for person who shoot projectile. So here you can see how I call my projectile:

These is my projectile event graph:

And these is my Set Damage function, where I check if I try to hit team member:

Maybe add 2 different tags, 1 for team 1 and 1 for team2.
So when you hit and actor check if it has tag that is equal to the one that fired and if true>do nothing

I would assume that each player has some sort of variable that denotes the team they are on, either a int or enum. Add the same variable type to the bullet and set it to “Show on Spawn”. This way when you spawn the projectile you get the variable type on the node that you can then plug the team variable into it from the player that spawns it.

When the bullet then hits a player you just check the variable in the projectile to the variable of the hit player.

In our game the team is an enum in the PlayerState. To handle hits/kills by projectilecomp moving objects we send along the PlayerState in projectiles and grenades. As the PlayerState is persistent even if the instigator pawn is removed we can check for team kills but also things like the full player name (also in playerstate).

I do something similar to make sure only my player’s projectiles add to my score. I check if the “Hit Actor” from the hit result is on my team. I use tags for each team member, “Red”, “Blue”, and “Green”. Then for my weapon base blueprint (All player weapons are a child of that BP) it has a tag, “PlayerGun”. I use a For Each Loop to check the tags of the Hit Actor. If the tags are “Red” or “Blue” a Branch sends it to another For Loop. Then it checks that the Hit Actor and the Owning Player of the projectile is == to “PlayerGun”. If that is true, a Branch send it to either SCORE for the player or (false) it goes and destroys the actor (projectile). For me, this allows my teammates to take friencly fire, but not count towards the player’s score. If I didn’t have the second For Loop to check the TAGS (PlayerGun) against the Owning Player (weapon that spawns the projectile) then whatever my teammates hit (“Green” team) will also add to my score. I didn’t want that to happen.

In your case, I would flip the logic. Something like having a TAG in the weapons that spawn the projectile. Let’s TAG your teammates as “FOX”, for example. Work inside the projectile: When the projectile hits, compare your hit actor result with the projectiles owner or instigator (if a weapon and not your character, it will also have a “Fox” TAG). If the tags for the hit actor result are not equal to “FOX”, then go on to do damage. If the TAG is equal to “FOX”, than do nothing but destroy the projectile.

You should be able to dynamically set the TAGS. Just make sure whatever weapons TAG you use matches the team TAG. You’re system can be dynamic, I’m sure. If your team picks up a weapon, it will set a “Fox” TAG. The other team picks it up, it will set a “Chicken” TAG… etc.

Hope that helps.

Thank you guys for your reply. Pattyms method did the trick. Thank you!

ps. Maybe someone has idea why my projectile is not hitting (register) hitbox?