Handling loadout scripts that only run once:
I have a method of adding custom loadouts that is quite safe. I have the following script in a function module, but you can also use it with
FHQ_fnc_safeAddLoadout = compile preprocessFileLineNumbers "safeAddLoadout.sqf";
Use as
[this, "scripts\loadout.sqf"] call FHQ_fnc_safeAddLoadout;
from the init field or anywhere else (init.sqf etc). That also prevents them from being re-applied when JIPing or being revived. "scripts\loadout.sqf" is the name of the loadout script that is saved from FHQ Debug console or the Virtual Arsenal.
I have a method of adding custom loadouts that is quite safe. I have the following script in a function module, but you can also use it with
FHQ_fnc_safeAddLoadout = compile preprocessFileLineNumbers "safeAddLoadout.sqf";
Code:
_unit = _this select 0;
_scriptName = _this select 1;
if (!local _unit) exitWith {};
_isHandled = _unit getVariable "FHQ_loadout_handled";
 Â
if (isNil "_isHandled") then {
   Â
  _unit setVariable ["FHQ_loadout_handled", true, true];
 _unit call compile preprocessFileLineNumbers _scriptName;
};
Use as
[this, "scripts\loadout.sqf"] call FHQ_fnc_safeAddLoadout;
from the init field or anywhere else (init.sqf etc). That also prevents them from being re-applied when JIPing or being revived. "scripts\loadout.sqf" is the name of the loadout script that is saved from FHQ Debug console or the Virtual Arsenal.
I don't need luck, I have ammo.