OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Resources Beta Testing & Submission => Topic started by: bardosy on 24 Sep 2010, 07:58:53

Title: ambient AA fire
Post by: bardosy on 24 Sep 2010, 07:58:53
Many video-wargame use in the backround (specially in night missions) a working and continously firing AA battery. His job is easy: firing up and add a mood for the mission.

I create a script for do this in ArmA2. (I did it for an Arrowhead campaign, but there is no nothing Arrowhead-specific things)

I used it for ZU-23, not Shilka or any other AA-gun, but I looking for the gun of Shilka and write it in the script as comment (if you want other AA gun, you have to looking for his gun name...). This script use the gun and the gunner separately. So you have to put an empty ZU-23 and an opfor guy, who moveinGunner into the gun. Name both! Then put a GameLogic somewhere near to the gun, this will be the target, but 1000m high. So if you put it very close, the gun will fire straight up, if you put it a bit far, the gun will fire on sloop... You can relocate the target by script in the mission - if you want - and then, the gun will turn for it...


permanentAA.sqs:
Code: [Select]
;permanent AA fire script by bardosy
;
;parameters:
; 1., the AA gun itself (without handler man)
; 2., the gunner (man)
; 3., the target, it's a GameLogic near the gun (if you put in ON the gun, gun will fire up 90 degree)
; example:  [zu, eastman, GL1] exec "permanentAA.sqs"


_gun = _this select 0;
_gunner = _this select 1;
_tar = _this select 2;


_zudb = 0;
_gun doWatch [(getPos _tar)select 0,(getPos _tar)select 1,1000]



#loop

?(not alive _gunner) : exit
if (_zudb>10) then {_gun setVehicleAmmo 1;_zudb=0;}


;this fires the gun, but you need the proper gun type.
;"2A14" is for ZU-23 and "AZP85" is for ZSU
_gun fire "2A14"

_zudb = _zudb + 1;

~0.5+(Random 1)

_gun doWatch [(getPos _tar)select 0,(getPos _tar)select 1,1000]

goto "loop"