Skip to content

Commit 579d434

Browse files
authored
Helicopter Config Loadouts (#3423)
* added helicopter loadout support * Update fn_setPlaneLoadout.sqf
1 parent f415b30 commit 579d434

File tree

4 files changed

+68
-135
lines changed

4 files changed

+68
-135
lines changed

A3A/addons/config_fixes/RF/CfgVehicles.hpp

Lines changed: 3 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class CfgVehicles
1616
class B_Heli_EC_04_military_rf;
1717
class B_Heli_EC_03_rf;
1818
class I_Pickup_aat_rf;
19+
class B_Heli_light_03_dynamicLoadout_rf;
20+
class Heli_EC_02_base_rf;
1921

2022
class a3a_armored_Pickup_rf : I_G_Pickup_rf {
2123
animationList[] = {"hide_bullbar",0.2,"hide_fuel_tank",1,"hide_snorkel",1,"hide_antenna",1,"hide_trunk_cover",1,"hide_trunk_door",0,"trunk_door_open",0,"hide_armor_window_armor_top",0,"window_armor_hatch_L_rot",1,"window_armor_hatch_R_rot",0,"door_F_L_open",0,"door_F_R_open",0,"door_R_L_open",0,"door_R_R_open",0,"hide_rack",1,"hide_rack_spotlights",1,"hide_frame",1,"hide_sidesteps",0.5};
@@ -113,64 +115,7 @@ class CfgVehicles
113115
textureList[] = {};
114116
hiddenSelectionstextures[] = {"\lxRF\vehicles_rf\pickup_01\Data\pickup_01_ext_gendarmerie_co.paa","\lxRF\vehicles_rf\pickup_01\Data\pickup_01_adds_gendarmerie_co.paa","\lxrf\vehicles_rf\pickup_01\data\pickup_01_ext2_co.paa","\lxrf\vehicles_rf\pickup_01\data\pickup_01_AAT_olive_co.paa","\lxrf\vehicles_rf\pickup_01\data\pickup_01_Launcher_black_co.paa","\lxRF\vehicles_rf\pickup_01\Data\pickup_01_service_gendarmerie_co.paa"};
115117
};
116-
117-
class Heli_light_03_dynamicLoadout_base_F: Heli_light_03_base_F {
118-
class Components;
119-
};
120-
class B_Heli_light_03_dynamicLoadout_rf: Heli_light_03_dynamicLoadout_base_F {
121-
class Components : Components {
122-
class TransportPylonsComponent;
123-
};
124-
};
125-
class a3a_Heli_light_03_dynamicLoadout_rf : B_Heli_light_03_dynamicLoadout_rf { // !!!! This is the Olive paint by default. It's more of a bluish-gray though
126-
class Components : Components {
127-
class TransportPylonsComponent : TransportPylonsComponent {
128-
class Presets {
129-
class Default {
130-
attachment[] = {"PylonRack_19Rnd_missiles_gray_RF","PylonWeapon_1000Rnd_20x102mm_shells_gray_RF","PylonRack_19Rnd_missiles_gray_RF","PylonWeapon_1000Rnd_20x102mm_shells_gray_RF"};
131-
displayName = "Default";
132-
};
133-
class Empty {
134-
attachment[] = {};
135-
displayName = "Empty";
136-
};
137-
};
138-
class Pylons {
139-
class PylonLeft1 {
140-
attachment = "PylonRack_19Rnd_missiles_gray_RF";
141-
hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"};
142-
priority = 5;
143-
turret[] = {0};
144-
UIposition[] = {"0.06 + 0.02",0.4};
145-
};
146-
class PylonLeft2 {
147-
attachment = "PylonWeapon_1000Rnd_20x102mm_shells_gray_RF";
148-
hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"};
149-
priority = 4;
150-
turret[] = {0};
151-
UIposition[] = {"0.08 + 0.02",0.35};
152-
};
153-
class PylonRight1 {
154-
attachment = "PylonRack_19Rnd_missiles_gray_RF";
155-
hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"};
156-
priority = 5;
157-
mirroredMissilePos = 1;
158-
turret[] = {0};
159-
UIposition[] = {"0.59 + 0.04",0.4};
160-
};
161-
class PylonRight2 {
162-
attachment = "PylonWeapon_1000Rnd_20x102mm_shells_gray_RF";
163-
hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"};
164-
priority = 4;
165-
mirroredMissilePos = 2;
166-
turret[] = {0};
167-
UIposition[] = {"0.57 + 0.04",0.35};
168-
};
169-
170-
};
171-
};
172-
};
173-
};
118+
class a3a_Heli_light_03_dynamicLoadout_rf : B_Heli_light_03_dynamicLoadout_rf {};
174119
class a3a_AAF_Heli_light_03_dynamicLoadout_rf : a3a_Heli_light_03_dynamicLoadout_rf {
175120
textureList[] = {};
176121
hiddenSelectionsTextures[] = {"\A3\Air_F_EPB\Heli_Light_03\data\Heli_Light_03_base_INDP_CO.paa","\lxRF\air_rf\Heli_Light_03\data\wildcat_addons_INDP_co.paa"};
@@ -208,65 +153,11 @@ class CfgVehicles
208153
hiddenSelectionsTextures[] = {"\lxRF\air_rf\Heli_Light_03\data\Heli_Light_03_base_tan_CO.paa","\lxRF\air_rf\Heli_Light_03\data\wildcat_addons_tan_co.paa"};
209154
};
210155

211-
class Heli_EC_02_base_rf: Heli_EC_01_base_rf {
212-
class Components;
213-
};
214156
class a3a_Heli_EC_02_rf : Heli_EC_02_base_rf { // Default camo is a lovely tan, perfect for patrolling your local desert
215157
scope = 2;
216158
faction = "IND_F";
217159
side = 2;
218160
hiddenSelectionsTextures[] = {"\lxRF\air_rf\heli_medium_ec\data\as332_exterior_09_tan_co.paa","\lxRF\air_rf\heli_medium_ec\data\as332_int_cargo_co.paa","#(rgb,1024,1024,1)ui('lxRF_MFDMinimap','lxRF_MFDMinimap')","\lxRF\air_rf\heli_medium_ec\data\as332_adds_09_tan_co.paa","\lxRF\air_rf\heli_medium_ec\data\as332_exterior_09_tan_co.paa","\lxRF\air_rf\heli_medium_ec\data\as332_int_cargo_co.paa"};
219-
class Components : Components {
220-
class TransportPylonsComponent {
221-
uiPicture = "\lxRF\air_rf\heli_medium_ec\data\UI\heli_medium_ec_02_3DEN_CA.paa";
222-
class Presets {
223-
class AT {
224-
attachment[] = {"PylonRack_4Rnd_LG_scalpel","PylonRack_4Rnd_LG_scalpel","PylonRack_4Rnd_LG_scalpel","PylonRack_4Rnd_LG_scalpel"};
225-
displayName = "AT";
226-
};
227-
class Default {
228-
attachment[] = {"PylonRack_19Rnd_missiles_olive_rf","PylonRack_4Rnd_LG_scalpel","PylonRack_4Rnd_LG_scalpel","PylonRack_19Rnd_missiles_olive_rf"};
229-
displayName = "Default";
230-
};
231-
class Empty {
232-
attachment[] = {};
233-
displayName = "Empty";
234-
};
235-
};
236-
class Pylons {
237-
class PylonLeft1 {
238-
attachment = "PylonRack_19Rnd_missiles_olive_RF";
239-
hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"};
240-
priority = 5;
241-
turret[] = {0};
242-
UIposition[] = {0.06,0.4};
243-
};
244-
class PylonLeft2 {
245-
attachment = "PylonRack_4Rnd_LG_scalpel";
246-
hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"};
247-
priority = 4;
248-
turret[] = {0};
249-
UIposition[] = {0.08,0.35};
250-
};
251-
class PylonRight1 {
252-
attachment = "PylonRack_4Rnd_LG_scalpel";
253-
hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"};
254-
priority = 5;
255-
mirroredMissilePos = 2;
256-
turret[] = {0};
257-
UIposition[] = {0.57,0.35};
258-
};
259-
class PylonRight2 {
260-
attachment = "PylonRack_19Rnd_missiles_olive_RF";
261-
hardpoints[] = {"DAR","DAGR","B_SHIEKER","UNI_SCALPEL","20MM_TWIN_CANNON","B_ASRRAM_EJECTOR","WEAPON_PODS_RF","B_BOMB_PYLON"};
262-
priority = 4;
263-
mirroredMissilePos = 1;
264-
turret[] = {0};
265-
UIposition[] = {0.59,0.4};
266-
};
267-
};
268-
};
269-
};
270161
};
271162
class a3a_LDF_Heli_EC_02_rf : a3a_Heli_EC_02_rf {
272163
factions = "IND_E_F";
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include "..\..\..\script_component.hpp"
2+
3+
class CfgPatches
4+
{
5+
class PATCHNAME(AirLoadout_RF)
6+
{
7+
name = COMPONENT_NAME;
8+
units[] = {};
9+
weapons[] = {};
10+
requiredVersion = REQUIRED_VERSION;
11+
requiredAddons[] = {"RF_Vehicles"};
12+
skipWhenMissingDependencies = 1;
13+
author = AUTHOR;
14+
authors[] = { AUTHORS };
15+
authorUrl = "";
16+
VERSION_CONFIG;
17+
};
18+
};
19+
20+
class A3A {
21+
class Loadouts
22+
{
23+
class Helicopter
24+
{
25+
class baseHelicopter;
26+
class a3a_Heli_light_03_dynamicLoadout_rf : baseHelicopter {
27+
loadout[] = {"PylonRack_19Rnd_missiles_gray_RF","PylonWeapon_1000Rnd_20x102mm_shells_gray_RF","PylonRack_19Rnd_missiles_gray_RF","PylonWeapon_1000Rnd_20x102mm_shells_gray_RF"};
28+
};
29+
class a3a_Heli_EC_02_rf : baseHelicopter {
30+
loadout[] = {"PylonRack_19Rnd_missiles_olive_RF","PylonRack_4Rnd_LG_scalpel","PylonRack_4Rnd_LG_scalpel","PylonRack_19Rnd_missiles_olive_RF"};
31+
};
32+
class a3a_AAF_Heli_light_03_dynamicLoadout_rf : a3a_Heli_light_03_dynamicLoadout_rf {};
33+
class a3a_LDF_Heli_light_03_dynamicLoadout_rf : a3a_Heli_light_03_dynamicLoadout_rf {};
34+
class a3a_black_Heli_light_03_dynamicLoadout_rf : a3a_Heli_light_03_dynamicLoadout_rf {};
35+
class a3a_tan_Heli_light_03_dynamicLoadout_rf : a3a_Heli_light_03_dynamicLoadout_rf {};
36+
class a3a_green_Heli_light_03_dynamicLoadout_rf : a3a_Heli_light_03_dynamicLoadout_rf {};
37+
class a3a_LDF_Heli_EC_02_rf : a3a_Heli_EC_02_rf {};
38+
class a3a_AAF_Heli_EC_02_rf : a3a_Heli_EC_02_rf {};
39+
class a3a_black_Heli_EC_02_rf : a3a_Heli_EC_02_rf {};
40+
class a3a_sfia_Heli_EC_02_rf : a3a_Heli_EC_02_rf {};
41+
};
42+
};
43+
};

A3A/addons/core/functions/AI/fn_attackHeli.sqf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Persistent AI script to make enemy attack helis behave better
22
Prevents helis giving enemies an easy kill on the first pass, and hovering once they run out of targets
3-
3+
Also gives the heli a custom loadout if it exists
44
Scope: Server or HC
55
Environment: Spawned
66
@@ -19,9 +19,9 @@ Arguments:
1919
FIX_LINE_NUMBERS()
2020

2121
params ["_vehicle", "_group", "_targPos"];
22-
2322
// Set script handle so abort routines can remove it later
2423
_group setVariable ["A3A_AIScriptHandle", _thisScript];
24+
[_vehicle, "HELICOPTER"] call A3A_fnc_setPlaneLoadout;
2525

2626
while {count waypoints _group > 0} do { deleteWaypoint [_group, 0] };
2727
_group setBehaviourStrong "COMBAT";

A3A/addons/core/functions/Base/fn_setPlaneLoadout.sqf

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,48 @@ params ["_plane", "_type"];
33
/* Equips a plane with the needed loadout
44
Params:
55
_plane: OBJECT : The actual plane object
6-
_type: STRING : The type of attack plane, either "CAS" or "AA"
6+
_type: STRING : The type of attack plane, either "CAS" or "AA" or "HELICOPTER"
77
Returns:
88
Nothing
99
*/
1010
#include "..\..\script_component.hpp"
1111
FIX_LINE_NUMBERS()
1212

1313
private _loadout = [];
14-
15-
if (_type == "CAS") then
14+
private _configType = switch (_type) do
1615
{
17-
private _configPath = configFile >> "A3A" >> "Loadouts" >> "CASPlane" >> typeOf _plane;
16+
case "CAS": {"CASPlane"};
17+
case "AA": {"CAPPlane"};
18+
case "HELICOPTER": {"Helicopter"};
19+
default {"None"}
20+
};
21+
22+
if (_configType == "None") exitWith {
23+
Error_1("Invalid type - Entry in ['CAS','AA','HELICOPTER'] expected - %1 recieved", typeOf _plane);
24+
};
25+
26+
private _configPath = configFile >> "A3A" >> "Loadouts" >> _configType >> typeOf _plane;
1827

19-
if(isNull _configPath) then {
20-
Error_1("%1 has no loadout set", typeOf _plane);
21-
};
28+
if (isNull _configPath) exitWith {
29+
Debug_1("%1 has no loadout set, exiting", typeOf _plane);
30+
};
2231

23-
_loadout = getArray(_configPath >> "loadout");
32+
_loadout = getArray(_configPath >> "loadout");
2433

34+
if (_type == "CAS") then {
2535
_plane setVariable ["mainGun", getArray(_configPath >> "mainGun") select 0];
2636
_plane setVariable ["rocketLauncher", getArray(_configPath >> "rocketLauncher")];
2737
_plane setVariable ["missileLauncher", getArray(_configPath >> "missileLauncher")];
2838

2939
_plane setVariable ["bombRacks", getArray(_configPath >> "bombRacks")];
3040
_plane setVariable ["diveParams", getArray(_configPath >> "diveParams")];
31-
32-
[_plane, _type] call (compile (getText(_configPath >> "code")));
3341
};
34-
if (_type == "AA") then
35-
{
36-
private _configPath = configFile >> "A3A" >> "Loadouts" >> "CAPPlane" >> typeOf _plane;
3742

38-
if(isNull _configPath) then {
39-
Error_1("%1 has no loadout set", typeOf _plane);
40-
};
41-
42-
_loadout = getArray(_configPath >> "loadout");
43-
[_plane, _type] call (compile (getText(_configPath >> "code")));
44-
};
43+
[_plane, _type] call (compile (getText(_configPath >> "code")));
4544

4645
if !(_loadout isEqualTo []) then
4746
{
48-
Debug("Selected new loadout for plane, now equiping plane with it");
47+
Debug("Selected new loadout for %1, now equipping %2 with it",typeOf _plane, _plane);
4948
{
5049
_plane setPylonLoadout [_forEachIndex + 1, _x, true];
5150
_plane setVariable ["loadout", _loadout];

0 commit comments

Comments
 (0)