arma3_missions/helotraining_mp.Altis/loadSquad.sqf

42 lines
1.4 KiB
Plaintext
Raw Normal View History

//diag_log format["loadSquad called, _this: %1", _this];
private _vehicle = _this select 0;
private _squad = _this select 1;
private _fromTaskId = _this select 2;
2016-07-25 21:58:29 +00:00
private _pilot = driver _vehicle;
private _side = side _squad;
private _squadCmdr = (units _squad) select 0;
{_x assignAsCargo _vehicle} foreach units _squad;
{[_x] ordergetin true} foreach units _squad;
{_x disableAI "TARGET"; _x disableAI "AUTOTARGET";} foreach units _squad;
2016-07-24 21:22:07 +00:00
private _wp = _squad addwaypoint [_vehicle,5,1];
_wp setwaypointType "GETIN";
2016-07-25 21:58:29 +00:00
[_squadCmdr, format["%1, please standby as we're loading up.", name _pilot]] remoteExec ["sideChat", _side];
scopeName "main";
while {true} do
{
scopeName "loadingLoop";
//diag_log format["loadSquad: ticking %1", _this];
if ({alive _x} count units _squad == 0) then
{
// Everybody died before boarding :(
[_fromTaskId, "FAILED" ,true] spawn BIS_fnc_taskSetState;
breakOut "loadingLoop";
2016-07-24 21:22:07 +00:00
};
if ({alive _x} count units _squad == {(_x in _vehicle) && (alive _x)} count units _squad) then
{
// Boarded
[_fromTaskId, "SUCCEEDED" ,true] spawn BIS_fnc_taskSetState;
breakOut "loadingLoop";
};
sleep 2;
};
2016-07-25 21:58:29 +00:00
[_squadCmdr, format["%1, everyone is onboard, you're clear to lift off", name _pilot]] remoteExec ["sideChat", _side];
//diag_log format["loadSquad done, _this: %1", _this];