Gear Loadouts

Gear Loadouts

« posted: Dec 16, 2018, 10:31 PM »
My contribution to the wasteland community. My loadout system based on the total money that player have at  ATM. And a second loadout (additional items) based on player score.

https://github.com/A3BadCompany/A3BC_Wasteland.Malden

Code: [Select]
// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
// @file Name: playerSetupGear.sqf
// @file Author: [GoT] JoSchaap, AgentRev
//      @file Modifications to LOADOUTS: [BC]CeccaTTo

private ["_player", "_bmoney", "_playerScore", "_uniform", "_headgear"];
_player = _this;
_bmoney = _player getVariable ["bmoney", 0];
_playerScore = (([_player, "playerKills"] call fn_getScore) - ([_player, "teamKills"] call fn_getScore));
_uniform = [_player, "uniform"] call getDefaultClothing;
_headgear = [_player, "headgear"] call getDefaultClothing;

if (_uniform != "") then { _player addUniform _uniform };
if (_headgear != "") then { _player addHeadgear _headgear };

sleep 0.1;

switch (true) do {
case (_bmoney >= 0 && _bmoney <= 499999): {//ACP-C2 .45 ACP + PDW2000 9mm
removeAllItems _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addVest "V_HarnessO_brn";
_player addBackpack "B_AssaultPack_mcamo";
_player addWeapon "Binocular";
_player addItem "FirstAidKit";
_player addItem "SmokeShell";
_player addMagazine "30Rnd_9x21_Mag";
_player addWeapon "hgun_PDW2000_F";
_player addMagazine "30Rnd_9x21_Mag";
_player addMagazine "30Rnd_9x21_Mag";
_player addMagazine "9Rnd_45ACP_Mag";
_player addWeapon "hgun_ACPC2_F";
_player addMagazine "9Rnd_45ACP_Mag";
_player addMagazine "9Rnd_45ACP_Mag";
};
case (_bmoney >= 500000 && _bmoney <= 999999): {//ACP-C2 .45 ACP + Vermin SMG .45 ACP
removeAllItems _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addVest "V_HarnessO_brn";
_player addBackpack "B_AssaultPack_mcamo";
_player addWeapon "Binocular";
_player addItem "FirstAidKit";
_player addItem "SmokeShell";
_player addMagazine "30Rnd_45ACP_Mag_SMG_01";
_player addWeapon "SMG_01_F";
_player addMagazine "30Rnd_45ACP_Mag_SMG_01";
_player addMagazine "30Rnd_45ACP_Mag_SMG_01";
_player addMagazine "9Rnd_45ACP_Mag";
_player addWeapon "hgun_ACPC2_F";
_player addMagazine "9Rnd_45ACP_Mag";
_player addMagazine "9Rnd_45ACP_Mag";
};
case (_bmoney >= 1000000 && _bmoney <= 1499999): {//ACP-C2 .45 ACP + TRG-20 5.56mm
removeAllItems _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addVest "V_HarnessO_brn";
_player addBackpack "B_AssaultPack_mcamo";
_player addWeapon "Binocular";
_player addItem "FirstAidKit";
_player addItem "SmokeShell";
_player addMagazine "30Rnd_556x45_Stanag";
_player addWeapon "arifle_TRG20_F";
_player addMagazine "30Rnd_556x45_Stanag";
_player addMagazine "30Rnd_556x45_Stanag";
_player addMagazine "9Rnd_45ACP_Mag";
_player addWeapon "hgun_ACPC2_F";
_player addMagazine "9Rnd_45ACP_Mag";
_player addMagazine "9Rnd_45ACP_Mag";
};
case (_bmoney >= 1500000 && _bmoney <= 1999999): {//ACP-C2 .45 ACP + Katiba Carbine 6.5mm
removeAllItems _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addBackpack "B_AssaultPack_mcamo";
_player addWeapon "Binocular";
_player addItem "FirstAidKit";
_player addItem "SmokeShell";
_player addMagazine "30Rnd_65x39_caseless_green";
_player addWeapon "arifle_Katiba_C_F";
_player addMagazine "30Rnd_65x39_caseless_green";
_player addMagazine "30Rnd_65x39_caseless_green";
_player addMagazine "9Rnd_45ACP_Mag";
_player addWeapon "hgun_ACPC2_F";
_player addMagazine "9Rnd_45ACP_Mag";
_player addMagazine "9Rnd_45ACP_Mag";
};
case (_bmoney >= 2000000 && _bmoney <= 2499999): {//ACP-C2 .45 ACP + MXC 6.5mm
removeAllItems _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addVest "V_HarnessO_brn";
_player addBackpack "B_AssaultPack_mcamo";
_player addWeapon "Binocular";
_player addItem "FirstAidKit";
_player addItem "SmokeShell";
_player addMagazine "30Rnd_65x39_caseless_mag";
_player addWeapon "arifle_MXC_F";
_player addMagazine "30Rnd_65x39_caseless_mag";
_player addMagazine "30Rnd_65x39_caseless_mag";
_player addMagazine "9Rnd_45ACP_Mag";
_player addWeapon "hgun_ACPC2_F";
_player addMagazine "9Rnd_45ACP_Mag";
_player addMagazine "9Rnd_45ACP_Mag";
};
case (_bmoney >= 2500000 && _bmoney <= 2999999): {//ACP-C2 .45 ACP + MX 3GL 6.5mm
removeAllItems _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addVest "V_HarnessO_brn";
_player addBackpack "B_AssaultPack_mcamo";
_player addWeapon "Binocular";
_player addItem "FirstAidKit";
_player addItem "SmokeShell";
_player addMagazine "30Rnd_65x39_caseless_mag";
_player addWeapon "arifle_MX_GL_F";
_player addMagazine "30Rnd_65x39_caseless_mag";
_player addMagazine "30Rnd_65x39_caseless_mag";
_player addMagazine "3Rnd_HE_Grenade_shell";
_player addMagazine "3Rnd_HE_Grenade_shell";
_player addMagazine "9Rnd_45ACP_Mag";
_player addWeapon "hgun_ACPC2_F";
_player addMagazine "9Rnd_45ACP_Mag";
_player addMagazine "9Rnd_45ACP_Mag";
};
case (_bmoney >= 3000000 && _bmoney <= 3499999): {//ACP-C2 .45 ACP + MX SW 6.5mm
removeAllItems _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addVest "V_HarnessO_brn";
_player addBackpack "B_AssaultPack_mcamo";
_player addWeapon "Binocular";
_player addItem "FirstAidKit";
_player addItem "SmokeShell";
_player addMagazine "100Rnd_65x39_caseless_mag";
_player addWeapon "arifle_MX_SW_F";
_player addMagazine "100Rnd_65x39_caseless_mag";
_player addMagazine "100Rnd_65x39_caseless_mag";
_player addMagazine "9Rnd_45ACP_Mag";
_player addWeapon "hgun_ACPC2_F";
_player addMagazine "9Rnd_45ACP_Mag";
_player addMagazine "9Rnd_45ACP_Mag";
};
case (_bmoney >= 3500000 && _bmoney <= 3999999): {//ACP-C2 .45 ACP + Mk200 6.5mm
removeAllItems _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addVest "V_HarnessO_brn";
_player addBackpack "B_AssaultPack_mcamo";
_player addWeapon "Binocular";
_player addItem "FirstAidKit";
_player addItem "SmokeShell";
_player addMagazine "200Rnd_65x39_cased_Box";
_player addWeapon "LMG_Mk200_F";
_player addMagazine "200Rnd_65x39_cased_Box";
_player addMagazine "9Rnd_45ACP_Mag";
_player addWeapon "hgun_ACPC2_F";
_player addMagazine "9Rnd_45ACP_Mag";
_player addMagazine "9Rnd_45ACP_Mag";
};
case (_bmoney >= 4000000 && _bmoney <= 4499999): {//ACP-C2 .45 ACP + Zafir 7.62mm
removeAllItems _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addVest "V_HarnessO_brn";
_player addBackpack "B_AssaultPack_mcamo";
_player addWeapon "Binocular";
_player addItem "FirstAidKit";
_player addItem "SmokeShell";
_player addMagazine "150Rnd_762x54_Box";
_player addWeapon "LMG_Zafir_F";
_player addMagazine "150Rnd_762x54_Box";
_player addMagazine "9Rnd_45ACP_Mag";
_player addWeapon "hgun_ACPC2_F";
_player addMagazine "9Rnd_45ACP_Mag";
_player addMagazine "9Rnd_45ACP_Mag";
};
case (_bmoney >= 4500000 && _bmoney <= 5000000): {//ACP-C2 .45 ACP + M320 LRR .408
removeAllItems _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addVest "V_HarnessO_brn";
_player addBackpack "B_AssaultPack_mcamo";
_player addWeapon "Binocular";
_player addItem "FirstAidKit";
_player addItem "SmokeShell";
_player addMagazine "7Rnd_408_Mag";
_player addWeapon "srifle_LRR_F";
_player addMagazine "7Rnd_408_Mag";
_player addMagazine "7Rnd_408_Mag";
_player addMagazine "7Rnd_408_Mag";
_player addMagazine "9Rnd_45ACP_Mag";
_player addWeapon "hgun_ACPC2_F";
_player addMagazine "9Rnd_45ACP_Mag";
_player addMagazine "9Rnd_45ACP_Mag";
};
};

