OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: guziczek101 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
_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
-
I briefly tested the following in the Mission Editor, using a Shilka named flak:
To point it in an approximate direction I used doWatch (http://www.ofpec.com/COMREF/index.php?action=details&id=114&game=All) as that command can use a position, not just a target. This points it north-east at an elevation of 45 degrees.
flak doWatch [(getPos flak select 0) + 100, (getPos flak select 1) + 100, 100]
Then I used the alternative command fire (http://www.ofpec.com/COMREF/index.php?action=details&id=132&game=All) to make sure the weapon is used. Again because the unit does not have an actual target to shoot at.
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.
_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"
-
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.