mirror of
https://github.com/Teh-Dango/Sarge-AI.git
synced 2024-08-30 16:32:11 +00:00
39 lines
710 B
Plaintext
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
|