From c7adaf4dc2a9e39211fcecaa5f4f037e47ab3db2 Mon Sep 17 00:00:00 2001 From: Darrell Harvey Date: Sat, 23 Nov 2019 17:25:27 -0600 Subject: [PATCH] Added Heli CAS --- description.ext | 3 ++ editMe.sqf | 21 ++++++++------ score/functions/fn_support.sqf | 3 ++ supports/CommunicationMenu.h | 33 ++++++++++++++++++++++ supports/Functions.hpp | 1 + supports/functions/fn_heliCas.sqf | 46 +++++++++++++++++++++++++++++++ 6 files changed, 98 insertions(+), 9 deletions(-) create mode 100644 supports/functions/fn_heliCas.sqf diff --git a/description.ext b/description.ext index 2a6f5bb6..ae0eb00c 100644 --- a/description.ext +++ b/description.ext @@ -59,6 +59,9 @@ class CfgRemoteExec class supplyDrop {}; class support {}; class airStrike {}; + class pawneeCas {}; + class ghostHawkCas {}; + class blackfootCas {}; class ragePack {}; class say3DGlobal {}; class createBlur {}; diff --git a/editMe.sqf b/editMe.sqf index a3083bd3..4a76b9f6 100644 --- a/editMe.sqf +++ b/editMe.sqf @@ -97,15 +97,18 @@ HOSTILE_ARMOUR_POINT_SCORE = 4; /* Comment out or delete the below support items to prevent the player from buying them */ BULWARK_SUPPORTITEMS = [ - [800, "Recon UAV", "reconUAV"], - [1680, "Emergency Teleport", "telePlode"], - [1950, "Paratroopers", "paraDrop"], - [3850, "Missile CAS", "airStrike"], - [4220, "Mine Cluster Shell", "mineField"], - [4690, "Rage Stimpack", "ragePack"], - [5930, "Mind Control Gas", "mindConGas"], - [6666, "ARMAKART TM", "armaKart"], - [7500, "Predator Drone", "droneControl"] + [800, "Recon UAV", "reconUAV"], + [1680, "Emergency Teleport", "telePlode"], + [1950, "Paratroopers", "paraDrop"], + [3850, "Missile CAS", "airStrike"], + [4220, "Mine Cluster Shell", "mineField"], + [4690, "Rage Stimpack", "ragePack"], + [5000, "Helicopter CAS (Pawnee)", "pawneeCas"], + [5930, "Mind Control Gas", "mindConGas"], + [6666, "ARMAKART TM", "armaKart"], + [7500, "Helicopter CAS (Ghost Hawk)", "ghostHawkCas"], + [7500, "Predator Drone", "droneControl"], + [10000, "Helicopter CAS (Blackfoot)", "blackfootCas"] ]; /* Objects the Player can buy */ diff --git a/score/functions/fn_support.sqf b/score/functions/fn_support.sqf index 333b4ddf..c57460be 100644 --- a/score/functions/fn_support.sqf +++ b/score/functions/fn_support.sqf @@ -21,6 +21,9 @@ switch (_type) do { case ("airStrike"): { [_player, _target, _aircraft] call supports_fnc_airStrike; }; + case ("heliCas"): { + [_player, _aircraft] call supports_fnc_heliCas; + }; case ("ragePack"): { // Ragepack is a local effect so it needs to be executed locally [] remoteExec ["supports_fnc_ragePack", _player]; diff --git a/supports/CommunicationMenu.h b/supports/CommunicationMenu.h index 309445eb..b3ea0fb0 100644 --- a/supports/CommunicationMenu.h +++ b/supports/CommunicationMenu.h @@ -31,6 +31,39 @@ class airStrike removeAfterExpressionCall = 1; }; +class pawneeCas +{ + text = "Helicopter CAS (Pawnee)"; + submenu = ""; + expression = "[_this select 0, _this select 1, 'heliCas', 'B_Heli_Light_01_dynamicLoadout_F'] remoteExec ['killPoints_fnc_support', 2];"; + icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\cas_ca.paa"; + cursor = "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"; + enable = "1"; + removeAfterExpressionCall = 1; +}; + +class ghostHawkCas +{ + text = "Helicopter CAS (Ghost Hawk)"; + submenu = ""; + expression = "[_this select 0, _this select 1, 'heliCas', 'B_Heli_Transport_01_F'] remoteExec ['killPoints_fnc_support', 2];"; + icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\cas_ca.paa"; + cursor = "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"; + enable = "1"; + removeAfterExpressionCall = 1; +}; + +class blackfootCas +{ + text = "Helicopter CAS (Blackfoot)"; + submenu = ""; + expression = "[_this select 0, _this select 1, 'heliCas', 'B_Heli_Attack_01_dynamicLoadout_F'] remoteExec ['killPoints_fnc_support', 2];"; + icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\cas_ca.paa"; + cursor = "\a3\Ui_f\data\IGUI\Cfg\Cursors\iconCursorSupport_ca.paa"; + enable = "1"; + removeAfterExpressionCall = 1; +}; + class ragePack { text = "Rage Stimpack"; diff --git a/supports/Functions.hpp b/supports/Functions.hpp index 0ca54ac7..dae0687f 100644 --- a/supports/Functions.hpp +++ b/supports/Functions.hpp @@ -7,6 +7,7 @@ class supports class paraTroop {}; class reconUAV {}; class airStrike {}; + class heliCas {}; class ragePack {}; class armaKart {}; class mindConGas {}; diff --git a/supports/functions/fn_heliCas.sqf b/supports/functions/fn_heliCas.sqf new file mode 100644 index 00000000..6a6224b1 --- /dev/null +++ b/supports/functions/fn_heliCas.sqf @@ -0,0 +1,46 @@ +/** +* fn_heliCas +* +* Calls Helicopter CAS to provide support +* +* Domain: Server +**/ +params ["_player", "_aircraft"]; + + /** + I DID NOT CREATE A CLENUP FUNCTION FOR THIS SUPPORT + ALSO, YOU MAY WANT TO MAKE A TIME LIMIT FOR THIS SUPPORT. IT IS A BIT OP + **/ + +// Spawn CAS +_position = [[[position _player, 3500]],[]] call BIS_fnc_randomPos; +_veh = createVehicle [_aircraft,_position, [], 0, "FLY"]; +createVehicleCrew _veh; +_gunner = gunner _veh; + +_wp = (group _veh) addWaypoint [position _player, 0]; +_wp setWaypointCombatMode "RED"; +_wp setWaypointType "SAD"; + +while {alive _player && alive _gunner} do { + + { + _knownByPilot = (_gunner targetKnowledge _x) select 0; + _knownByPlayer = (_player targetKnowledge _x) select 0; + + if(!_knownByPilot && _knownByPlayer) then { + (group _gunner) reveal [_x, (_player knowsAbout _x)]; + }; + if(_knownByPilot && !_knownByPlayer) then { + (group _player) reveal [_x, (_gunner knowsAbout _x)]; + }; + } + forEach allUnits; + + sleep 3; + if(isNull assignedTarget _gunner) then { + _wp = (group _veh) addWaypoint [position _player, 0]; + _wp setWaypointCombatMode "RED"; + _wp setWaypointType "SAD"; + }; +};