[Help][Blueprint] Teams and Team Damage / Friendly Fire

I’ve spent the last two weeks striving to apply teams into my blueprint game. The other day I successfully applied a custom team enum to the PlayerController and it persists when players load into a new map. I accomplished the persisting team choice by storing the team enum in a player save game slot. The other benefit of storing the team enum on the PlayerController is the player is able to switch pawns on whim.

I currently can not solve how to control friendly fire based on this team enum stored in the PlayerController. I am making a first person shooter and on Left Click the pawn spawns the bullet actor.

How do I make the bullet actor check to not apply damage to friendlies? I still wish friendlies to block the bullet but the friendlies should not sustain the damage.

idk how you’re doing things, but the way i’d do it is give the bullet a team variable and set it when you spawn it to the team that shot it, and when it collides, if the player it collided with isn’t on that team, deal damage

is there a screenshot or video demonstrating this? I can not seem to find any tutorials demonstrating how to disable friendly fire. This video is exactly what I’ve done except I used an enumeration rather than a Boolean. Unfortunately this tutorial does not have a follow up video showing how to disable friendly fire.

Players load into a Lobby map before the game starts. They are immediately presented with a Team Select Widget. Selecting a team causes the widget to cast the team variable to the custom PlayerController.

The player is then asked to select a character and as such possesses that character. Other Players are able to select the same character.

The pictures I’m linking here are what I thought needed to happen. The Pawn spawns the bullet actor and casts the PlayerController team variable to the bullet’s team variable.

I’m quite certain my issue lies on this image. I’ve tried syncing this team variable to “Ignore Actors” instead work but it wasn’t working…perhaps I was not using arrays properly?

Here is how I managed to get teams to function. My ultimate problem was I could not connect the custom enum the “Ignore Actors” array slot within “Apply radial damage with Fall Off”. The intent is for friendly to not receive explosive damage or any damage. Any other non-splash damage effect could have been done by a simple Branch when comparing their Tags. (Unfortunately I couldn’t compare Enums for some reason).

The following explanation has some extraneous stuff from what I was trying to do. Just insert what I put in text here:

First within the Team Select Widget insert “Set Tags” under the Actor group. Promote “Tags” to a variable. Insert “Get Player Pawn” into the target for the “Set Tags”.

*****Ingame the pawn needs to be spawned and under the Widget Owner’s controller in order for the “Get Player Pawn” to cast the tag successfully.

Second because my pawn is the one spawning the bullet actor we can set the bullet’s tag to mirror the pawn. Create a SpawnActor box and drag the Return Value to “Set Tags” under the Actor group. Now right click on the blueprint graph and “Get Tags” under the Actor group. Connect this “Get Tags” array variable to the “Set Tags” for the SpawnActor bullet.

Lastly within the Bullet blueprint we need to call for the tags that we wish to not deal damage against. Setup the event you wish to activate bullet damage. Prior to the Apply Damage box we need to get the actors involved. Right click on the blueprint graph and “Get All Actors with Tag”. Right click again and “Get Tags”. Right click a third time and “Get”. Connect the “Tags” variable to “Get” and connect “Get” to the “Get All Actors With Tag” and finally connect that blue array to “Ignore Actors”.

**may need to, after the bullet actor applies it’s damage, to perform a “clear array” but I haven’t tested that yet; I doubt it.

to further clarify the Second step. When you click “Get Tags” I really do mean to click on the graph and “Get Tags”. Do not promote the “Set Tags” to a variable.

The way I see it for your system, you’ll be forced to give both the character and the projectile a reference to their team.

How to do that?

When your Controller receives its Team variable, it gets its ControlledPawn, it casts it to your type of Character and give him its Team.
When spawning a Projectile (I guess you’re spawning it on the Character?) you can now give it its team since the character has a reference to its team.
When a projectile hits an actor, cast it to your character type, if it succeeds, check his team. If the team is not equal to the team of the projectile, deal damage to the actor hit, if not just destroy the projectile.