Jump to content
kahssymhir

Retrieving assignTeam colour

Recommended Posts

Hello,

 

How can you retrieve (and subsequently save) the colours a group leader assigned to its squad mates?

Thanks!

 

Kahss

Share this post


Link to post
Share on other sites

This returns the string of the team a unit is in - or nothing, if no unit is provided.

_team = assignedTeam player;

if (_team in ["MAIN","RED","GREEN","BLUE"]) then {format ["player has the colour %1",_team]};

  • Like 1

Share this post


Link to post
Share on other sites
15 hours ago, Belbo said:

This returns the string of the team a unit is in - or nothing, if no unit is provided.

_team = assignedTeam player;

if (_team in ["MAIN","RED","GREEN","BLUE"]) then {format ["player has the colour %1",_team]};

 

this is right, but can also lead to script errors due to the potential for the command to return nothing.

 

assignedTeam should always have an "isNil" check before use

 

if (!isNil {assignedTeam <unit>}) then {
	_team = assignedTeam <unit>;
} else {
	_team = "MAIN";
};

 

 

  • Like 2

Share this post


Link to post
Share on other sites

Yeah, it was not a specific way to handle this command, just an example of what the return means.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×