rendered paste body;
; mando basic script to allow units to reload other missile equiped MCC units
; mando_missilereloadallow.sqf v1.0
; Feb 2007 Mandoble
;
; Arguments:
; Ammo vehicle or building
; Number of missiles left to reload other units
; Distance to activate load action
; Array of units than may reload here
;
; Example:
; [ammo, 24, 12, [sam1, sam2, ag1,ag2]]exec"mando_units\mando_CMreloadallow.sqs"
;
_vehicle = _this select 0
_nummiss = _this select 1
_distload = _this select 2
_sams = _this select 3
;_vehicle setVariable ["mando_CMleft", _nummiss]
?!local server: goto "check1"
_damage = (100-_nummiss)*0.1/100.0
_vehicle setDamage _damage
#check1
~2
? ((damage _vehicle > 0.1)|| !(alive _vehicle)):exit
? ( ((vehicle player distance _vehicle) > _distload) || !(vehicle player in (nearestObjects [_vehicle, ["Air","RHS_Units"], _distload])) && (damage _vehicle <= 0.1) ): goto "check1"
_damage = damage _vehicle;
? _damage > 0.1:_ammoleft = 0
? _damage <= 0.1:_ammoleft = floor(100 - 100*_damage/0.1)
cutText[format["Counter-Measure Cargo: %1%2", _ammoleft, "%"], "PLAIN DOWN"]
_actionidx = -1
_unit = vehicle player
?_ammoleft > 0:_actionidx = _unit addAction ["Reload Counter-Measures", "ArmAI_Scripts\Core\mando_units\mando_CMreload.sqs", [_unit]]
#check2
~2
? ((damage _vehicle > 0.1)|| !(alive _vehicle)):exit
?((vehicle player distance _vehicle) < _distload) && (vehicle player in (nearestObjects [_vehicle, ["Air","RHS_Units"], _distload])) && (damage _vehicle <= 0.1)): goto "check2"
?_actionidx != -1: _unit removeAction _actionidx
goto "check1"