All pastes #191582 Raw Edit

Someone

public text v1 · immutable
·published 2006-10-05 03:02 UTC
rendered paste body
; GearTrigger.sqs
; In trigger activation field:
; [thisList, "unittype", ["Weapon", "Weapon", "Weapon"], ["Magazine", "Magazine", "Magazine"]] exec "GearTrigger.sqs"

;Privatize variables
private ["_list", "_type", "_wepa", "_maga", "_limit", "_c", "_unit"];

;List of trigger units
_list = _this select 0

;Type we are looking for
_type = _this select 1

;Weapon and ammo arrays
_wepa = _this select 2
_maga = _this select 2

;The number of elements in the unit array and our maximum filter number
_limit = count _list

;Loop counter
_c = 0

#loop
;Check the selected unit element, is it the one we are looking for?
? ((typeOf (_list select _c)) == _type) : goto "gear"
~0.05

;Select the next unit in the trigger
_c = _c + 1

;Are we out of units yet?
? (_c >= _limit) : goto "exit"
goto "loop"

#gear
;Give the selected unit a name
_unit = (_list select _c)

;Execute gear script on that unit
[_unit, _wepmags] call FOX2_GearUp

;Select the next unit in the trigger and take it from the top
_c = _c + 1
goto "loop"

#exit
exit