Jump to content
Sign in to follow this  
cobra4v320

Fixed Wing Air Support Spawn then RTB

Recommended Posts

I’m using the fixed-wing support script below which works perfectly, but I’m also trying to create an RTB script but cannot figure out how to call it within this script.

The fixed wing script is being called by the BIS_ communications menu and I would like to call the RTB script through the BIS_communications menu as well.

//////////////////////////////////////////////////////////////////
// Created by: cobra4v320
//////////////////////////////////////////////////////////////////


waituntil {!isnil "bis_fnc_init"};

if (fixedActive) exitWith {hint "Fixed wing air support is unavailable!"};

if (ASFIX == ASnumFIX) then 
{

hint "You cannot call on this air asset anymore.";
exit1 = true
}; 

if (exit1) exitwith {fixedActive = false};

ASFIX = ASFIX + 1;

fixedActive = true;
publicVariable "fixedActive";

[color="Red"]_plane = _this select 0;[/color]

openMap [true,true];

["(Left click) on the map where you want the fixed wing air support.",0,.1,2,0,.4] call bis_fnc_dynamictext; 
_Fdrop = createMarkerLocal ["Fdrop", [0,0,0]];
_Fdrop setMarkerShapeLocal "ICON";
"Fdrop" setMarkerTypeLocal "hd_destroy";
"Fdrop" setMarkerColorLocal "ColorRed";
"Fdrop" setMarkerTextLocal "Fixed-wing support";
onMapSingleClick {'Fdrop' setMarkerPosLocal _pos, Fdropclick = true}; 
waitUntil {Fdropclick}; 
onMapSingleClick {}; 
Fdropclick = false;

openMap [false,false];


_Fdrop = getMarkerPos "Fdrop"; 
_spwn = getPosATL pad;
_gridPos = mapGridPosition _Fdrop; 

_westAircraft =
[ 
["FXD1","A10_US_EP1","A-10 Warthog"],
["FXD2","AV8B2","AV-8B Harrier"],
["FXD3","F35B", "F-35B Lightning"], 
["FXD4","GLT_Falcon_GBU","F-16 Falcon"]
]; 

_rnd = floor random count _westAircraft;
	[color="red"]_plane = createVehicle [(_westAircraft select _rnd) select 1, _spwn, [], 0, "FLY"];
		_varname = (_westAircraft select _rnd) select 0;
			_plane setVehicleVarName _varname;
				_plane Call Compile Format ["%1=_This ; PublicVariable ""%1""",_VarName];[/color]
					_plane setpos [(_spwn select 0),(_spwn select 1),(_spwn select 2)+200];
						_spwndir = [_plane, _Fdrop] call BIS_fnc_relativeDirTo; 
							_plane setdir _spwndir;
								_plane setVelocity [sin(_spwndir)*150,cos(_spwndir)*150,0]; 

_fixgrp = createGroup West; 
[_plane,_fixgrp,false,"","US_Soldier_Pilot_EP1"] call BIS_fnc_spawnCrew;

ROUGHRIDER sideChat format["Coordinates received, there is an %1 moving to position %2",(_westAircraft select _rnd) select 2, _gridPos];   

[_fixgrp, _Fdrop, 400, 7, "MOVE", "AWARE", "YELLOW", "FULL", "NO CHANGE", "", [0,0,0]] call CBA_fnc_taskPatrol;

_units = units _fixgrp;   

waitUntil 
{
_checkFIX = FALSE; 	
if (!alive _plane) then {_checkFIX = TRUE} else {_checkFIX = FALSE}; 	
if (getDammage _plane >= 0.8) then {_checkFIX = TRUE} else {_checkFIX = FALSE}; 	
if ((fuel _plane) <= 0.2 ) then {_checkFIX = TRUE} else {_checkFIX = FALSE};  	
if !(isengineon _plane) then {_checkFIX = TRUE} else {_checkFIX = FALSE}; 	
_checkFIX     
};   

ROUGHRIDER sidechat format["The %1 fixed-wing air support has been destroyed!", (_westAircraft select _rnd) select 2];

deleteMarkerLocal "Fdrop";  

sleep (60 + random 60);  

{deleteVehicle _x} forEach (_units)+[_plane]; deletegroup _fixgrp;  

fixedActive = false; 
publicVariable "fixedActive";

hint "Fixed wing Air Support is available."; 
sleep 4; 
hint "";

