Home   Help Search Login Register  

Author Topic: how to force AA gun to fire  (Read 1242 times)

0 Members and 1 Guest are viewing this topic.

Offline guziczek101

  • Members
  • *
how to force AA gun to fire
« on: 30 Aug 2011, 13:14:47 »
Hi i have problem i'm trying to force Flakvierling (from reyhard WW2 mod) to shot invisible target on the sky (effect like on D-Day )

I have written my first script (I supported on one of the script from I44) but infantry is shotting to this dummy targets

Here is my script

Code: [Select]

_vehicle = _this select 0

_targetArray = [wal,wal_1,wal_2,wal_3,wal_4]

_number = Random count _targetArray

? ((_number mod 1) >= 0.5): _number = _number + 1

_number = _number - (_number mod 1)

_position = _targetArray select _number

_vehicle doTarget _position

~10

_vehicle doFire _position

exit

if someone could help me to change this script to don't need to use the dummy targets

wal, wal_1, wal_2... are the dummy target's

thanks

Walter_E_Kurtz

  • Guest
Re: how to force AA gun to fire
« Reply #1 on: 31 Aug 2011, 01:13:59 »
I briefly tested the following in the Mission Editor, using a Shilka named flak:

To point it in an approximate direction I used doWatch as that command can use a position, not just a target. This points it north-east at an elevation of 45 degrees.
Code: [Select]
flak doWatch [(getPos flak select 0) + 100, (getPos flak select 1) + 100, 100]
Then I used the alternative command fire to make sure the weapon is used. Again because the unit does not have an actual target to shoot at.
Code: [Select]
flak Fire "ZsuCannon"

Edit:
    again using Shilkas, this script will enable a battery to fire at an area north of their position. It's launched by
         {[_x] exec "TripleA.sqs"} forEach [flak,flak2,flak3,flak4]
and can be stopped by setting CeaseFire to true.
Code: (TripleA.sqs) [Select]
_flak = _this select 0

_rounds = 0
CeaseFire = false
goto "Targetting"

#Burst
_rounds = _rounds - 1
_flak fire "ZsuCannon"
~0.1
? (_rounds > 0): goto "Burst"

#Targetting
_flak doWatch [(getPos _flak select 0) - 60 + random 120, (getPos _flak select 1) + 100, 100 + random 100]
~3 + random 2
?CeaseFire: exit

;#Firing
_rounds = 6 + random 14
_rounds = _rounds - (_rounds mod 1)
goto "Burst"
« Last Edit: 31 Aug 2011, 02:09:19 by Walter_E_Kurtz »

Offline steadfast

  • Members
  • *
Re: how to force AA gun to fire
« Reply #2 on: 08 Sep 2011, 06:04:03 »
This makes sense to me. I hope the OP got it to work. Anyway, even if he didn't, I appreciate your answer as it is helping me make understand how to write a script.