Skip to content

Instantly share code, notes, and snippets.

@jameslkingsley
Created February 5, 2017 20:13
Show Gist options
  • Save jameslkingsley/80384ac05033333bd0e4c9ff587f720e to your computer and use it in GitHub Desktop.
Save jameslkingsley/80384ac05033333bd0e4c9ff587f720e to your computer and use it in GitHub Desktop.
[{!isNil "arc_param_theme"}, {
private _unit = _this select 0;
if (!local _unit) exitWith {};
if (isPlayer _unit) exitWith {};
if (_unit getVariable ["ARC_assignedAIGear", false]) exitWith {};
private _isMan = _unit isKindOf "CAManBase";
private _side = side _unit;
private _faction = _side call ARC_fnc_getFactionFromSide;
if (!_isMan || !(_side in [west,east,resistance,civilian])) exitWith {};
private _enabled = if (arc_param_theme != "Default" && {getNumber (missionConfigFile >> "Header" >> "sandbox") == 1}) then {
(missionConfigFile >> "CfgSandboxThemes" >> arc_param_theme >> "AIGear" >> _faction >> "enabled") call ARC_fnc_getCfgBool;
} else {
(missionConfigFile >> "CfgARCMF" >> "ai" >> "gear" >> _faction >> "enabled") call ARC_fnc_getCfgBool;
};
if (!_enabled) exitWith {
// Fix for naked units bug in Zeus
[_unit, [_unit, "ARC_SavedInventory"]] call BIS_fnc_saveInventory;
[_unit, [_unit, "ARC_SavedInventory"]] call BIS_fnc_loadInventory;
_unit setVariable ["ARC_assignedAIGear_dummy", true, true];
};
_unit setVariable ["ARC_assignedAIGear", false, true];
switch (true) do {
case (random 1 < 0.7): {["r", _unit] call f_fnc_assignGear;};
case (random 1 < 0.2): {["ar", _unit] call f_fnc_assignGear;};
};
_unit setVariable ["ARC_assignedAIGear", true, true];
}, _this] call CBA_fnc_waitUntilAndExecute;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment