Home   Help Search Login Register  

Author Topic: AA ambiance  (Read 2589 times)

0 Members and 1 Guest are viewing this topic.

Offline ZapBrannigan

  • Members
  • *
AA ambiance
« on: 23 Sep 2010, 15:06:48 »
Hey,

You know in some games like the ww2 based call of duty games. They have the AA machine guns that fire into the air wildly at the planes flying over.    well, i want to do that in arma 2 with the russian AA tank. but i dont want to put any aircraft.

How can I make the russian AA tank fire its aa gun into the air randomly in sweeping circles?

thanks

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Re: AA ambiance
« Reply #1 on: 23 Sep 2010, 18:06:31 »
Great timing pal, i just create a script for doing this. You'll love it. But be patiente tommorrow morning, because then will be front of a PC.

Edit: if you are impatient, download my campaign (op mighty justice) from beta-test topic, unpbo and open army06 mission: check file permanentAA.sqs
If you can't apply it in your mission, check how i use it. But tommorrow, i'll insert a fully commented version here. ;)
« Last Edit: 23 Sep 2010, 18:23:00 by bardosy »
Fix bayonet!

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: AA ambiance
« Reply #2 on: 23 Sep 2010, 19:52:01 »
Hey, bardosy...we have a whole board for this kind of stuff :D  :yes: Even if it's not picked up and put in the ED immediately, it'll still be there for general perusal.
 
Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Re: AA ambiance
« Reply #3 on: 24 Sep 2010, 07:27:10 »
This is my script. I used it for ZU-23, not Shilka, but I looking for the gun of Shilka and write it for you as comment. This script use the gun and the gunner separately. So you have to put an empty shilka and a Russian guy, who moveinGunnaer into the shilka. Name both! Then put a GameLogic somewhere near to the shilka, this will be the target, but 1000m high. So if you put it very close, the Shilka will fire straight up, if you put it a bit far, the shilka will fire on sloop... You can replace the target by script in the mission - if you want - and then, the shilka 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"

Fix bayonet!

Offline ZapBrannigan

  • Members
  • *
Re: AA ambiance
« Reply #4 on: 25 Sep 2010, 05:16:00 »
A good start dude. But i made it much better.  :P

check my attached test mission

Now you only need to place a manned AA tank, and put a game logic anywhere on the map,
activate it with
Quote
[(aa gun name),(game logic name)] exec"aa.sqs" ;  [(aa gun name),(game logic name)] exec"aa2.sqs"

in the units init field.  you need to run the 2 scripts

aa.sqs  controls the target.  now I made it so that the target doesnt just stay in one place. It moves around the aa gun.  as a result instead of yours just firing straight into the air,  the aa gun now fires in sweeping arcs as it moves from target to new target position.

aa2.sqs  controls the gun firing.  yours just fired 1 shot at a time,  now i made it so the gun fires in long bursts.  the length of the burst is random but is usually around 2-5 seconds.  the gun will stop for 1 second between bursts.

Edit, i moved it to the beta testing board, check it out there
  
« Last Edit: 25 Sep 2010, 08:41:45 by ZapBrannigan »