-
Notifications
You must be signed in to change notification settings - Fork 313
New loadout approach #658
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
Open
Casperento
wants to merge
8
commits into
AsYetUntitled:master
Choose a base branch
from
Casperento:loadouts-change
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
New loadout approach #658
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
160a64c
first approach for new loadouts
Casperento 3b9e492
first suggestions and changes before testing
Casperento e1ef710
Fixed working stuff
Casperento 0fa097b
Random selected uniforms for civ
Casperento 82c572e
civRandomCloting and more..
Casperento b743295
clean startLoadout..
Casperento 3b57188
delete sweet whitespaces
Casperento 81b6196
Merge branch 'master-ayu' into loadouts-change
Jason2605 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
161 changes: 83 additions & 78 deletions
161
Altis_Life.Altis/config/Config_Loadouts.hpp
100755 → 100644
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,78 +1,83 @@ | ||
| /* | ||
| 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"} | ||
| }; | ||
| }; | ||
| }; | ||
| #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 | ||
| // 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 | ||
| 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[] = {}; | ||
| magazines[] = {}; | ||
| }; | ||
| class civ_level_arrested { // Arrested player's loadout | ||
| uniformClass = "U_C_WorkerCoveralls"; | ||
| backpack = ""; | ||
| linkedItems[] = {}; | ||
| weapons[] = {}; | ||
| items[] = {}; | ||
| magazines[] = {}; | ||
| }; | ||
|
|
||
| // 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 {}; | ||
|
|
||
| // EAST | ||
| class east_level_0 { | ||
| uniformClass = "U_C_Commoner1_1"; | ||
| backpack = ""; | ||
| linkedItems[] = {"ItemMap" , "ItemCompass", "ItemWatch"}; | ||
| weapons[] = {}; | ||
| items[] = {}; | ||
| magazines[] = {}; | ||
| }; | ||
| }; | ||
118 changes: 37 additions & 81 deletions
118
Altis_Life.Altis/core/functions/fn_startLoadout.sqf
100755 → 100644
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,81 +1,37 @@ | ||
| #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"}; | ||
| if (playerSide isEqualTo east) exitWith {"east"}; | ||
| }; | ||
|
|
||
| if (_side isEqualTo "civ") then { | ||
| if (life_is_arrested) exitWith { | ||
| player setUnitLoadout (missionConfigFile >> "Loadouts" >> "civ_level_arrested"); | ||
| }; | ||
|
|
||
| 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]; | ||
| }; | ||
| 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; | ||
| [] call life_fnc_saveGear; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.