Jump to content
Sign in to follow this  
Lanzfeld

Looking For A Script Or Module For CAS

Recommended Posts

Can anyone recommend an easy to use script or module for an on call air asset? I am looking for an easy way to have an A-10 come to an area and loiter for awhile and do gun runs on spotted enemy. A cobra would be fine as well. Come to an area I call for and stay awhile to shoot stuff it sees with cannon and missles.

The Simple support module just does airstrikes and not really what I am looking for.

Many thanks

Share this post


Link to post
Share on other sites

You might take a look at this http://www.armaholic.com/page.php?id=8337

However I don't know if it does what you want. Looks interesting though.

Generally if you spawn an aircraft in the area, it will automatically attack targets of opportunity and may or may not hang around.

Share this post


Link to post
Share on other sites

Here is my Random Aircraft Spawn:

It will spawn whatever aircraft you want, helicopters or jets, then you can select whether they patrol or attack an area.

Execute with: _null = [West, "Heavy_Heli_WEST", 2, getmarkerpos "spawn", "Patrol", 350, 5] execVM "RAS.sqf";

This will spawn two west helicopters either 2 cobras or 2 apaches at a marker named spawn already on the map, they will then patrol the area you select on the map, the distance between waypoints is 350 and they will spawn in after a delay of 5 seconds.

Requires functions module on the map.

RAS.sqf

/*
   Random Aircraft Spawn: v.1.0
   Created by: cobra4v320 with Special Thanks to Twirly and Demonized for the help.

   Description: This will spawn in random aircraft based on side, the type of aircraft selected, and number of aircraft selected. The created vehicle(s) will either patrol or attack the selected position.

   Execute with:  _null = [West, "Heavy_Heli_WEST", 4, getmarkerpos "spawn", "Patrol", 350, 10] execVM "RAS.sqf";

   	Parameter(s):
_this select 0: the side on which to spawn the vehicle.
_this select 1: the type of vehicle to be spawned.
_this select 2: the number of units to be spawned.
_this select 3: the position to spawn the vehicle.
_this select 4: the type of move either - Patrol or ATTack.
_this select 5: the distance between waypoints.
_this select 6: the delay before the vehicle will be spawned.
*/

//Prepare variables
private ["_Light_Heli_East","_Heavy_Heli_East","_Fixed_Wing_East","_Light_Heli_West","_Heavy_Heli_West","_Fixed_Wing_West","_Light_Heli_Guer","_type","_grpvehs","_vehicle","_grp","_grpDir","_ArmaVersion","_side","_vehicletype","_spwnpos","_movepos","_movetype","_distance","_delay"];

// EDIT THESE VARIABLES TO CUSTOMIZE RAS. //

_ArmaVersion = 3; // what versions Arma used. 	0 = arma2 only.		1 = OA only. 	2 = Arma2 and OA. 	3 = Arma2/OA and BAF/PMC.

// DO NOT MODIFY BELOW THIS LINE. //

if (!isServer) exitWith {};

waituntil {!isnil "bis_fnc_init"};	// Is functions module ready?

if ((count _this) < 7) exitWith {hint "Script requires at least 7 parameters!"};	// Validate parameter count.

_side 		= _this select 0;
_vehicletype 	= _this select 1;
_maxUnits 	= _this select 2;
_spwnpos	= _this select 3;
_movetype	= _this select 4;
_distance 	= _this select 5;
_delay 		= _this select 6;

// initialize arrays.
_Light_Heli_East = [];
_Heavy_Heli_East = [];
_Fixed_Wing_East = [];
_Light_Heli_West = [];
_Heavy_Heli_West = [];
_Fixed_Wing_West = [];
_Light_Heli_Guer = [];
_type = "";

openMap true;

titleText ["(Left click) on the map where you want the vehicle to patrol.", "PLAIN"];

_mk1 = createMarker ["RAS_Marker", [0,0,0]];
_mk1 setMarkerShape "ICON";
"RAS_Marker" setMarkerType "hd_destroy";
"RAS_Marker" setMarkerColor "ColorRed";
"RAS_Marker" setMarkerText "Air Patrol Position";
onMapSingleClick {'RAS_Marker' setMarkerPos _pos, dropclick = true}; 
waitUntil {dropclick}; 
onMapSingleClick {}; 
dropclick = false;

