01-16-2015, 01:16 PM
(01-16-2015, 07:23 AM)Fuiba link Wrote: I do all the loadouts old school with the units' init-field. I just checked and noticed nothing out of the ordinary in 5's slot. Everything works well with the loadouts at my end. Any suggestions on how to make this piece of shit work since the Editor's Preview is next to useless?
I am not using the init fields anymore except for a few exceptions (like moveInCargo).
This is how I do it right now in init.sqf:
PHP Code:
/*
* Important!
* There is a small window were "isPlayer xxx" yields true on a dedicated, but
* "local xxx" on the server ALSO yields true. The player object stays on the server
* until the client has connected. The below makes sure that this script doesn't continue
* on the client's machine until the player is connected correctly.
*/
if (!isDedicated) then
{
  waitUntil {!(isNull player)};
  waitUntil {alive player};
};
/*
* Initialize the loadouts
* This array contains all my loadout scripts in the order that units appear in the mission.
* You can use other methods to determine a loadout, like class
*/
_loadouts = [
  "loadouts\ksk_tl.sqf",
  "loadouts\ksk_ar.sqf",
  "loadouts\ksk_sniper.sqf",
  "loadouts\ksk_at.sqf",
  "loadouts\ksk_medic.sqf",
  "loadouts\ksk_tl.sqf",
  "loadouts\ksk_ar.sqf",
  "loadouts\ksk_sab.sqf",
  "loadouts\ksk_gren.sqf",
  "loadouts\ksk_medic.sqf"
];
/*
* FHQ_fnc_safeAddLoadout is a function in the function module I use for every
* mission. See below
*/
{
  if (local _x) then {
    _loadout = _loadouts select _forEachIndex;
    [_x, _loadout] call FHQ_fnc_safeAddLoadout;
  };
} foreach playableUnits;
If you are not using custom functions in your mission, you can insert this at the top of your init.sqf:
PHP Code:
FHQ_fnc_safeAddLouadout = {
  _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;
  };
};
Hope this helps
I don't need luck, I have ammo.