Home   Help Search Login Register  

Author Topic: Anti aircraft Flak Script (ACCEPTED)  (Read 4195 times)

0 Members and 1 Guest are viewing this topic.

Offline Supr3me Kill3r

  • Members
  • *
Anti aircraft Flak Script (ACCEPTED)
« on: 18 Jul 2008, 01:47:56 »
Script that takes an anti aircraft battery (shilka, vulcan, m2, whatever you want) and uses it to fire flak into the sky.
Demo included, and Instructions and all other information included in the readme.

Watch video


The script simply takes a unit such as a shilka, and orients it to face psuedo-targets (targets are not actually created, so theres no interference with other AI units to target them) and then the unit fires at that direction. You specify the radius for which "targets" are randomly created, and the height for the unit to fire at. Right now its set up so that the unit will fire and then change direction while firing, creating an effect of spraying the sky with triple-A fire, instead of  just firing in a straight line.

OFPEC DOWNLOAD
« Last Edit: 10 Aug 2009, 17:05:17 by hoz »

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Anti aircraft Flak Script
« Reply #1 on: 18 Jul 2008, 02:10:08 »
Supr3me Killer,

Nice job, good way to add atmosphere, and then fill said atmosphere with lead.

Here's YOUR reply, as always.

Luke
Pesky Human!!
Wort Wort Wort.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Anti aircraft Flak Script
« Reply #2 on: 18 Jul 2008, 23:58:40 »
Nice small script you might want to improve a bit:

Code: [Select]
_x = _a + random _radiusThat code will always generate an East displacement, as your random will be always positive, same for _y and _z.
If you want a random position around a center with a maximum radius you may use:
Code: [Select]
_pos_to_watch = [_a - _radius + random (_radius*2), _b - _radius + random (_radius*2), _c + _altitude - _radius + random (_radius*2)];

Also you are using the "AZP85" weapon inside the script, which means this will work only with ZSUs, you may provide the weapon as a parameter, this way your script will be able to work with any vehicle with a gun.

So should also provide a way to stop that scripted fire, for example, because the you need to change the assigned targets for the flak guns. The best way would be to conver the sqs code to sqf code, this way you may use "terminate" command to finish the current script and start a new one for the same vehicle but different target.

Offline Supr3me Kill3r

  • Members
  • *
Re: Anti aircraft Flak Script
« Reply #3 on: 19 Jul 2008, 00:53:12 »

Code: [Select]
_x = _a + random _radiusThat code will always generate an East displacement, as your random will be always positive, same for _y and _z.
If you want a random position around a center with a maximum radius you may use:
Code: [Select]
_pos_to_watch = [_a - _radius + random (_radius*2), _b - _radius + random (_radius*2), _c + _altitude - _radius + random (_radius*2)];


Thanks for pointing that out I just started to notice it too.

Quote
Also you are using the "AZP85" weapon inside the script, which means this will work only with ZSUs, you may provide the weapon as a parameter, this way your script will be able to work with any vehicle with a gun.

Easy fix. I'll do an update sooner or later.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Anti aircraft Flak Script
« Reply #4 on: 19 Jul 2008, 00:59:15 »
And also, if you quote full messages like in your reply, we'll not be able to do anything to save you of the wrath of -h, he keeps lurking by the forums looking for unaware preys like you  :P Check the forum rules.

Offline Supr3me Kill3r

  • Members
  • *
Re: Anti aircraft Flak Script
« Reply #5 on: 01 Aug 2008, 19:34:32 »
Updated. sorry i've been busy.

http://files.filefront.com/Flak+Script+demo+Updatedrar/;11315790;/fileinfo.html

Fixed the East-only displacement.

Offline Shadow.D. ^BOB^

  • Members
  • *
Re: Anti aircraft Flak Script
« Reply #6 on: 05 May 2009, 15:05:14 »
Hey, sorry to drag this post backup but i cant seem to get it to work properly.

The actual demo mission, the shilka do not start firing at all (i assume this is because i am using ACE and the shilka weapon or whatever has a different name). I noticed above that Mandoble suggested:-

Quote
Also you are using the "AZP85" weapon inside the script, which means this will work only with ZSUs, you may provide the weapon as a parameter, this way your script will be able to work with any vehicle with a gun.

How hard would this be to implement, i would like to use the ZU23 that comes with ACE.  But i dont know what the weapon name is, to put into the script.  I have trawled through the ACE Configs, but thus far have come up empty.  An addition to this, so that any vehicle will perform he scripted behaviour, would make this good script alot more accessable.

If anyone as any idea how to implement this, or if anyone knows the ACE values, so i can use this script.  I would appreciate it.

Thanks in advance for any help.

Offline Shadow.D. ^BOB^

  • Members
  • *
Re: Anti aircraft Flak Script
« Reply #7 on: 10 May 2009, 13:51:31 »
After posting on other forums and lots of searching, i found the weapon name for the ACE Shilka:-

"ACE_ZSUMGun23"

Now the problem is, i just cannot get the Shilka to open fire.

Is there any chance one of you scripting guru's, might be able to offer a suggestion as to why?

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Anti aircraft Flak Script
« Reply #8 on: 27 May 2009, 16:20:54 »
Sure. It's because the Shilka's weapon name is hardcoded in the script ("azp85"; lines 52, 55 and 58).

So you need to find the the name of the weapon the "ACE Shilka" uses and replace it accordingly.
try { return true; } finally { return false; }