Skip to content

Commit

Permalink
Added ability to allow loadouts to be altered for ai units (#1105)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBrostrom authored Mar 2, 2024
1 parent 6a76c24 commit 688beec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cScripts/cScripts_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@ private _cScriptSettings = "cScripts Mission Settings";
{},
true
] call CBA_fnc_addSetting;

[ // Ai setting
QEGVAR(Settings,AllowAILoadouts),
"CHECKBOX",
["AI Loadouts (Experimental)", "Allow gear system to apply loadouts to AI units as well as player."],
[_cScriptSettings, "1; Mission"],
false,
true,
{},
true
] call CBA_fnc_addSetting;

//2; Radios
[ // Enable
Expand Down
8 changes: 8 additions & 0 deletions cScripts/functions/gear/fn_gear_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ if (isClass (missionConfigFile >> "CfgLoadouts")) then {
) then {
private _loadout = [_unit] call EFUNC(gear,selectLoadout);
[_unit, _loadout] call EFUNC(gear,applyLoadout);
} else {
if (
EGVAR(Settings,AllowAILoadouts)
&& {typeOf _unit != "HeadlessClient_F"}
) then {
private _loadout = [_unit] call EFUNC(gear,selectLoadout);
[_unit, _loadout] call EFUNC(gear,applyLoadout);
};
};
};
}] call CBA_fnc_addClassEventHandler;
Expand Down

0 comments on commit 688beec

Please sign in to comment.