Jump to content
  • 0

Give loadout based on humanity level


THAC0_Gewch

Question

Recommended Posts

  • 0

Finally got it! Thanks to THAC0_Gewch for kicking off this thread! Hope this works for you too bro! Special thanks to Halvhjearne for his tough love ;) lol and Extra Special Thanks to ritualmsry for pointing out that last little thing I was missing! I am no pro scripter by far and have tested this thoroughly so please forgive me if I made any mistakes and please feel free to clean it up or modify/improve! It actually is quite easy when you have the right info and kind people willing to help! I've learned so much from this little trial and my server is finally perfect! Running 20+ Scripts now very cleanly. Thanks for your help guys, couldn't have got this without you!

 

Obvisiouly you can change the items spawned to whatever you want :) Have fun!

 

Zero

 

Edit: Forget to mention two minor weird things. 1.) When first spawning, player needs to switch to Pistol then back to Rifle for rifle to load ammo. Not sure why it doesn't spawn ready to load ammo. Tried the command reloadplayer; but that didn't help. 2.) The skin ends up in inventory not on player. I tried removing the Skin_ portion off of the skin and got a config error. Go figure. Let me know if you guys get around this. :)

 

 

Yeah I figured this should be pretty easy since I wasn't able to find much on it. I've found over the years that if you Google something and find little to no information, it usually means what you're trying to do is so simple that it is normally unnecessary to make a thread on it; and this thread seems to have been no exception. If I had been more experienced with Arma scripting I could have whipped this up in about 10 minutes.

 

As for your issues you listed, I've actually heard of the first one. I think you have to add the magazine for your main weapon RIGHT before you load in your main weapon, like this:

player addMagazine '30Rnd_556x45_Stanag';
player addWeapon 'M4A1_Aim';

As for the skin thing, I don't know how that would be but would also like to know how to get those spawning in ON the player since we'd like to go a bit old school and have people spawn in with the hero skin.

Edit: Far as I can tell it's not possible to outfit someone with a skin without using the DefaultMagazine variable. Hopefully someone will correct me if I'm wrong but I think when doing custom loadouts in the manner that we are doing them, they just go into the inventory with no way around it.

Link to comment
Share on other sites

  • 0

Experience comes from opportunities like this :) Coding and scriting for Arma is very unique as well, albeit sometimes simple. I tend to way over think things based on my past experience. I used to program several years ago as a hobby. I mainly used Python and C++. It's been a really long time but I am falling in love with it all over again. When it comes to Arma, it just takes digging through files usually and finding how it's been done before and sometimes you just have to ask for help. No shame in that :)

 

Thanks for the Tip on the ammo and main weapon, I will give that a shot. Yah, too bad on the SKin thing, hopefully someone will provide a solution. I looked at the Skin change code for my Admin Tools but could not find anything usueful. Oh well, works fine for now :)

Link to comment
Share on other sites

  • 0

Implemented the script tonight and confirmed with one of our admins who is over 20000 humanity (we just launched this new server a couple weeks ago) that the loadout works and his pistol is loaded and in his hand when he lands on the ground after spawning. Here is our final loadout granting script that we are using:
 

// HERO LOADOUT GRANTER
Private ["_humanity"];

waitUntil {!isNil ("PVDZE_plr_LoginRecord")}; // Check that player is logged in
_humanity = (player getVariable["humanity",0]); // Get and set humanity

if (dayzPlayerLogin2 select 2 and !(player isKindOf "PZombie_VB")) then { // Check if player is new spawn and not zombified
if (_humanity >= 20000) then {

// Remove default loadout
removeAllWeapons player;
removeAllItems player;
removeBackpack player;

//Overridden inventory here
player addMagazine '17Rnd_9x19_glock17';
player addWeapon 'glock17_EP1';
player addWeapon 'ItemMap';
player addMagazine '17Rnd_9x19_glock17';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemMorphine';
player addMagazine 'ItemPainkiller';
player addBackpack 'DZ_British_ACU';
};
}; // END HERO LOADOUT GRANTER

I'm really happy that this thread ended up being a nice contribution for the community, many thanks to everyone who participated.

Also, just a thought for Zero, you might try experimenting with adding all your code in to one sqf. I'm pretty sure you can stack your stuff with two if statements checking humanity, something like this:
 

// Hells Cowboys Hero Loadout
Private ["_humanity"];

waitUntil {!isNil ("PVDZE_plr_LoginRecord")};

