Sarge-AI/scripts/UPSMON/COMMON/Group/fnc/UPSMON_SetLeaderGrp.sqf
Teh Dango 3ac749d64b 2.1.0
This is the latest stable version of Sarge AI for Arma 3: Exile.
2016-02-19 21:49:51 -05:00

39 lines
710 B
Plaintext

/****************************************************************
File: UPSMON_SetLeaderGrp.sqf
Author: Azroul13
Description:
Set the leader of the group
Parameter(s):
<--- Unit or Group
Returns:
---> Leader
****************************************************************/
private ["_unit","_Leader", "_grp"];
_unit = _this select 0;
_grp = group _unit;
_Leader = leader (_grp);
if ((_unit iskindof "Man")) then {
if(_unit != _Leader) then {
_grp selectLeader _unit;
};
} else {
if (!isnull(commander _unit) ) then {
_unit = commander _unit;
}else{
if (!isnull(driver _unit) ) then {
_unit = driver _unit;
}else{
_unit = gunner _unit;
};
};
_grp selectLeader _unit;
};
_Leader