Sarge-AI/ModName.MapName/scripts/UPSMON/COMMON/vehicles/fnc/UPSMON_assignasgunner.sqf
Teh Dango 65e4453908 2.4.0
Major Update. Now supporting DesolationRedux, Epoch and Exile.
2017-12-31 03:16:37 -05:00

35 lines
1003 B
Plaintext

/****************************************************************
File: UPSMON_assignasgunner.sqf
Author: MONSADA
Description:
Move unit to the gunner position of a vehicle
Parameter(s):
<--- unit
<--- vehicle
<--- Do they move to the position or spawn ?
Returns:
Nothing
****************************************************************/
private["_vehicle","_gunner","_dist","_spawninveh"];
_gunner = _this select 0;
_vehicle = _this select 1;
_spawninveh = false;
if (count _this > 2) then {_spawninveh = _this select 2;};
_dist=0;
[_gunner] orderGetIn true;
_gunner forcespeed 40;
_gunner assignasgunner _vehicle;
if (_spawninveh) then {_gunner moveingunner _vehicle;};
waituntil { _gunner != vehicle _gunner || !alive _gunner || !canmove _gunner ||!alive _vehicle || !canfire _vehicle};
if ( alive _gunner && alive _vehicle && canmove _gunner && canfire _vehicle) then {
_dist = _gunner distanceSqr _vehicle;
if (_dist < 3) then
{
_gunner moveInTurret [_vehicle, [0]] ;
};