_humanity = (player getVariable["humanity",0]);
if (dayzPlayerLogin2 select 2 and !(player isKindOf "PZombie_VB")) then {
if(_humanity >= 5000) then {
removeAllWeapons player;
removeAllItems player;
removeBackpack player;
player addMagazine '30Rnd_556x45_Stanag';
player addMagazine '30Rnd_556x45_Stanag';
player addMagazine '30Rnd_556x45_Stanag';
player addMagazine '30Rnd_556x45_Stanag';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemMorphine';
player addMagazine 'ItemAntibiotic';
player addMagazine 'ItemPainkiller';
player addMagazine 'ItemSodaLemonade';
player addMagazine 'FoodbaconCooked';
player addMagazine '7Rnd_45ACP_1911';
player addMagazine '7Rnd_45ACP_1911';
player addMagazine '7Rnd_45ACP_1911';
player addMagazine '7Rnd_45ACP_1911';
player addMagazine 'ItemGoldBar10oz';
player addMagazine 'Skin_Soldier_Sniper_PMC_DZ';
player addWeapon 'M4A1_Aim';
player addWeapon 'Colt1911';
player addWeapon 'ItemCrowbar';
player addWeapon 'ItemToolbox';
player addWeapon 'ItemEtool';
player addWeapon 'ItemGPS';
player addWeapon 'ItemMap';
player addWeapon 'ItemKnife';
player addWeapon 'MeleeHatchet_DZE';
player addWeapon 'ItemCompass';
player addWeapon 'ItemMatchbox';
player addBackpack 'DZ_British_ACU';
} else {

// Hells Cowboys Bandit Loadout
if(_humanity <= -5000) then {
removeAllWeapons player;
removeAllItems player;
removeBackpack player;
player addMagazine '30Rnd_545x39_AK';
player addMagazine '30Rnd_545x39_AK';
player addMagazine '30Rnd_545x39_AK';
player addMagazine '30Rnd_545x39_AK';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemMorphine';
player addMagazine 'ItemAntibiotic';
player addMagazine 'ItemPainkiller';
player addMagazine 'ItemSodaRabbit';
player addMagazine 'FoodCanDemon';
player addMagazine '15Rnd_9x19_M9';
player addMagazine '15Rnd_9x19_M9';
player addMagazine '15Rnd_9x19_M9';
player addMagazine '15Rnd_9x19_M9';
player addMagazine 'ItemGoldBar10oz';
player addMagazine 'Skin_GUE_Commander_DZ';
player addWeapon 'AKS_74_kobra';
player addWeapon 'UZI_EP1';
player addWeapon 'ItemCrowbar';
player addWeapon 'ItemToolbox';
player addWeapon 'ItemEtool';
player addWeapon 'ItemGPS';
player addWeapon 'ItemMap';
player addWeapon 'ItemKnife';
player addWeapon 'MeleeHatchet_DZE';
player addWeapon 'ItemCompass';
player addWeapon 'ItemMatchbox';
player addBackpack 'DZ_Backpack_EP1';
};
};
};

This may optimize spawn loading times for your players. Something to think about.

Link to comment
Share on other sites

  • 0

Special thanks to Halvhjearne for his tough love ;) lol 

 

lol

 

heres something that will reduce size of your scripts ...

removeAllWeapons player;
removeAllItems player;
removeBackpack player;
{player addMagazine _x}forEach [
'30Rnd_545x39_AK','30Rnd_545x39_AK','30Rnd_545x39_AK','30Rnd_545x39_AK','ItemBandage','ItemBandage','ItemBandage','ItemBandage','ItemMorphine','ItemAntibiotic','ItemPainkiller','ItemSodaRabbit','FoodCanDemon','15Rnd_9x19_M9','15Rnd_9x19_M9','15Rnd_9x19_M9','15Rnd_9x19_M9','ItemGoldBar10oz','Skin_GUE_Commander_DZ'
];
{player addWeapon _x}forEach [
'AKS_74_kobra','UZI_EP1','ItemCrowbar','ItemToolbox','ItemEtool','ItemGPS','ItemMap','ItemKnife','MeleeHatchet_DZE','ItemCompass','ItemMatchbox'
];
player addBackpack 'DZ_Backpack_EP1';
Link to comment
Share on other sites

  • 0

Implemented the script tonight and confirmed with one of our admins who is over 20000 humanity (we just launched this new server a couple weeks ago) that the loadout works and his pistol is loaded and in his hand when he lands on the ground after spawning. Here is our final loadout granting script that we are using:

 

// HERO LOADOUT GRANTER
Private ["_humanity"];