Here is the separate â€rtb.sqf†script I would like to run separately from the fixed wing script:

_plane = _this select 0;

_pilot = driver _veh;
_grp = group _pilot;


_rtbwp = _grp addWaypoint [getpos pad, 0];
_rtbwp setWaypointType "MOVE";
_rtbwp setWaypointSpeed "FULL";
_rtbwp setWaypointCombatMode "BLUE";
_rtbwp setWaypointCompletionRadius 50;
_grp setcurrentWaypoint _rtbwp;

ROUGHRIDER sideChat "The fixed-wing aircraft is returning to base";

waitUntil{(!alive _plane) or (moveToCompleted _pilot)};

sleep 1;
deleteVehicle _pilot;
deleteVehicle _plane;

if(true)exitwith{};

Here is the communications menu, and I’m not sure of how to call the RTB script from the line in red:

waituntil {!isnil "bis_fnc_init"};

[] call BIS_fnc_commsMenuCreate;

Ordinance_SUBMENU =
[
["Ordinance Menu",true],
["Missile Strike", [2], "", -5, [["expression", "nul=[laserTarget player, getpos missilestart,'M_Hellfire_AT',300]execVM 'support\ordinance\missile_support.sqf'"]], "1", "1"],
["Guided Bomb Strike", [3], "", -5, [["expression", "nul=[laserTarget player, getpos missilestart,'Bo_GBU12_LGB',250]execVM 'support\ordinance\gbomb_support.sqf'"]], "1", "1"]
];


Infantry_SUBMENU =
[
["Infantry Menu",true],
["Infantry (Airborne)", [2], "", -5, [["expression", "nul=[] execVM 'support\infantry\para_support.sqf'"]], "1", "1"],
["Infantry (Air Assault)", [3], "", -5, [["expression", "nul=[] execVM 'support\infantry\inf_support.sqf'"]], "1", "1"]
];

FixedWing_SUBMENU =
[
["Fixed-Wing Menu",true],
["Fixed-Wing (Station)", [2], "", -5, [["expression", "player sidechat ""this is Fixed (Station) WORK IN PROGRESS"" "]], "1", "1"],
["Fixed-Wing (CAS)", [3], "", -5, [["expression", "nul=[] execVM 'support\fixed\fixed_support.sqf'"]], "1", "1"],
[color="red"]["Fixed-Wing (RTB)", [4], "", -5, [["expression", "nul=[_plane] execVM 'support\fixed\rtb.sqf'"]], "1", "1"][/color]
];

RotorWing_SUBMENU =
[
["Rotor-Wing Menu",true],
["Rotor-Wing (Station)", [2], "", -5, [["expression", "player sidechat ""this is Rotor (Station) WORK IN PROGRESS"" "]], "1", "1"],
["Rotor-Wing (CAS)", [3], "", -5, [["expression", "nul=[] execVM 'support\rotor\rotor_support.sqf'"]], "1", "1"],
["Rotor-Wing (Transport)", [4], "", -5, [["expression", "nul=[] execVM 'support\transport\trans_support.sqf'"]], "1", "1"],
["Rotor-Wing (RTB)", [5], "", -5, [["expression", "player sidechat "" this is Rotor (RTB) WORK IN PROGRESS"" "]], "1", "1"]
];

Support_MAINMENU = 
[	
 	["Support Menu",false],
["Infantry Support", [2], "#USER:Infantry_SUBMENU", -5, [["expression", ""]], "1", "1"],
["Fixed-Wing Support", [3], "#USER:FixedWing_SUBMENU", -5, [["expression", ""]], "1", "1"],
["Rotor-Wing Support", [4], "#USER:RotorWing_SUBMENU", -5, [["expression", ""]], "1", "1"],
["Ordinance Support", [5], "#USER:Ordinance_SUBMENU", -5, [["expression", ""]], "1", "1"]

];

waituntil {!isnil "BIS_MENU_GroupCommunication"};
[bIS_MENU_GroupCommunication, ["Support Menu",[0],"#USER:Support_MAINMENU",-5,[["expression",""]],"1","1"]] call BIS_fnc_arrayPush;
showCommandingMenu "#USER:Support_MAINMENU";

Share this post


Link to post
Share on other sites

LOL, yeah I know about Drapers airsupport scripts , the entire point though is for me to learn how scripting works so I can make my own scripts. :)

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  

×