switch (true) do {
case (["_medic_", typeOf _player] call fn_findString != -1):
{
_player removeItem "FirstAidKit";
_player addItem "Medikit";
};
case (["_engineer_", typeOf _player] call fn_findString != -1):
{
_player addItem "MineDetector";
_player addItem "Toolkit";
};
case (["_sniper_", typeOf _player] call fn_findString != -1):
{
_player removeItem "Binocular";
_player addWeapon "Rangefinder";
};
};

switch (true) do {//Additional
case (_playerScore >= 100 && _playerScore <= 149): {
_player addItem "MiniGrenade";
_player addItem "HandGrenade";
};
case (_playerScore >= 150 && _playerScore <= 199): {
_player addItem "MiniGrenade";
_player addItem "MiniGrenade";
_player addItem "HandGrenade";
_player addItem "HandGrenade";
};
case (_playerScore >= 200 && _playerScore <= 249): {
_player addItem "MiniGrenade";
_player addItem "HandGrenade";
_player addItem "APERSTripMine_Wire_Mag";
};
case (_playerScore >= 250 && _playerScore <= 299): {
_player addItem "MiniGrenade";
_player addItem "HandGrenade";
_player addItem "APERSBoundingMine_Range_Mag";
};
case (_playerScore >= 300 && _playerScore <= 349): {
_player addItem "MiniGrenade";
_player addItem "HandGrenade";
_player addItem "APERSMine_Range_Mag";
};
case (_playerScore >= 350 && _playerScore <= 399): {
_player addItem "MiniGrenade";
_player addItem "HandGrenade";
_player addItem "ClaymoreDirectionalMine_Remote_Mag";
};
case (_playerScore >= 400 && _playerScore <= 449): {
_player addItem "MiniGrenade";
_player addItem "HandGrenade";
_player addItem "SLAMDirectionalMine_Wire_Mag";
};
case (_playerScore >= 450 && _playerScore <= 499): {
_player addItem "MiniGrenade";
_player addItem "HandGrenade";
_player addItem "DemoCharge_Remote_Mag";
};
case (_playerScore >= 500 && _playerScore <= 999): {
_player addItem "MiniGrenade";
_player addItem "HandGrenade";
_player addItem "DemoCharge_Remote_Mag";
_player addMagazine "RPG32_F";
_player addWeapon "launch_RPG32_F";
_player addMagazine "RPG32_F";
};
case (_playerScore >= 1000): {
_player removeItem "Binocular";
_player removeItem "Rangefinder";
_player addMagazine "Laserbatteries";
_player addWeapon "Laserdesignator";
_player addItem "MiniGrenade";
_player addItem "HandGrenade";
_player addItem "DemoCharge_Remote_Mag";
_player addMagazine "RPG32_HE_F";
_player addWeapon "launch_RPG32_F";
_player addMagazine "RPG32_HE_F";
};
};