waitUntil {!isNil ("PVDZE_plr_LoginRecord")}; // Check that player is logged in
_humanity = (player getVariable["humanity",0]); // Get and set humanity

if (dayzPlayerLogin2 select 2 and !(player isKindOf "PZombie_VB")) then { // Check if player is new spawn and not zombified
if (_humanity >= 20000) then {
diag_log ("GRANTING HERO LOADOUT TO PLAYER"); // Does not work, syntax is wrong - Gewch will fix during next maintenance period

// Remove default loadout
removeAllWeapons player;
removeAllItems player;
removeBackpack player;

//Overridden inventory here
player addMagazine '17Rnd_9x19_glock17';
player addWeapon 'glock17_EP1';
player addWeapon 'ItemMap';
player addMagazine '17Rnd_9x19_glock17';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemMorphine';
player addMagazine 'ItemPainkiller';
player addBackpack 'DZ_British_ACU';
};
}; // END HERO LOADOUT GRANTER

I'm really happy that this thread ended up being a nice contribution for the community, many thanks to everyone who participated.

Also, just a thought for Zero, you might try experimenting with adding all your code in to one sqf. I'm pretty sure you can stack your stuff with two if statements checking humanity, something like this:

 

This may optimize spawn loading times for your players. Something to think about.

 

I was wondering if that would work, will have to try it out! Thanks bro!

 

Zero

Link to comment
Share on other sites

  • 0

 

lol

 

heres something that will reduce size of your scripts ...

removeAllWeapons player;
removeAllItems player;
removeBackpack player;
{player addMagazine _x}forEach [
'30Rnd_545x39_AK','30Rnd_545x39_AK','30Rnd_545x39_AK','30Rnd_545x39_AK','ItemBandage','ItemBandage','ItemBandage','ItemBandage','ItemMorphine','ItemAntibiotic','ItemPainkiller','ItemSodaRabbit','FoodCanDemon','15Rnd_9x19_M9','15Rnd_9x19_M9','15Rnd_9x19_M9','15Rnd_9x19_M9','ItemGoldBar10oz','Skin_GUE_Commander_DZ'
];
{player addWeapon _x}forEach [
'AKS_74_kobra','UZI_EP1','ItemCrowbar','ItemToolbox','ItemEtool','ItemGPS','ItemMap','ItemKnife','MeleeHatchet_DZE','ItemCompass','ItemMatchbox'
];
player addBackpack 'DZ_Backpack_EP1';

 

Sweeet! Thanks man!!!

 

Zero

Link to comment
Share on other sites

  • 0

This isn't working for me. When I spawn, I get no loadout. In my init.sqf, I put the execVM at the bottom of the "if (!isDedicated) then {" section.

if (!isDedicated) then {
[] execVM "custom\welcome\Server_WelcomeCredits.sqf";
//Conduct map operations
0 fadeSound 0;
waitUntil {!isNil "dayz_loadScreenMsg"};
dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");


[] execVM "custom\remote_messages\remote_messages.sqf";
[] execVM "custom\markers\custommarkers.sqf";


//Run the player monitor
_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
_nil = [] execVM "custom\JAEM\EvacChopper_init.sqf";
_playerMonitor =  [] execVM "\z\addons\dayz_code\system\player_monitor.sqf"; 
_nil = [] execVM "custom\safezone\init.sqf";


//anti Hack
//[] execVM "\z\addons\dayz_code\system\antihack.sqf";


//DayZ Watermark
if (!isNil "server_name") then {
[] spawn {
waitUntil {(!isNull Player) and (alive Player) and (player == player)};
waituntil {!(isNull (findDisplay 46))};
5 cutRsc ["wm_disp","PLAIN"];
((uiNamespace getVariable "wm_disp") displayCtrl 1) ctrlSetText server_name;
};
}; 


// Epoch Admin Tools
[] execVM "admintools\AdminList.sqf";
if ( !((getPlayerUID player) in AdminList) && !((getPlayerUID player) in ModList) && !((getPlayerUID player) in tempList)) then 
{
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
};


//Lights
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";


//Humanity based loadouts
[] execVM "custom\loadouts\humanityloadout.sqf";
};

Here's what I have in humanityloadout.sqf:

Private ["_humanity"];


waitUntil {!isNil ("PVDZE_plr_LoginRecord")};


