Team only marker

Hello.

Any ideas how to make team only marker? Basically some kind of marker, what shows only team members?

Do you mean an actor which is only visible to cameras owned by playercontrollers which have a team variable set to a certain value?

If you are talking about something floating above the head of the character telling that it is one of your teammate :

You could use a widget component in your character’s blueprint and place it above your character. And then only display it for the player if they are in the same team (using a tag for instance, you check all the actors and only enable visibility on this widget if the tag is the same as you character’s)

I can’t figure out how to do it. Basically I set teams trough variables. So I tried different ways to set it up, but so far no success

By the way, is it for solo or multiplayer ?

Multiplayer

I got a working system, it’s not the best but it can help you create your own.

First of all I added a Team integet variable in my characters blueprints. I also created a widget only containing an “ally” text. I then created a blueprint called BP_AllyText just containing a WidgetComponent of the class I just created.

Then on BeginPlay in my character, I check if I’m locally controlled (to avoid having every character spawning widget for everybody), and then get all the characters in my level. For each of them, if their team number is the same as mine, I spawn a BP_AllyText for each of them and attach it to them (I created a scene component in my character blueprint to have a point to which I could attach it)

As you can see in the result screenshot, My brown characters are in the same team, all the others are in a different one :slight_smile:
There you have it ! Of course you probably don’t want to do that on begin play but rather when all the players are connected or something like that, but it should be enough for you to create your own system.

I have created a new answer with an example solution =)

Hey. I think it works for me, but for more appropriate answer I need to figure out how to make it work after team select. If I put it as event begin play, it already sets everyone as ally (because starting game everyone is in a team “None”).

Yes of course you have to create a system where players are put in a different team and thus update their variable but if you can do that, the system I made should work. I used beginPlay to create the example but you would never do that in the actual game I think =)
A first step for improvement would be to put the Team variable in the player controller instead of the player I think.
Anyway if the answer is enough for you, don’t forget to accept it so other people searching for that can see the question as answered =)

Actually I have it in Player Controller. Team variable in Master Character was just for some cosmetic reason.
Will mark it, when will make it work, doing some testing and can’t really make it work.

Ok. I figure out what is not working how it should.
Right now its like these:

  1. Player 1 joins Blue Team, no widget added to players, because he is only one from Blue Team.
  2. Player 2 joins Blue Team, widget added to player 1. So now Player 2 can see Player 1 as his team mate, but for player 1 still no team mates.
  3. Player 3 joins Blue Team, widget added to player 1 and 2. Player 3 can see player 1 and player 2 as team mates, player 2 still see only player 1 as team mate, but for player 1 there is not team mates.

Idk. Why I’m getting these kind of results, because as I understand it runs logic every time, when player choose team.

I think I see your problem. You should create some event that you will run on every player every time a player connects to the game. This event would do something like : search for the ally, check if they already have a widget, if not, spawn one.

This will help :
How to Create Team Indicator for Specific Teams in Unreal Engine | No co - YouTube