_movepos = getmarkerpos "RAS_Marker";
_gridPos = mapGridPosition _movepos;
player sideChat format ["Coordinates received, %1 CAS is moving to position %2", _side, _gridPos];

sleep _delay;	// delay before spawning vehicle.

// array of available East Aircraft.
if (_side == East) then 
{
   if (_ArmaVersion == 0) then 
   {
       _Light_Heli_East = ["Mi17_INS","Mi17_rockets_RU"];
       _Heavy_Heli_East = ["Mi24_P","Mi24_V","Ka52","Ka52Black"];
       _Fixed_Wing_East = ["Su25_INS","Su34","Su39"];
   };
   if (_ArmaVersion == 1) then 
   {
       _Light_Heli_East = ["Mi17_TK_EP1","UH1H_TK_EP1"];
       _Heavy_Heli_East = ["Mi24_D_TK_EP1"];
       _Fixed_Wing_East = ["Su25_TK_EP1","L39_TK_EP1"];
   };
   if (_ArmaVersion == 2) then 
   {
       _Light_Heli_East = ["Mi17_INS","Mi17_rockets_RU","Mi17_TK_EP1","UH1H_TK_EP1"];
       _Heavy_Heli_East = ["Mi24_P","Mi24_V","Ka52","Ka52Black","Mi24_D_TK_EP1"];
       _Fixed_Wing_East = ["Su34","Su39","Su25_TK_EP1","L39_TK_EP1"];
   }; 
   if (_ArmaVersion == 3) then 
   {
       _Light_Heli_East = ["Mi17_INS","Mi17_rockets_RU","Mi17_TK_EP1","UH1H_TK_EP1"];
       _Heavy_Heli_East = ["Mi24_P","Mi24_V","Ka52","Ka52Black","Mi24_D_TK_EP1"];
       _Fixed_Wing_East = ["Su34","Su39","Su25_TK_EP1","L39_TK_EP1"];
   };
};

// array of available West Aircraft.
if (_side == West) then 
{
   if (_ArmaVersion == 0) then 
   {
       _Light_Heli_West = ["MH60S","UH1Y"];
       _Heavy_Heli_West = ["AH1Z","AH64D"];
       _Fixed_Wing_West = ["A10","F35B","AV8B2"];
   };
   if (_ArmaVersion == 1) then 
   {
      _Light_Heli_West = ["UH60M_EP1","AH6J_EP1","CH_47F_EP1"];
      _Heavy_Heli_West = ["AH64D_EP1"];
      _Fixed_Wing_West = ["A10_US_EP1"];
   };
   if (_ArmaVersion == 2) then 
   {
       _Light_Heli_West = ["MH60S","UH1Y","UH60M_EP1","AH6J_EP1","CH_47F_EP1"];
       _Heavy_Heli_West = ["AH1Z","AH64D","AH64D_EP1"];
       _Fixed_Wing_West = ["A10","F35B","AV8B2","A10_US_EP1"];
   }; 
   if (_ArmaVersion == 3) then 
   {
       _Light_Heli_West = ["MH60S","UH1Y","UH60M_EP1","AH6J_EP1","CH_47F_EP1","AW159_Lynx_BAF","BAF_Merlin_HC3_D","CH_47F_BAF"];
       _Heavy_Heli_West = ["AH1Z","AH64D","AH64D_EP1","BAF_Apache_AH1_D"];
       _Fixed_Wing_West = ["A10","F35B","AV8B2","A10_US_EP1"];
   };
};

// array of available Guer Aircraft.
if (_side == Resistance) then 
{
   if (_ArmaVersion == 1) then
   {
       _Light_Heli_Guer = ["Mi17_UN_CDF_EP1","UH1H_TK_GUE_EP1"];		
   };
   if (_ArmaVersion == 2) then 
   {
       _Light_Heli_Guer = ["Mi17_UN_CDF_EP1","UH1H_TK_GUE_EP1"];
   }; 
   if (_ArmaVersion == 3) then 
   {
       _Light_Heli_Guer = ["Mi17_UN_CDF_EP1","UH1H_TK_GUE_EP1","Ka60_GL_PMC","Ka60_PMC"];
   };
};