_humanity = (player getVariable["humanity",0]);
if (dayzPlayerLogin2 select 2 and !(player isKindOf "PZombie_VB")) then {
if(_humanity >= 5000) then {
removeAllWeapons player;
removeAllItems player;
removeBackpack player;
player addMagazine '30Rnd_556x45_Stanag';
player addMagazine '30Rnd_556x45_Stanag';
player addMagazine '30Rnd_556x45_Stanag';
player addMagazine '30Rnd_556x45_Stanag';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemMorphine';
player addMagazine 'ItemAntibiotic';
player addMagazine 'ItemPainkiller';
player addMagazine 'ItemSodaLemonade';
player addMagazine 'FoodbaconCooked';
player addMagazine '7Rnd_45ACP_1911';
player addMagazine '7Rnd_45ACP_1911';
player addMagazine '7Rnd_45ACP_1911';
player addMagazine '7Rnd_45ACP_1911';
player addMagazine 'ItemGoldBar10oz';
player addMagazine 'Skin_Soldier_Sniper_PMC_DZ';
player addWeapon 'M4A1_Aim';
player addWeapon 'Colt1911';
player addWeapon 'ItemCrowbar';
player addWeapon 'ItemToolbox';
player addWeapon 'ItemEtool';
player addWeapon 'ItemGPS';
player addWeapon 'ItemMap';
player addWeapon 'ItemKnife';
player addWeapon 'MeleeHatchet_DZE';
player addWeapon 'ItemCompass';
player addWeapon 'ItemMatchbox';
player addBackpack 'DZ_British_ACU';
};
} else {
if(_humanity < 5000) then {
removeAllWeapons player;
removeAllItems player;
removeBackpack player;
player addMagazine '15Rnd_W1866_Slug';
player addMagazine 'ItemBandage';
player addMagazine 'ItemMorphine';
player addMagazine 'ItemPainkiller';
player addMagazine 'FoodCanBakedBeans';
player addMagazine 'ItemWaterbottle';
player addMagazine 'ItemAntibiotic';
player addWeapon 'Winchester1866';
player addWeapon 'MeleeHatchet_DZE';
player addBackpack 'DZ_Patrol_Pack_EP1';
};
};
Link to comment
Share on other sites

  • 0

 

This isn't working for me. When I spawn, I get no loadout. In my init.sqf, I put the execVM at the bottom of the "if (!isDedicated) then {" section.

if (!isDedicated) then {
[] execVM "custom\welcome\Server_WelcomeCredits.sqf";
//Conduct map operations
0 fadeSound 0;
waitUntil {!isNil "dayz_loadScreenMsg"};
dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");


[] execVM "custom\remote_messages\remote_messages.sqf";
[] execVM "custom\markers\custommarkers.sqf";


//Run the player monitor
_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
_nil = [] execVM "custom\JAEM\EvacChopper_init.sqf";
_playerMonitor =  [] execVM "\z\addons\dayz_code\system\player_monitor.sqf"; 
_nil = [] execVM "custom\safezone\init.sqf";


//anti Hack
//[] execVM "\z\addons\dayz_code\system\antihack.sqf";


//DayZ Watermark
if (!isNil "server_name") then {
[] spawn {
waitUntil {(!isNull Player) and (alive Player) and (player == player)};
waituntil {!(isNull (findDisplay 46))};
5 cutRsc ["wm_disp","PLAIN"];
((uiNamespace getVariable "wm_disp") displayCtrl 1) ctrlSetText server_name;
};
}; 


// Epoch Admin Tools
[] execVM "admintools\AdminList.sqf";
if ( !((getPlayerUID player) in AdminList) && !((getPlayerUID player) in ModList) && !((getPlayerUID player) in tempList)) then 
{
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
};


//Lights
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";


//Humanity based loadouts
[] execVM "custom\loadouts\humanityloadout.sqf";
};

 

 

Put your exec line for the humanity loadout sqf just above the player monitor section.

Link to comment
Share on other sites

  • 0

I had started this thread before that was released, or else we would have probably tinkered with his code instead of trying to write our own.

well ill be honest i didnt read this post properly ;) just saw the title and figured id save you some trouble, let us know when its ready id like to give it a whirl

 

you also might be interested in this, 

Link to comment
Share on other sites

  • 0

well ill be honest i didnt read this post properly ;) just saw the title and figured id save you some trouble, let us know when its ready id like to give it a whirl

 

 

The script has been finished and is working great on our server:

 

Implemented the script tonight and confirmed with one of our admins who is over 20000 humanity (we just launched this new server a couple weeks ago) that the loadout works and his pistol is loaded and in his hand when he lands on the ground after spawning. Here is our final loadout granting script that we are using:

 

// HERO LOADOUT GRANTER
Private ["_humanity"];