if (_player == player) then
{
thirstLevel = 100;
hungerLevel = 100;
};

Code: [Select]
// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
// @file Version: 1.0
// @file Name: getDefaultClothing.sqf
// @file Author: AgentRev
//      @file Modifications to LOADOUTS: [BC]CeccaTTo

private ["_unit", "_item", "_side", "_result"];

_unit = _this select 0;
_item = _this select 1;

if (typeName _unit == "OBJECT") then
{
_side = if (_unit == player) then { playerSide } else { side _unit };
_unit = typeOf _unit;
}
else
{
_side = _this select 2;
};

_result = "";

switch (_side) do
{
case BLUFOR:
{
switch (true) do
{
default
{
if (_item == "uniform") then { _result = "U_B_CombatUniform_mcam_vest" };
};
};
if (_item == "headgear") then { _result = "H_Cap_blu" };
};
case OPFOR:
{
switch (true) do
{
default
{
if (_item == "uniform") then { _result = "U_O_OfficerUniform_ocamo" };
};
};
if (_item == "headgear") then { _result = "H_Cap_red" };
};
default
{
switch (true) do
{
default
{
if (_item == "uniform") then { _result = "U_I_CombatUniform" };
};
};
if (_item == "headgear") then { _result = "H_Cap_grn" };
};
};

