Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New loadout approach #658

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 88 additions & 78 deletions Altis_Life.Altis/config/Config_Loadouts.hpp
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,78 +1,88 @@
/*
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,
// 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 Loadouts {
// COP
class WEST {
uniform[] = {
{"U_Rangemaster", "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"}
};
items[] = {};
linkedItems[] = {
{"ItemMap", "call life_copLevel >= 0"},
{"ItemCompass", "call life_copLevel >= 0"},
{"ItemWatch", "call life_copLevel >= 0"}
};
};

// 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", ""}
};
};

// 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 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
// 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

class lvl_X : lvl_0 { // where X is the level of the selected team and inherits from lvl_0
uniformClass = "";
backpack = "";
linkedItems[] = {};
weapons[] = {};
items[] = {};
magazines[] = {};
};
};
*/
class Loadouts {
// CIV
class CIV {
class lvl_0 {
uniformClass = "U_C_Poloshirt_blue";
backpack = "";
linkedItems[] = {"ItemMap" , "ItemCompass", "ItemWatch"};
weapons[] = {};
items[] = {};
magazines[] = {};
};
class lvl_1 : lvl_0 {
uniformClass = "U_C_Poloshirt_burgundy";
};
class lvl_2 : lvl_0 {
uniformClass = "U_C_Poloshirt_stripped";
};
class lvl_3 : lvl_0 {
uniformClass = "U_C_Poloshirt_tricolour";
};
class lvl_4 : lvl_0 {
uniformClass = "U_C_Poloshirt_salmon";
};
class lvl_5 : lvl_0 {
uniformClass = "U_C_Poloshirt_redwhite";
};
class lvl_6 : lvl_0 {
uniformClass = "U_C_Commoner1_1";
};
class lvl_arrested : lvl_0 {
uniformClass = "U_C_WorkerCoveralls"; // Arrested player's uniform
linkedItems[] = {};
};
};

Casperento marked this conversation as resolved.
Show resolved Hide resolved
// COP
class WEST {
class lvl_0 {
uniformClass = "U_Rangemaster";
backpack = "";
linkedItems[] = {"H_Cap_blk", "V_Rangemaster_belt", "ItemMap" , "ItemCompass", "ItemWatch"};
weapons[] = {"hgun_P07_snds_F"};
items[] = {};
magazines[] = {"16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag"};
};
class lvl_1 : lvl_0 {};
class lvl_2 : lvl_0 {};
class lvl_3 : lvl_0 {};
class lvl_4 : lvl_0 {};
class lvl_5 : lvl_0 {};
class lvl_6 : lvl_0 {};
class lvl_7 : lvl_0 {};
};

// MED
class GUER {
class lvl_0 {
uniformClass = "U_Rangemaster";
backpack = "";
linkedItems[] = {"H_Cap_red", "ItemMap" , "ItemCompass", "ItemWatch"};
weapons[] = {};
items[] = {"FirstAidKit", "FirstAidKit"};
magazines[] = {};
};
class lvl_1 : lvl_0 {};
class lvl_2 : lvl_0 {};
class lvl_3 : lvl_0 {};
class lvl_4 : lvl_0 {};
class lvl_5 : lvl_0 {};
};
};
109 changes: 28 additions & 81 deletions Altis_Life.Altis/core/functions/fn_startLoadout.sqf
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,81 +1,28 @@
#include "..\..\script_macros.hpp"
/*
File: fn_startLoadout.sqf
Author: Casperento

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);
};
};
};

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);
};
};
};

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);
};
};
};

[] call life_fnc_playerSkins;
[] call life_fnc_saveGear;
#include "..\..\script_macros.hpp"
/*
File: fn_startLoadout.sqf
Author: Casperento

Description:
Loads a custom loadout on player when he got a new life
*/
private _level = call {
Casperento marked this conversation as resolved.
Show resolved Hide resolved
if (playerSide isEqualTo civilian) exitWith {
if (life_is_arrested) then {
"arrested"
} else {
floor(random (count(missionConfigFile >> "Loadouts" >> str(playerSide))-1))
};
};
if (playerSide isEqualTo west) exitWith {
FETCH_CONST(life_coplevel)
};
if (playerSide isEqualTo independent) exitWith {
FETCH_CONST(life_mediclevel)
};
};

player setUnitLoadout (missionConfigFile >> "Loadouts" >> str(playerSide) >> format["lvl_%1",_level]);

[] call life_fnc_playerSkins;
[] call life_fnc_saveGear;