waitUntil {!isNil ("PVDZE_plr_LoginRecord")}; // Check that player is logged in
_humanity = (player getVariable["humanity",0]); // Get and set humanity

if (dayzPlayerLogin2 select 2 and !(player isKindOf "PZombie_VB")) then { // Check if player is new spawn and not zombified
if (_humanity >= 20000) then {
diag_log ("GRANTING HERO LOADOUT TO PLAYER"); // Does not work, syntax is wrong - Gewch will fix during next maintenance period

// Remove default loadout
removeAllWeapons player;
removeAllItems player;
removeBackpack player;

//Overridden inventory here
player addMagazine '17Rnd_9x19_glock17';
player addWeapon 'glock17_EP1';
player addWeapon 'ItemMap';
player addMagazine '17Rnd_9x19_glock17';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemBandage';
player addMagazine 'ItemMorphine';
player addMagazine 'ItemPainkiller';
player addBackpack 'DZ_British_ACU';
};
}; // END HERO LOADOUT GRANTER

Link to comment
Share on other sites

  • 0

both of yours code could be optimized instead of using all these if's, try a switch case and instead of adding each single weapon/item or magazine, put them in an arrays and add them all at the buttom of the script instead.

 

that would make it simpler and perhaps easier to edit after imo

Link to comment
Share on other sites

  • 0

Hi,

did anyone notice, that the player won't be able to choose chemlights and roadflares as weapons anymore, with pressing F-Key?

After executing the removeAllWeapons command.

 

Solution, add this at the end:

player addWeapon "Loot";
player addWeapon "Flare";

These are the "core tools", like it's called in the player_monitor.fsm.

 

regards

Link to comment
Share on other sites

  • 0

I am trying to get this to work using different levels of humanity and loadout.  If someone can look at my code and tell me what my problem is I would greatly appreciate it.

 

 

This is my loadout.sqf.


Private ["_humanity","_isHero1","_isHero2","_isHero3","_isHero4","_isHero5","_isbandit1","_isbandit2","_isbandit3","_isbandit4","_isbandit5"];

waitUntil {!isNil ("PVDZE_plr_LoginRecord")};

_humanity = (player getVariable["humanity",0]);
_isHero1 = (player getVariable ["humanity",0] > 5000) && (player getVariable ["humanity",0] < 9999));
_isHero2 = ((player getVariable ["humanity",0] > 10000) && (player getVariable ["humanity",0] < 19999));
_isHero3 = ((player getVariable ["humanity",0] > 20000) && (player getVariable ["humanity",0] < 29999));
_isHero4 = (player getVariable ["humanity",0] > 30000) && (player getVariable ["humanity",0] < 79999);
_isHero5 = (player getVariable ["humanity",0] > 80000);
_isbandit1 = (player getVariable ["humanity",0] < -5000) && (player getVariable ["humanity",0] > -9999));
_isbandit2 = ((player getVariable ["humanity",0] < -10000) && (player getVariable ["humanity",0] > -19999));
_isbandit3 = ((player getVariable ["humanity",0] < -20000) && (player getVariable ["humanity",0] > -29999));
_isbandit4 = (player getVariable ["humanity",0] < -30000) && (player getVariable ["humanity",0] > -79999);
_isbandit5 = (player getVariable ["humanity",0] < -80000);