_result
  • Offline Animatek
  • Entusiasta
  • First Blood
  • ***
  • Posts: 92
  • Former ArmA III Admin in Cuba

Re: Loadout System

« Reply #1 posted: Dec 17, 2018, 05:22 AM »
Nice! I trying it right now. Thanks!
No soy programador, solo soy inteligente
  • Offline Animatek
  • Entusiasta
  • First Blood
  • ***
  • Posts: 92
  • Former ArmA III Admin in Cuba

Re: Gear Loadouts

« Reply #2 posted: Jan 01, 2019, 07:05 PM »
I got rid of the magical parachute. For the first spawn I added a parachute to the default gear; and adding
Code: [Select]
[_player,"B_AssaultPack_mcamo"] call zade_boc_fnc_addChestpack;
to each gear preset, for example

Code: [Select]
case (_bmoney >= 0 && _bmoney <= 499999): {//ACP-C2 .45 ACP + PDW2000 9mm
removeAllItems _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addVest "V_HarnessO_brn";
_player addBackpack "rhs_d6_Parachute_backpack";
_player addWeapon "Binocular";
_player addItem "FirstAidKit";
_player addItem "SmokeShell";
_player addMagazine "30Rnd_9x21_Mag";
_player addWeapon "hgun_PDW2000_F";
_player addMagazine "30Rnd_9x21_Mag";
_player addMagazine "30Rnd_9x21_Mag";
_player addMagazine "9Rnd_45ACP_Mag";
_player addWeapon "hgun_ACPC2_F";
_player addMagazine "9Rnd_45ACP_Mag";
_player addMagazine "9Rnd_45ACP_Mag";
[_player,"B_AssaultPack_mcamo"] call zade_boc_fnc_addChestpack;

But the backpack appears empty. duh.
How can I add all the items to the backpack?

The addon itself adds items to the backpack: If I place the backpackonchest's module in the editor (synchronized with a unit), it looks like this:
just a frag...
Code: [Select]
class Item1
{
dataType="Logic";
class PositionInfo
{
position[]={17315.975,4.3458567,13987.186};
};
id=2;
type="zade_boc_moduleAdd";
atlOffset=4.7683716e-007;
class CustomAttributes
{
class Attribute0
{
property="zade_boc_moduleAdd_classname";
expression="_this setVariable ['classname',_value,true];";
class Value
{
class data
{
class type
{
type[]=
{
"STRING"
};
};
value="B_Carryall_cbr";
};
};
};
class Attribute1
{
property="zade_boc_moduleAdd_code";
expression="_this setVariable ['code',_value,true];";
class Value
{
class data
{
class type
{
type[]=
{
"STRING"
};
};
value="_this setObjectTextureGlobal [0, ""#(rgb,8,8,3)color(0,0,1,1)""];";
};
};
};
class Attribute2
{
property="zade_boc_moduleAdd_Units";
expression="_this setVariable ['Units',_value,true];";
class Value
{
class data
{
class type
{
type[]=
{
"STRING"
};
};
value="1";
};
};
};
class Attribute3
{
property="zade_boc_moduleAdd_mags";
expression="_this setVariable ['mags',_value,true];";
class Value
{
class data
{
class type
{
type[]=
{
"STRING"
};
};
value="[""30Rnd_65x39_caseless_mag"",20], [""30Rnd_65x39_caseless_mag_Tracer"",10]";
};
};
};
class Attribute4
{
property="zade_boc_moduleAdd_items";
expression="_this setVariable ['items',_value,true];";
class Value
{
class data
{
class type
{
type[]=
{
"STRING"
};
};
value="[""FirstAidKit"",3], ""hgun_P07_F"", [""16Rnd_9x21_Mag"",2]";
};
};
};
nAttributes=5;
};
};
};

How do I add this to PlayerDefaultGear?

