Jump to content

Recommended Posts

Hey guys,

trying to get a script together that will force some zu_23 to fire in the air at 'invisable' targets.

I have found several old scripts - the most successful one being http://forums.bistudio.com/showthread.php?78895-Making-a-ZU-23-fire-at-the-sky

this is the script I'm currently using which is called using

[aagun2, h2, 250, 1000] exec "scripts\flak.sqs"

; ****************************************************************
; Script file for Armed Assault
; Updated for Arma 2 Zu-23 by Recoilless
; Created by: SUPR3ME KILL3R
; Thanks to Arma Edit
; ****************************************************************


_K = _this select 0
_Target = _this select 1
_radius = _this select 2
_altitude = _this select 3

#Flakloop

_a= getpos _Target select 0
_b= getpos _Target select 1
_c= getpos _Target select 2

_gap=random _radius
_direction=random 360

_x = _a +((cos _direction)*_gap)
_y = _b +((sin _direction)*_gap)
_z = _c + _altitude - _radius + random (_radius*2)

_gap2=random _radius
_direction2=random 360

_xx = _a +((cos _direction2)*_gap2)
_yy = _b +((sin _direction2)*_gap2)
_zz =_c + _altitude - _radius + random (_radius*2)

_gap3=random _radius
_direction3=random 360

_xxx = _a +((cos _direction3)*_gap3)
_yyy = _b +((sin _direction3)*_gap3)
_zzz = _c + _altitude - _radius + random (_radius*2)

_gap4=random _radius
_direction4=random 360

_xxxx = _a +((cos _direction4)*_gap4)
_yyyy = _b +((sin _direction4)*_gap4)
_zzzz = _c + _altitude - _radius + random (_radius*2)

_K disableAI "Target"
_K disableAI "AutoTarget"
_K doWatch [_x,_y,_z]
~0.5
_K setVehicleAmmo 1
_K fire (weapons _K select 0)
_K doWatch [_xx,_yy,_zz]
~0.5
_K fire (weapons _K select 0)
_K doWatch [_xxx,_yyy,_zzz]
~0.5
_K fire (weapons _K select 0)
_K doWatch [_xxxx,_yyyy,_zzzz]
~2
goto "Flakloop"

exit

however none of them seem to work and result in 'cannot find script' errors in game. The closest I've got is making them fire directly in the air.

Any help would be greatly appreciated, tried doing a forum search but I couldn't find anything that I hadn't already tried.

Share this post


Link to post
Share on other sites

He has placed it in a folder inside the mission folder called scripts. You need to place the file there or change the call to something like this.

[aagun2, h2, 250, 1000] exec "flak.sqs"

aagun is the zu23

h2 would probably an invisible helipad.

I also add this to spice it up a little.

add this to the zu23 aswell and save the script as flak.sqf

this addEventHandler ["fired",{_this execvm "flak.sqf"}]

//this addEventHandler ["fired",{_this execvm "flak.sqf"}]
//_bullet = nearestObject [_this select 0,_this select 4];


_shooter = _this Select 0; 
_weap = _this select 1;
_who = _this select 5;
_what = _this select 3;
_ammotype = _this Select 4;
_bullet = _this select 6;

_shooter setskill ["aimingShake",0];
_shooter setskill ["aimingAccuracy",0];

//hint format ["%1",assignedTarget _shooter ];

_rand = random (800)+200;

waituntil {!alive _bullet or ( _bullet distance  _shooter > _rand)};
sleep random (0.1);

// if (_rnd >= 25 ) then {waituntil {!alive _bullet or ( _bullet distance  _shooter > _rand)};

_warhead = createVehicle ["Sh_125_HE", getpos _bullet, [], 0, "CAN_COLLIDE"];

_holder = createVehicle ["weaponHolder",getpos _bullet, [], 0, "CAN_COLLIDE"];


_warhead setPosATL (getPosATL _holder);
//};

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×