if (dayzPlayerLogin2 select 2 and !(player isKindOf "PZombie_VB")) then {
if(_isHero1) then {
removeAllWeapons player;
removeAllItems player;
removeBackpack player;
player addWeapon "Loot";
player addWeapon "Flare";
{player addMagazine _x}forEach [
'ItemBandage',
'ItemBandage',
'17Rnd_9x19_glock17',
'17Rnd_9x19_glock17',
'ItemSodaPepsi',
'ItemPainkiller',
'FoodCanPasta',
'ItemMorphine',
'ItemBloodbag',
'ItemMorphine',
'ItemWaterbottleBoiled'
];
{player addWeapon _x}forEach [
'glock17_EP1',
'ItemMap',
'ItemCompass'
];
player addBackpack 'DZ_ALICE_Pack_EP1';
};

if(_isHero2) then {
removeAllWeapons player;
removeAllItems player;
removeBackpack player;
player addWeapon "Loot";
player addWeapon "Flare";
{player addMagazine _x}forEach [
'ItemBandage',
'ItemBandage',
'30Rnd_556x45_Stanag',
'30Rnd_556x45_Stanag',
'15Rnd_9x19_M9',
'15Rnd_9x19_M9',
'ItemSodaCoke',
'ItemPainkiller',
'FoodCanSardines',
'ItemMorphine',
'ItemBloodbag',
'ItemMorphine',
'ItemWaterbottleBoiled'
];
{player addWeapon _x}forEach [
'M4A3_CCO_EP1',
'ItemFlashlight',
'ItemToolbox',
'ItemMap',
'Binocular',
'M9',
'ItemCompass'
];
player addBackpack 'DZ_CompactPack_EP1';
};

if(_isHero3) then {
removeAllWeapons player;
removeAllItems player;
removeBackpack player;
player addWeapon "Loot";
player addWeapon "Flare";
{player addMagazine _x}forEach [
'ItemBandage',
'ItemBandage',
'100Rnd_762x51_M240',
'100Rnd_762x51_M240',
'15Rnd_9x19_M9SD',
'15Rnd_9x19_M9SD',
'ItemSodaMdew',
'ItemPainkiller',
'FoodNutmix',
'ItemMorphine',
'ItemBloodbag',
'ItemWaterbottleBoiled'
];
{player addWeapon _x}forEach [
'Mk_48_DZ',
'ItemGPS',
'ItemCompass',
'ItemToolbox',
'ItemMatchbox',
'Binocular',
'M9SD'
];
player addBackpack 'DZ_GunBag_EP1';
};
if(_isHero4) then {
removeAllWeapons player;
removeAllItems player;
removeBackpack player;
player addWeapon "Loot";
player addWeapon "Flare";
{player addMagazine _x}forEach [
'ItemBandage',
'ItemBandage',
'30Rnd_556x45_StanagSD',
'30Rnd_556x45_StanagSD',
'15Rnd_9x19_M9SD',
'15Rnd_9x19_M9SD',
'ItemSodaRbull',
'ItemPainkiller',
'FoodMRE',
'ItemMorphine',
'ItemBloodbag',
'ItemWaterbottleBoiled'
];
{player addWeapon _x}forEach [
'M4A1_Aim_SD_camo',
'ItemGPS',
'ItemToolbox',
'Binocular_Vector',
'M9SD',
'ItemCompass'
];
player addBackpack 'DZ_TK_Assault_Pack_EP1';
};
if(_isHero5) then {
removeAllWeapons player;
removeAllItems player;
removeBackpack player;
player addWeapon "Loot";
player addWeapon "Flare";
{player addMagazine _x}forEach [
'ItemBandage',
'ItemBandage',
'20Rnd_762x51_DMR',
'20Rnd_762x51_DMR',
'15Rnd_9x19_M9SD',
'15Rnd_9x19_M9SD',
'ItemSodaOrangeSherbet',
'ItemPainkiller',
'FoodSteakCooked',
'ItemMorphine',
'ItemBloodbag',
'ItemWaterbottleBoiled'
];
{player addWeapon _x}forEach [
'DMR_DZ',
'ItemGPS',
'ItemToolbox',
'Binocular_Vector',
'ItemCrowbar',
'M9SD',
'ItemCompass'
];
player addBackpack 'DZ_LargeGunBag_EP1';
};
if(_isbandit1) then {
removeAllWeapons player;
removeAllItems player;
removeBackpack player;
player addWeapon "Loot";
player addWeapon "Flare";
{player addMagazine _x}forEach [
'ItemBandage',
'ItemBandage',
'17Rnd_9x19_glock17',
'17Rnd_9x19_glock17',
'ItemSodaPepsi',
'ItemPainkiller',
'FoodCanPasta',
'ItemMorphine',
'ItemBloodbag',
'ItemMorphine',
'ItemWaterbottleBoiled'
];
{player addWeapon _x}forEach [
'glock17_EP1',
'ItemMap',
'ItemCompass'
];
player addBackpack 'DZ_ALICE_Pack_EP1';
};
if(_isbandit2) then {
removeAllWeapons player;
removeAllItems player;
removeBackpack player;
player addWeapon "Loot";
player addWeapon "Flare";
{player addMagazine _x}forEach [
'ItemBandage',
'ItemBandage',
'30Rnd_556x45_Stanag',
'30Rnd_556x45_Stanag',
'15Rnd_9x19_M9',
'15Rnd_9x19_M9',
'ItemSodaCoke',
'ItemPainkiller',
'FoodCanSardines',
'ItemMorphine',
'ItemBloodbag',
'ItemMorphine',
'ItemWaterbottleBoiled'
];
{player addWeapon _x}forEach [
'M4A3_CCO_EP1',
'ItemFlashlight',
'ItemToolbox',
'ItemMap',
'Binocular',
'M9',
'ItemCompass'
];
player addBackpack 'DZ_CompactPack_EP1';
};
if(_isbandit3) then {
removeAllWeapons player;
removeAllItems player;
removeBackpack player;
player addWeapon "Loot";
player addWeapon "Flare";
{player addMagazine _x}forEach [
'ItemBandage',
'ItemBandage',
'100Rnd_762x51_M240',
'100Rnd_762x51_M240',
'15Rnd_9x19_M9SD',
'15Rnd_9x19_M9SD',
'ItemSodaMdew',
'ItemPainkiller',
'FoodNutmix',
'ItemMorphine',
'ItemBloodbag',
'ItemWaterbottleBoiled'
];
{player addWeapon _x}forEach [
'Mk_48_DZ',
'ItemGPS',
'ItemCompass',
'ItemToolbox',
'ItemMatchbox',
'Binocular',
'M9SD'
];
player addBackpack 'DZ_GunBag_EP1';
};
if(_isbandit4) then {
removeAllWeapons player;
removeAllItems player;
removeBackpack player;
player addWeapon "Loot";
player addWeapon "Flare";
{player addMagazine _x}forEach [
'ItemBandage',
'ItemBandage',
'30Rnd_556x45_StanagSD',
'30Rnd_556x45_StanagSD',
'15Rnd_9x19_M9SD',
'15Rnd_9x19_M9SD',
'ItemSodaRbull',
'ItemPainkiller',
'FoodMRE',
'ItemMorphine',
'ItemBloodbag',
'ItemWaterbottleBoiled'
];
{player addWeapon _x}forEach [
'M4A1_Aim_SD_camo',
'ItemGPS',
'ItemToolbox',
'Binocular_Vector',
'M9SD',
'ItemCompass'
];
player addBackpack 'DZ_TK_Assault_Pack_EP1';
};
if(_isbandit5) then {
removeAllWeapons player;
removeAllItems player;
removeBackpack player;
player addWeapon "Loot";
player addWeapon "Flare";
{player addMagazine _x}forEach [
'ItemBandage',
'ItemBandage',
'20Rnd_762x51_DMR',
'20Rnd_762x51_DMR',
'15Rnd_9x19_M9SD',
'15Rnd_9x19_M9SD',
'ItemSodaOrangeSherbet',
'ItemPainkiller',
'FoodSteakCooked',
'ItemMorphine',
'ItemBloodbag',
'ItemWaterbottleBoiled'
];
{player addWeapon _x}forEach [
'DMR_DZ',
'ItemGPS',
'ItemToolbox',
'Binocular_Vector',
'ItemCrowbar',
'M9SD',
'ItemCompass'
];
player addBackpack 'DZ_LargeGunBag_EP1';
};
};

 