// select random vehicle based on type.
switch (_vehicletype) do 
{
   case "Heavy_Heli_WEST": 
   {
       _type = _Heavy_Heli_West select floor (random count _Heavy_Heli_West)
   };
   case "Heavy_Heli_EAST": 
   {
       _type = _Heavy_Heli_East select floor (random count _Heavy_Heli_East)
   };
   case "Light_Heli_WEST": 
   {
       _type = _Light_Heli_West select floor (random count _Light_Heli_West)
   };
   case "Light_Heli_EAST": 
   {
       _type = _Light_Heli_East select floor (random count _Light_Heli_East)
   };
   case "Fixed_Wing_WEST": 
   {
       _type = _Fixed_Wing_West select floor (random count _Fixed_Wing_West)
   };
   case "Fixed_Wing_EAST": 
   {
      _type = _Fixed_Wing_East select floor (random count _Fixed_Wing_East)
   };
   case "Light_Heli_GUER": 
   {
       _type = _Light_Heli_Guer select floor (random count _Light_Heli_Guer)
   };
};

_grp = createGroup _side;

if (_type isKindof "helicopter") then 
{
   for "_i" from 1 to _maxunits do 
   {
       _newVehicle = [_spwnpos, 180, _type, _grp] call BIS_fnc_spawnVehicle;			// creates the vehicle(s).
       _grp selectLeader ((units _grp) select 0);							// selects the group leader.
       _grpDir = getDir (vehicle (leader _grp));							// get direction of the leader.
       _vehicle = _newvehicle select 0;								// select the vehicle from the array.				
       _vehicle setPos [getPos _vehicle select 0, getPos _vehicle select 1, 150];			// sets the vehicles start height.
       _vehicle setVelocity [sin (_grpDir) * 80, cos (_grpDir) * 80, 0];				// sets the vehicles speed to 80.
       _vehicle flyinheight 100;									// tells the vehicle to fly at an altitude of 100.
       sleep 0.5;											// sleep so vehicles do not spawn on top of each other and crash.

   } foreach units _grp;
};

if (_type isKindof "plane") then 
{
   for "_i" from 1 to _maxunits do 
   {
       _newVehicle = [_spwnpos, 180, _type, _grp] call BIS_fnc_spawnVehicle;			// creates the vehicle(s).
       _grp selectLeader ((units _grp) select 0);							// selects the group leader.
       _grpDir = getDir (vehicle (leader _grp));							// get direction of the leader
       _vehicle = _newvehicle select 0;								// select the vehicle from the array.				
       _vehicle setPos [getPos _vehicle select 0, getPos _vehicle select 1, 400];			// sets the vehicles start height.
       _vehicle setVelocity [sin (_grpDir) * 150, cos (_grpDir) * 150, 0];				// sets the vehicles speed 150.
       _vehicle flyinheight 400;									// tells the vehicle to fly at an altitude of 400.
       sleep 0.5;											// sleep so vehicles do not spawn on top of each other and crash.

   } foreach units _grp;
};

switch (_movetype) do 
{										
   case "Patrol": 
   {
       [_grp, _movepos, _distance] call bis_fnc_taskPatrol; // Aircraft will cycle through waypoints.
   };
   case "Attack": 
   {
       [_grp, _movepos] call bis_fnc_taskAttack; // Aircraft will "SAD" at designated position.
   }; 					
};

{_x setBehaviour "COMBAT"; _x SetCombatMode "RED"; _x setSpeedMode "NORMAL"} foreach units _grp;  // set group behavior.

deleteMarker "RAS_Marker";	// deletes the marker.

// For debugging.
// hint format ["ArmA Version: %1\n Side: %2\n Type of Vehicle: %3\n # of units: %4\n Move Type: %5\n Waypoint Distance: %6\n  Delay: %7",_ArmaVersion, _side, typeof _vehicle, _maxUnits, _movetype, _distance, _delay];

Edited by cobra4v320

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  

×