Files
Sarge-AI/Sarge AI Files/scripts/UPSMON/COMMON/Group/fnc/UPSMON_SetLeaderGrp.sqf
Teh Dango 1218f04f15 2.1.1
Pushing this due to the greatly improved HC logic compared to the
current logic. This minor update includes a new variable to control kill
messages and track AI kills.
2016-04-02 12:18:10 -04: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