Skip to content

Commit

Permalink
first approach for new loadouts
Browse files Browse the repository at this point in the history
  • Loading branch information
Casperento authored and BoGuu committed May 2, 2020
1 parent 9d4ee25 commit 160a64c
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 118 deletions.
147 changes: 94 additions & 53 deletions Altis_Life.Altis/config/Config_Loadouts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,77 +2,118 @@
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, vest, backpack, weapon, items or linkedItems
{ "classname", "conditions" }
class lvl_X : lvl_base { // where X is a level of the selected team and inherits from lvl_base
uniformClass = "";
backpack = "";
linkedItems[] = {};
weapons[] = {};
items[] = {};
magazines[] = {};
};
};
*/
class lvl_base {
uniformClass = "";
backpack = "";
linkedItems[] = {"ItemMap","ItemCompass","ItemWatch"};
weapons[] = {};
items[] = {};
magazines[] = {};
};

class Loadouts {
// COP
class WEST {
uniform[] = {
{"U_Rangemaster", "call life_copLevel >= 0"}
// CIV
class CIV {
class lvl_arrested : lvl_base {
uniformClass = "U_C_WorkerCoveralls"; // Arrested player's uniform
linkedItems[] = {};
};
vest[] = {
{"V_Rangemaster_belt", "call life_copLevel >= 0"}
class lvl_1 : lvl_base {
uniformClass = "U_C_Poloshirt_blue";
};
backpack[] = {};
weapon[] = {
{"hgun_P07_snds_F", "call life_copLevel >= 0"}
class lvl_2 : lvl_base {
uniformClass = "U_C_Poloshirt_burgundy";
};
mags[] = {
{"16Rnd_9x21_Mag", 6, "call life_copLevel >= 0"}
class lvl_3 : lvl_base {
uniformClass = "U_C_Poloshirt_stripped";
};
items[] = {};
linkedItems[] = {
{"ItemMap", "call life_copLevel >= 0"},
{"ItemCompass", "call life_copLevel >= 0"},
{"ItemWatch", "call life_copLevel >= 0"}
class lvl_4 : lvl_base {
uniformClass = "U_C_Poloshirt_tricolour";
};
class lvl_5 : lvl_base {
uniformClass = "U_C_Poloshirt_salmon";
};
class lvl_6 : lvl_base {
uniformClass = "U_C_Poloshirt_redwhite";
};
class lvl_7 : lvl_base {
uniformClass = "U_C_Commoner1_1";
};
};

// 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"}
};
vest[] = {};
backpack[] = {};
weapon[] = {};
mags[] = {};
items[] = {};
linkedItems[] = {
{"ItemMap", ""},
{"ItemCompass", ""},
{"ItemWatch", ""}
// COP
class WEST {
class lvl_1 : lvl_base {
uniformClass = "U_Rangemaster";
weapons[] = {"hgun_P07_snds_F"};
magazines[] = {"16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag"};
};
class lvl_2 : lvl_base {
uniformClass = "U_Rangemaster";
weapons[] = {"hgun_P07_snds_F"};
magazines[] = {"16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag"};
};
class lvl_3 : lvl_base {
uniformClass = "U_Rangemaster";
weapons[] = {"hgun_P07_snds_F"};
magazines[] = {"16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag"};
};
class lvl_4 : lvl_base {
uniformClass = "U_Rangemaster";
weapons[] = {"hgun_P07_snds_F"};
magazines[] = {"16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag"};
};
class lvl_5 : lvl_base {
uniformClass = "U_Rangemaster";
weapons[] = {"hgun_P07_snds_F"};
magazines[] = {"16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag"};
};
class lvl_6 : lvl_base {
uniformClass = "U_Rangemaster";
weapons[] = {"hgun_P07_snds_F"};
magazines[] = {"16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag"};
};
class lvl_7 : lvl_base {
uniformClass = "U_Rangemaster";
weapons[] = {"hgun_P07_snds_F"};
magazines[] = {"16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag"};
};
};

// MED
class GUER {
uniform[] = {
{"U_Rangemaster", "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 lvl_1 : lvl_base {
uniformClass = "U_Rangemaster";
items[] = {"FirstAidKit"};
};
class lvl_2 : lvl_base {
uniformClass = "U_Rangemaster";
items[] = {"FirstAidKit"};
};
class lvl_3 : lvl_base {
uniformClass = "U_Rangemaster";
items[] = {"FirstAidKit"};
};
class lvl_4 : lvl_base {
uniformClass = "U_Rangemaster";
items[] = {"FirstAidKit"};
};
class lvl_5 : lvl_base {
uniformClass = "U_Rangemaster";
items[] = {"FirstAidKit"};
};
};
};
77 changes: 12 additions & 65 deletions Altis_Life.Altis/core/functions/fn_startLoadout.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,76 +6,23 @@
Description:
Loads a custom loadout on player when he got a new life
*/
private _pUniform = M_CONFIG(getArray,"Loadouts",str(playerSide),"uniform");
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 !(_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);
private _level = call {
if (playerSide isEqualTo civilian) exitWith {
if (life_is_arredted) then {
"arrested"
} else {
str(floor random [0, round(count(missionConfigFile >> "Loadouts" >> str(playerSide)-1)/2), count(missionConfigFile >> "Loadouts" >> str(playerSide))-1])
};
};
};

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 (playerSide isEqualTo west) exitWith {
str(FETCH_CONST(life_coplevel))
};
};

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);
};
if (playerSide isEqualTo independent) exitWith {
str(FETCH_CONST(life_mediclevel))
};
};

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 (missionConfigFile >> "Loadouts" >> str(playerSide) >> "lvl_"+_level);

[] call life_fnc_playerSkins;
[] call life_fnc_saveGear;
[] call life_fnc_saveGear;

0 comments on commit 160a64c

Please sign in to comment.