happy new year
No soy programador, solo soy inteligente
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2652
  • Offline Animatek
  • Entusiasta
  • First Blood
  • ***
  • Posts: 92
  • Former ArmA III Admin in Cuba

Re: Gear Loadouts

« Reply #4 posted: Jan 01, 2019, 10:55 PM »
dumb question:
I don't want repeat every line for each item:

Code: [Select]
[player,"FirstAidKit"] call zade_boc_fnc_addItemToChestpack;
[player,"SmokeShell"] call zade_boc_fnc_addItemToChestpack;
[player,"9Rnd_45ACP_Mag", 10] call zade_boc_fnc_addItemToChestpack;

what if I put it like this? Will it work?

Code: [Select]
[player, ["9Rnd_45ACP_Mag",10],["FirstAidKit"],["SmokeShell"]] call zade_boc_fnc_addItemToChestpack;
I don't want to this explode in my face :)
No soy programador, solo soy inteligente
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2652

Re: Gear Loadouts

« Reply #5 posted: Jan 02, 2019, 10:23 PM »
Your code won't work, but you can do something like

Code: [Select]
{ ([player] + _x) call zade_boc_fnc_addItemToChestpack } forEach
[
["9Rnd_45ACP_Mag",10],
["FirstAidKit"],
["SmokeShell"]
];
  • Offline Animatek
  • Entusiasta
  • First Blood
  • ***
  • Posts: 92
  • Former ArmA III Admin in Cuba

Re: Gear Loadouts

« Reply #6 posted: Jan 03, 2019, 10:11 AM »
Thanks!
I'm gonna do it right now
No soy programador, solo soy inteligente
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2652

Re: Gear Loadouts

« Reply #7 posted: Jan 10, 2019, 07:03 PM »
Oh yeah also I think anything related to BackpackOnChest is not saved/restored. That would require quite a few code edits.
  • Offline Animatek
  • Entusiasta
  • First Blood
  • ***
  • Posts: 92
  • Former ArmA III Admin in Cuba

Re: Gear Loadouts

« Reply #8 posted: Jan 11, 2019, 06:22 PM »
That does not bother me for now.
The backpackonchest in my case, I use it to spawn the first time; to be able to appear with parachutes, both in spawn beacons and on towns. (I removed the magical parachute and replaced it with Advanced Urban Rappelling), in order to increase the complexity of those who usually fly planes and helicopters.
Also with the ACE3 they can do FRIES from helicopters. It is only because of that, to increase the difficulty and strengthen teamwork.
In the probable case of losing items because of the backpackonchest, they are more than warned.

Besides, it would be a lot of hassle to modify the DB (which works very well) just for that.
Do you know that it would be interesting in that case? that A3Wasteland had its own integrated BackPackOnChest version.

Think about it
No soy programador, solo soy inteligente
  • Offline Animatek
  • Entusiasta
  • First Blood
  • ***
  • Posts: 92
  • Former ArmA III Admin in Cuba

Re: Gear Loadouts

« Reply #9 posted: Jan 11, 2019, 06:23 PM »
By the way, the code you gave me for this works perfectly. Thank you! :D
No soy programador, solo soy inteligente
  • Offline Gen
  • DavidalinaAJ
  • Geared Up
  • **
  • Posts: 24

Re: Gear Loadouts

« Reply #10 posted: Mar 02, 2019, 03:22 PM »
Oh yeah also I think anything related to BackpackOnChest is not saved/restored. That would require quite a few code edits.

why you dont make this original for wasteland would be awesom
  • Offline Animatek
  • Entusiasta
  • First Blood
  • ***
  • Posts: 92
  • Former ArmA III Admin in Cuba

Re: Gear Loadouts

« Reply #11 posted: Apr 02, 2019, 08:11 PM »
This is a silly way to do it, but my users love it.
I added to this code a way to gain military ranks.

https://github.com/AnimatekdeCuba/A3Wasteland.Altis/blob/5bb6cbb0d1d574c5bd384650399fe1c0145bf278/client/functions/playerSetupGear.sqf

As my mission uses ACE3, the name of the players above their heads, comes with the military rank; which makes this addition very useful.

my next step will be to give players with more rank access to exclusive content, the equivalent of "is donor".

although I do not know if in this same code grant him the condition Donor, or make a separate condition based on the military rank. What do you think?
No soy programador, solo soy inteligente