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 4 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
147 changes: 69 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,69 @@
/*
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

// 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 {
// CIV
class civ_level_random {
uniformClass = "";
backpack = "";
linkedItems[] = {"ItemMap" , "ItemCompass", "ItemWatch"};
weapons[] = {};
items[] = {};
magazines[] = {};
};
class civ_level_arrested { // Arrested player's loadout
uniformClass = "U_C_WorkerCoveralls";
backpack = "";
linkedItems[] = {};
weapons[] = {};
items[] = {};
magazines[] = {};
};

Casperento marked this conversation as resolved.
Show resolved Hide resolved
// 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[] = {};
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 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 {};
};
130 changes: 49 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,49 @@
#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 _side = call {
if (playerSide isEqualTo civilian) exitWith {"civ"};
if (playerSide isEqualTo west) exitWith {"cop"};
if (playerSide isEqualTo independent) exitWith {"med"};
};

private _level = call {
Casperento marked this conversation as resolved.
Show resolved Hide resolved
if (_side isEqualTo "civ") exitWith {
if (life_is_arrested) then {
"arrested"
} else {
"random"
};
};
if (_side isEqualTo "cop") exitWith {
FETCH_CONST(life_coplevel)
};
if (_side isEqualTo "med") exitWith {
FETCH_CONST(life_mediclevel)
};
};

if (_side isEqualTo "civ" && _level isEqualTo "random") then {
private _civLoadout = getUnitLoadout (missionConfigFile >> "Loadouts" >> "civ_level_random");
private _arr = [
Casperento marked this conversation as resolved.
Show resolved Hide resolved
"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"
];
_civLoadout set [3, [(selectRandom _arr), []]];
Casperento marked this conversation as resolved.
Show resolved Hide resolved
player setUnitLoadout _civloadout;
} else {
player setUnitLoadout (missionConfigFile >> "Loadouts" >> format["%1_level_%2", _side, _level]);
};

[] call life_fnc_playerSkins;
[] call life_fnc_saveGear;