Jump to content
ironhawx

Spawning an enemy air patrol?

Recommended Posts

Ok so i googled and searched even watched video, this is what i got and yet doesn't want to seem to work, maybe ive missed type something idk.  Any help would be appeciated trying to learn this so I can give our air team guys some aerial combat action but at certain time in the mission.

 

Basically i have a trigger when bluefor is present, act: nul = "airspawn.sqf"; hint "trigger fired";

 

The trigger is firing as the hint text will appear but the plane will not, this is the code from the sqf:
 

_crew1 = [];
_airframe1 = [];
 
if (isServer) then {
 
_crew1 = creategroup WEST;
_airframe1 = [getMarkerPos "marker1", 270, "FIR_F14D_MIKU", _crew1] call BIS_fnc_spawnVehicle;
 
_wp1 = _crew1 addWaypoint [(getMarkerPos "marker2"), 0];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointSpeed "NORMAL";
 
_wp2 = _crew1 addWaypoint [(getMarkerPos "marker3"), 0];
_wp2 setWaypointType "MOVE";
_wp2 setWaypointSpeed "NORMAL";
 
_wp3 = _crew1 addWaypoint[(getMarkerPos "marker4"), 0];
_wp3 setWaypointType "MOVE";
_wp3 setWaypointSpeed "NORMAL";
 
_wp4 = _crew1 addWaypoint [(getMarkerPos "marker5"), 0];
_wp4 setWaypointType "MOVE";
_wp4 setWaypointSpeed "NORMAL";
 
_wp5 = _crew1 addWaypoint [(getMarkerPos "marker6"), 0];
_wp5 setWaypointType "MOVE";
_wp5 setWaypointSpeed "NORMAL";
 
_wp6 = _crew1 addWaypoint [(getMarkerPos "marker7"), 0];
_wp6 setWaypointType "MOVE";
_wp6 setWaypointSpeed "NORMAL";
 
_wp7 = _crew1 addWaypoint [getMarkerPos "marker2"), 0];
_wp7 setWaypointType "CYCLE";
_wp7 setWaypointSpeed "NORMAL";
 
 
};

Share this post


Link to post
Share on other sites

 

Basically i have a trigger when bluefor is present, act: nul = "airspawn.sqf"; hint "trigger fired";

 

 

To execute a script use execVM:


nul = execVM "airspawn.sqf";

Enable showScriptErrors in your ARMA3 start-up params for better debugging. And check the session RPT file. More info on debugging

Share this post


Link to post
Share on other sites
if (isServer) then {

_crew1 = creategroup WEST;
_airframe1 = [getMarkerPos "marker1", 270, "FIR_F14D_MIKU", _crew1] call BIS_fnc_spawnVehicle;

_wps = [];
_index = 0;

{

    _wp = _crew1 addWaypoint [(getMarkerPos _x), 0];
    _wp setWaypointType "MOVE";
    _wp setWaypointSpeed "NORMAL";
    _index = _wps pushBack _wp;

} foreach ["marker2","marker3","marker4","marker5","marker6","marker7","marker2"];

_lastWP = _wps select _index;
 _lastWP setWaypointType "CYCLE";

};

Working fine here.

Are you sure you named those markers correctly, same for the aircrafts class name?

 

Cheers

Share this post


Link to post
Share on other sites
if (isServer) then {

_crew1 = creategroup WEST;
_airframe1 = [getMarkerPos "marker1", 270, "FIR_F14D_MIKU", _crew1] call BIS_fnc_spawnVehicle;

_wps = [];
_index = 0;

{

    _wp = _crew1 addWaypoint [(getMarkerPos _x), 0];
    _wp setWaypointType "MOVE";
    _wp setWaypointSpeed "NORMAL";
    _index = _wps pushBack _wp;

} foreach ["marker2","marker3","marker4","marker5","marker6","marker7","marker2"];

_lastWP = _wps select _index;
 _lastWP setWaypointType "CYCLE";

};

Working fine here.

Are you sure you named those markers correctly, same for the aircrafts class name?

 

Cheers

 

Ok mines working, so is yours though i don't understand how you consolidated it so will stick w/ my version for now i guess.  However I did find the problem seems to be w/ the class name, but that is the name it shows in top right corner of object when placing it in editor, i thought that was the class name as I can copy that text for other planes such as the a10 or the suhkoi from rhs and it spawns np, but w/ the f14 or the av8b harrier neither spawn.  Is there a sure way to find class names since obviously placing it in editor and copying the top rright info isn't.  Also this script is to be run on a dedicated server so I can't for life of me remember if it should be "isServer" or "isDedicated" to make sure script only runs once for everyone across server.

Share this post


Link to post
Share on other sites
 _rndPos = [[[_AOmarker, _radius],[]],["water","out"],[],{}] call BIS_fnc_randomPos; 
 _veh = createVehicle ["B_Heli_Light_01_armed_F",_rndPos,[],0,"FLY"]; 
 createVehicleCrew _veh;
 [group _veh, (_AOmarker), _radius] call BIS_fnc_taskPatrol; 

Where you need to replace _AOmaker with your marker name, the  _radius with your preferred radius of Patrol, and finally the classname of your air unit. Leave everything else as it is.

Share this post


Link to post
Share on other sites
 _rndPos = [[[_AOmarker, _radius],[]],["water","out"],[],{}] call BIS_fnc_randomPos; 
 _veh = createVehicle ["B_Heli_Light_01_armed_F",_rndPos,[],0,"FLY"]; 
 createVehicleCrew _veh;
 [group _veh, (_AOmarker), _radius] call BIS_fnc_taskPatrol; 

Where you need to replace _AOmaker with your marker name. and _radius with your preferred radius of Patrol. Leave everything else as it is.

 

seems ok i assume radius parameter is in meters?  also will this method work for jets?  while a cpl enemy helos are nice I prefer to give my fixed wing pilots something to chase after as well as have an immediate threat to them.  Thank you for the info either way.

Share this post


Link to post
Share on other sites

Hey ironhawk I don't know if you are done with your mission of script but this works very well DMC Air Patrol script. I have used it in a few mission.

Share this post


Link to post
Share on other sites

Hey ironhawk I don't know if you are done with your mission of script but this works very well DMC Air Patrol script. I have used it in a few mission.

seems legit, will have to check out though thing to be clear is any helpful scripts or scripting help need to function w/ jets.

Share this post


Link to post
Share on other sites

seems ok i assume radius parameter is in meters?  also will this method work for jets?  while a cpl enemy helos are nice I prefer to give my fixed wing pilots something to chase after as well as have an immediate threat to them.  Thank you for the info either way.

Yes Sir, It is in meters and will spawn jets or helis. Just remember to have your classnames correct and dont remove the "FLY" from it. It will avoid the vehicle from  spawning on the ground and any resultant explosion through collision. :)

 

Btw the credits to this snippet goes to JShock.

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

×