Jump to content
EnderZC

Scripting cycling planes with ZSU ambient fire?

Recommended Posts

Hello!

 

I am making a mission with addons. My main idea for the scripting is to have 2-3 airplanes in formation fly over the AO and having a ZSU fire around the airplanes, maybe ocassionaly taking one down. I want these airplanes and ZSU fire to go every 10-15 minutes or so to create ambiance for the soldiers on the ground. If anyone has any solutions/scripts for this I'd be happy to know!

 

Kind regards// Ender from Zeus Community

Share this post


Link to post
Share on other sites

initServer.sqf (or any script for server):

 

MGI_flyBy = {
params [["_start",[0,0,0]], ["_end",[worldSize/2,worldSize/2,0]], ["_height",200], ["_speed","LIMITED"], ["_class","O_Plane_Fighter_02_F"], ["_side",EAST]];
_start set [2, _height];
private _dir = _start getDir _end;
private _plane = createVehicle [_class,_start,[],0,"FLY"];
_plane setDir _dir;
createVehicleCrew _plane;
private _pilot = currentPilot _plane;
private _grp = group _pilot;
_grp deleteGroupWhenEmpty TRUE;
_plane setVelocityModelSpace [0,100,0];
_grp setBehaviourStrong "CARELESS";
{_plane disableAi _x} count ["TARGET","AUTOTARGET"];
_grp allowFleeing 0;
_grp spawn {waitUntil {sleep 2; isNull _this or units _this findif {isNull objectParent _x} >-1}; {deleteVehicle _x} count units _this};
_plane flyInHeightASL [_height,_height,_height];
private _wpt = _grp addWaypoint [_end, 0];
_wpt setWaypointType "MOVE";
_wpt setWaypointSpeed _speed;
_wpt setWaypointStatements [
 "true",
 "private _grp = group this;  
 if (local _grp) then  
 {
  private _plane = vehicle this;  
  { _plane deleteVehicleCrew _x } forEach crew _plane;  
  deleteVehicle _plane;
 }"
];
};

This code is a customized version of bis_fnc_ambientFlyby

Parameters are:

_start, _end, (positions)

_height (number)

_speed (string: "LIMITED", "NORMAL", FULL" as for  any waypoint)

_class (string: typeOf your aircraft)

 

Application:

place a marker (here named "endFlyby") as end of your flyby

place a trigger: NONE, NONE, repeatable, server only,  at start position

condition: isNil "coooolDown"

on activation: 0 = thisTrigger spawn {for "_i" from 0 to (1 + round random 3) do {[getpos _this, getMarkerpos "endFlyby", 200 +random 60, "LIMITED", "O_Plane_Fighter_02_F", EAST] call MGI_Flyby; sleep 1}; coooolDown = TRUE};

on deact. : coooolDown = nil;
and...

as countdown param min,mid, max as you wish for repeating the wave (in seconds!)

 

 

 

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Question. I am unable to put isNil "coooolDown"  in the condition.

  • Confused 1

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

×