diff --git a/Altis_Life.Altis/config/Config_Loadouts.hpp b/Altis_Life.Altis/config/Config_Loadouts.hpp index 835338504..af01f9bf2 100644 --- a/Altis_Life.Altis/config/Config_Loadouts.hpp +++ b/Altis_Life.Altis/config/Config_Loadouts.hpp @@ -1,85 +1,83 @@ +#define true 1 +#define false 0 /* class PLAYERSIDE { // PLAYERSIDE can be: WEST (for cops), CIV (for civ/reb), GUER (for medics), EAST (for opfor) // NOTES: // empty array means that nothing will be add on players - // if you put more than a uniform on the CIV's class, they will be selected randonly, + // CIV's loadout are selected randonly if he is not in jail, // otherwise, for the other teams, player will get the uniform related to his level - itemType[] = { // itemType can be: uniform, headgear, vest, backpack, weapon, items or linkedItems - { "classname", "conditions" } + // Unit Loadout Array detailed information: https://community.bistudio.com/wiki/Unit_Loadout_Array + class side_level_X : side_level_0 { // where side can be: civ, cop or med. And X is a level number of the given side + uniformClass = ""; + backpack = ""; + linkedItems[] = {}; + weapons[] = {}; + items[] = {}; + magazines[] = {}; }; }; */ class Loadouts { - // COP - class WEST { - uniform[] = { - {"U_Rangemaster", "call life_copLevel >= 0"} - }; - headgear[] = { - {"H_Cap_blk", "call life_copLevel >= 0"} - }; - vest[] = { - {"V_Rangemaster_belt", "call life_copLevel >= 0"} - }; - backpack[] = {}; - weapon[] = { - {"hgun_P07_snds_F", "call life_copLevel >= 0"} - }; - mags[] = { - {"16Rnd_9x21_Mag", 6, "call life_copLevel >= 0"} - }; + // CIV + civilian_randomClothing = true; // true: select a random uniform from 'civRandomClothing' and adds into 'civ_level_random' class - false: use 'civ_level_random' class as it is + civRandomClothing[] = {"U_C_Poloshirt_blue", "U_C_Poloshirt_burgundy", "U_C_Poloshirt_stripped", "U_C_Poloshirt_tricolour", "U_C_Poloshirt_salmon", "U_C_Poloshirt_redwhite", "U_C_Commoner1_1"}; // Clothes that a civilian can spawn with + class civ_level_random { + uniformClass = "U_C_Commoner1_1"; + backpack = ""; + linkedItems[] = {"ItemMap" , "ItemCompass", "ItemWatch"}; + weapons[] = {}; items[] = {}; - linkedItems[] = { - {"ItemMap", "call life_copLevel >= 0"}, - {"ItemCompass", "call life_copLevel >= 0"}, - {"ItemWatch", "call life_copLevel >= 0"} - }; + magazines[] = {}; + }; + class civ_level_arrested { // Arrested player's loadout + uniformClass = "U_C_WorkerCoveralls"; + backpack = ""; + linkedItems[] = {}; + weapons[] = {}; + items[] = {}; + magazines[] = {}; }; - // CIV - class CIV { - uniform[] = { - {"U_C_Poloshirt_blue", "!life_is_arrested"}, - {"U_C_Poloshirt_burgundy", "!life_is_arrested"}, - {"U_C_Poloshirt_stripped", "!life_is_arrested"}, - {"U_C_Poloshirt_tricolour", "!life_is_arrested"}, - {"U_C_Poloshirt_salmon", "!life_is_arrested"}, - {"U_C_Poloshirt_redwhite", "!life_is_arrested"}, - {"U_C_Commoner1_1", "!life_is_arrested"} - }; - headgear[] = {}; - vest[] = {}; - backpack[] = {}; - weapon[] = {}; - mags[] = {}; + // COP + class cop_level_0 { + uniformClass = "U_Rangemaster"; + backpack = ""; + linkedItems[] = {"H_Cap_blk", "V_Rangemaster_belt", "ItemMap" , "ItemCompass", "ItemWatch"}; + weapons[] = {"hgun_P07_snds_F"}; items[] = {}; - linkedItems[] = { - {"ItemMap", ""}, - {"ItemCompass", ""}, - {"ItemWatch", ""} - }; + magazines[] = {"16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag"}; }; + class cop_level_1 : cop_level_0 {}; + class cop_level_2 : cop_level_0 {}; + class cop_level_3 : cop_level_0 {}; + class cop_level_4 : cop_level_0 {}; + class cop_level_5 : cop_level_0 {}; + class cop_level_6 : cop_level_0 {}; + class cop_level_7 : cop_level_0 {}; // MED - class GUER { - uniform[] = { - {"U_Rangemaster", "call life_medicLevel >= 1"} - }; - headgear[] = { - {"H_Cap_red", "call life_medicLevel >= 1"} - }; - vest[] = {}; - backpack[] = {}; - weapon[] = {}; - mags[] = {}; - items[] = { - {"FirstAidKit", 2, "call life_medicLevel >= 1"} - }; - linkedItems[] = { - {"ItemMap", "call life_medicLevel >= 1"}, - {"ItemCompass", "call life_medicLevel >= 1"}, - {"ItemWatch", "call life_medicLevel >= 1"} - }; + class med_level_0 { + uniformClass = "U_Rangemaster"; + backpack = ""; + linkedItems[] = {"H_Cap_red", "ItemMap" , "ItemCompass", "ItemWatch"}; + weapons[] = {}; + items[] = {"FirstAidKit", "FirstAidKit"}; + magazines[] = {}; + }; + class med_level_1 : med_level_0 {}; + class med_level_2 : med_level_0 {}; + class med_level_3 : med_level_0 {}; + class med_level_4 : med_level_0 {}; + class med_level_5 : med_level_0 {}; + + // EAST + class east_level_0 { + uniformClass = "U_C_Commoner1_1"; + backpack = ""; + linkedItems[] = {"ItemMap" , "ItemCompass", "ItemWatch"}; + weapons[] = {}; + items[] = {}; + magazines[] = {}; }; }; diff --git a/Altis_Life.Altis/core/functions/fn_startLoadout.sqf b/Altis_Life.Altis/core/functions/fn_startLoadout.sqf old mode 100755 new mode 100644 index be48dfee6..d7f6b2859 --- a/Altis_Life.Altis/core/functions/fn_startLoadout.sqf +++ b/Altis_Life.Altis/core/functions/fn_startLoadout.sqf @@ -6,84 +6,31 @@ Description: Loads a custom loadout on player when he got a new life */ -private _pUniform = M_CONFIG(getArray,"Loadouts",str(playerSide),"uniform"); -private _pHeadgear = M_CONFIG(getArray,"Loadouts",str(playerSide),"headgear"); -private _pVest = M_CONFIG(getArray,"Loadouts",str(playerSide),"vest"); -private _pBackpack = M_CONFIG(getArray,"Loadouts",str(playerSide),"backpack"); -private _pWeapon = M_CONFIG(getArray,"Loadouts",str(playerSide),"weapon"); -private _pMagazines = M_CONFIG(getArray,"Loadouts",str(playerSide),"mags"); -private _pItems = M_CONFIG(getArray,"Loadouts",str(playerSide),"items"); -private _linkedItems = M_CONFIG(getArray,"Loadouts",str(playerSide),"linkedItems"); - -if !(_pUniform isEqualTo []) then { - if (playerSide isEqualTo civilian) then { - _pUniform = selectRandom _pUniform; - if (!(_pUniform isEqualTo []) && {!((_pUniform select 0) isEqualTo "") && {([(_pUniform select 1)] call life_fnc_levelCheck)}}) then { - player forceAddUniform (_pUniform select 0); - }; - } else { - _pUniform apply { - if (!(_x isEqualTo []) && {!((_x select 0) isEqualTo "") && {([(_x select 1)] call life_fnc_levelCheck)}}) then { - player forceAddUniform (_x select 0); - }; - }; - }; -}; - -if !(_pHeadgear isEqualTo []) then { - _pHeadgear apply { - if (!(_x isEqualTo []) && {!((_x select 0) isEqualTo "") && {([(_x select 1)] call life_fnc_levelCheck)}}) then { - player addHeadgear (_x select 0); - }; - }; +private _side = call { + if (playerSide isEqualTo civilian) exitWith {"civ"}; + if (playerSide isEqualTo west) exitWith {"cop"}; + if (playerSide isEqualTo independent) exitWith {"med"}; + if (playerSide isEqualTo east) exitWith {"east"}; }; -if !(_pVest isEqualTo []) then { - _pVest apply { - if (!(_x isEqualTo []) && {!((_x select 0) isEqualTo "") && {([(_x select 1)] call life_fnc_levelCheck)}}) then { - player addVest (_x select 0); - }; +if (_side isEqualTo "civ") then { + if (life_is_arrested) exitWith { + player setUnitLoadout (missionConfigFile >> "Loadouts" >> "civ_level_arrested"); }; -}; - -if !(_pBackpack isEqualTo []) then { - _pBackpack apply { - if (!(_x isEqualTo []) && {!((_x select 0) isEqualTo "") && {([(_x select 1)] call life_fnc_levelCheck)}}) then { - player addBackpack (_x select 0); - }; - }; -}; -if !(_pWeapon isEqualTo []) then { - _pWeapon apply { - if (!(_x isEqualTo []) && {!((_x select 0) isEqualTo "") && {([(_x select 1)] call life_fnc_levelCheck)}}) then { - player addWeapon (_x select 0); - }; + private _civLoadout = getUnitLoadout (missionConfigFile >> "Loadouts" >> "civ_level_random"); + if (getNumber(missionConfigFile >> "Loadouts" >> "civilian_randomClothing") isEqualTo 1) then { + private _arr = getArray(missionConfigFile >> "Loadouts" >> "civRandomClothing"); + (_civLoadout select 3) set [0, selectRandom _arr]; }; -}; - -if !(_pMagazines isEqualTo []) then { - _pMagazines apply { - if (!(_x isEqualTo []) && {!((_x select 0) isEqualTo "") && {((_x select 1) > 0) && {([(_x select 2)] call life_fnc_levelCheck)}}}) then { - player addMagazines [(_x select 0),(_x select 1)]; - }; - }; -}; - -if !(_pItems isEqualTo []) then { - _pItems apply { - if (!(_x isEqualTo []) && {!((_x select 0) isEqualTo "") && {((_x select 1) > 0) && {([(_x select 2)] call life_fnc_levelCheck)}}}) then { - for "_i" from 1 to (_x select 1) step 1 do {player addItem (_x select 0)}; - }; - }; -}; - -if !(_linkedItems isEqualTo []) then { - _linkedItems apply { - if (!(_x isEqualTo []) && {!((_x select 0) isEqualTo "") && {([(_x select 1)] call life_fnc_levelCheck)}}) then { - player linkItem (_x select 0); - }; + player setUnitLoadout _civLoadout; +} else { + private _level = call { + if (_side isEqualTo "cop") exitWith {FETCH_CONST(life_coplevel)}; + if (_side isEqualTo "med") exitWith {FETCH_CONST(life_mediclevel)}; + if (_side isEqualTo "east") exitWith {0}; }; + player setUnitLoadout (missionConfigFile >> "Loadouts" >> format["%1_level_%2", _side, _level]); }; [] call life_fnc_playerSkins;