And this is my call in init.sqf

if (!isDedicated) then {
//Conduct map operations
0 fadeSound 0;
waitUntil {!isNil "dayz_loadScreenMsg"};
dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
 
//Run the player monitor
_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
[] execVM "Custom\loadout.sqf";
_playerMonitor = [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
 
 
//anti Hack
//AH removed this line v2.1
//[] execVM "\z\addons\dayz_code\system\antihack.sqf";
 
//Lights
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
 
//DZAI
_nul = [] execVM "DZAI_Client\dzai_initclient.sqf";
 
};
 
//AH removed this line v2.1
//#include "\z\addons\dayz_code\system\REsec.sqf"
//Start Dynamic Weather
execVM "\z\addons\dayz_code\external\DynamicWeatherEffects.sqf";
 
//Safezones
[] execVM 'Custom\safezone.sqf';
 
#include "\z\addons\dayz_code\system\BIS_Effects\init.sqf"
 

 

Link to comment
Share on other sites

  • 0

Hey all! Trying to get this to work, but not having any luck at the moment  ^_^

 

Here is my loadout.sqf:

Private ["_humanity"];

waitUntil {!isNil ("PVDZE_plr_LoginRecord")}; // Check that player is logged in
_humanity = (player getVariable["humanity",0]); // Get and set humanity

if (dayzPlayerLogin2 select 2 and !(player isKindOf "PZombie_VB")) then { // Check if player is new spawn and not zombified

	if (_humanity >= 12500) then {
		diag_log ("GRANTING HERO LOADOUT TO PLAYER"); // Does not work, syntax is wrong - Gewch will fix during next maintenance period

		// Remove default loadout
		removeAllWeapons player;
		removeAllItems player;
		removeBackpack player;

		//Bug fix (f key to switch to flare)
		player addWeapon "Loot";
		player addWeapon "Flare";

		//Overridden inventory here
		player addMagazine '30Rnd_556x45_StanagSD';
		player addWeapon 'RH_hk416sd';
		player addMagazine '30Rnd_556x45_StanagSD';
		player addMagazine 'RH_6Rnd_44_Mag';
		player addWeapon 'RH_bull';
		player addWeapon 'ItemMap';
		player addMagazine 'RH_6Rnd_44_Mag';
		player addMagazine 'ItemWaterbottleBoiled';
		player addMagazine 'FoodSteakCooked';
		player addMagazine 'ItemBandage';
		player addMagazine 'ItemBandage';
		player addMagazine 'ItemMorphine';
		player addMagazine 'ItemPainkiller';
		player addBackpack 'TK_ALICE_Pack_EP1';
	}; else {
	
	if (_humanity > 7500) && (_humanity < 12500) then {
		diag_log ("GRANTING GOOD GUY LOADOUT TO PLAYER");

		// Remove default loadout
		removeAllWeapons player;
		removeAllItems player;
		removeBackpack player;

		//Bug fix (f key to switch to flare)
		player addWeapon "Loot";
		player addWeapon "Flare";

		//Overridden inventory here
		player addMagazine '30Rnd_556x45_Stanag';
		player addWeapon 'RH_hk416';
		player addMagazine '30Rnd_556x45_Stanag';
		player addMagazine 'RH_6Rnd_44_Mag';
		player addWeapon 'RH_bull';
		player addWeapon 'ItemMap';
		player addMagazine 'RH_6Rnd_44_Mag';
		player addMagazine 'ItemWaterbottleBoiled';
		player addMagazine 'FoodSteakCooked';
		player addMagazine 'ItemBandage';
		player addMagazine 'ItemBandage';
		player addMagazine 'ItemMorphine';
		player addMagazine 'ItemPainkiller';
		player addBackpack 'DZ_British_ACU';
	}; else {
	
	if (_humanity <= -7500) then {
		diag_log ("GRANTING BANDIT LOADOUT TO PLAYER");

		// Remove default loadout
		removeAllWeapons player;
		removeAllItems player;
		removeBackpack player;

		//Bug fix (f key to switch to flare)
		player addWeapon "Loot";
		player addWeapon "Flare";

		//Overridden inventory here
		player addMagazine '10Rnd_762x54_SVD';
		player addWeapon 'SVD';
		player addMagazine '10Rnd_762x54_SVD';
		player addMagazine 'RH_6Rnd_44_Mag';
		player addWeapon 'RH_bull';
		player addWeapon 'ItemMap';
		player addMagazine 'RH_6Rnd_44_Mag';
		player addMagazine 'ItemWaterbottleBoiled';
		player addMagazine 'FoodSteakCooked';
		player addMagazine 'ItemBandage';
		player addMagazine 'ItemBandage';
		player addMagazine 'ItemMorphine';
		player addMagazine 'ItemPainkiller';
		player addBackpack 'TK_ALICE_Pack_EP1';
	}; else {
	
	if (_humanity > -7500) && (_humanity < -2500) then {
		diag_log ("GRANTING BAD GUY LOADOUT TO PLAYER");

		// Remove default loadout
		removeAllWeapons player;
		removeAllItems player;
		removeBackpack player;

		//Bug fix (f key to switch to flare)
		player addWeapon "Loot";
		player addWeapon "Flare";

		//Overridden inventory here
		player addMagazine '30Rnd_762x39_AK47';
		player addWeapon 'vil_AKS_47';
		player addMagazine '30Rnd_762x39_AK47';
		player addMagazine 'RH_6Rnd_44_Mag';
		player addWeapon 'RH_bull';
		player addWeapon 'ItemMap';
		player addMagazine 'RH_6Rnd_44_Mag';
		player addMagazine 'ItemWaterbottleBoiled';
		player addMagazine 'FoodSteakCooked';
		player addMagazine 'ItemBandage';
		player addMagazine 'ItemBandage';
		player addMagazine 'ItemMorphine';
		player addMagazine 'ItemPainkiller';
		player addBackpack 'DZ_British_ACU';
	};
	};
	};
	};
	
	
}; // END IF FOR NEW SPAWN

*I had just if statements instead of else-if, but that didn't work either.*

 

I tried putting the exec before and after the player monitor section in the init.sqf, also. I still spawn the default loadout at various humanities.

 

I will most likely switch to using {player addMagazine _x}forEach []; and that, but I'm wondering why the conditionals aren't being met.

 

Any help would be much appreciated  :lol:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...