Jump to content
  • 0

[TUTORIAL] Custom Starting Loadout and Admin/Mod/Donator Loadouts (w/ UIDs)


mysticviperx

Question

So I have been getting a lot of help from here with setting up my server, so I figured I would start making Tutorials on what I have learned.

 

As follows are the instructions to change the starting gear from the default "bandage/painkiller/flashlight" to what ever you want, and how to set up custom gear for different users based on their UIDs. This is not completely my work, some came from Axeman and AsianKid.

 

Original Post

 

Setting Up the Default Load-out (no custom loadouts)

 

To start, this is tested on 1.0.2.4-5, and uses variables that Epoch Devs added to the Server Code.

DefaultMagazines = [];
DefaultWeapons = [];
DefaultBackpack = "";

DefaultMagazines is for any item you place in your primary(food, ammo, parts, money) or secondary(bandages, clips, m203 rounds) inventory.

DefaultWeapons is for any guns/rifles or kit(hatchet, map, Bbnoculars, NVGs) items.

DefaultBackpack is as it would sound, the pack you start out with.

 

You will also see DefaultBackpackWeapon = ""; in my loadout script, I assume it adds items to your back pack, but I don't know its limitations, if I can use guns and ammo.

 

Inserting it into your code is easy. Open the init.sqf in your mission folder or mission.pbo.

 

At about line 20 of a stock Epoch init.sqf file you will find this:

// DayZ Epoch config
spawnShoremode = 1; // Default = 1 (on shore)
spawnArea= 1500; // Default = 1500
MaxHeliCrashes= 5; // Default = 5
MaxVehicleLimit = 300; // Default = 50
MaxDynamicDebris = 500; // Default = 100
dayz_MapArea = 14000; // Default = 10000
dayz_maxLocalZombies = 30; // Default = 30 

Below this, add the following:

//Default Loadout
DefaultMagazines = ["ItemBandage","ItemBandage","17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemMorphine","ItemPainkiller","ItemWaterbottleBoiled","FoodSteakCooked"];
DefaultWeapons = ["glock17_EP1","ItemFlashlight","ItemHatchet"];
DefaultBackpack = "DZ_Patrol_Pack_EP1";
DefaultBackpackWeapon = "";

Here I have configured the default load-out to be a G17 and 2 clips, 2 bandages, one Morphine, Painkillers, Clean Water, Cooked Steak, a Flashlight and Hatchet. You can change the variables your self to what would be best for your server, including removing everything so players don't even get the stock dayz load-out.

 

Custom Load-Outs (includes default load-out)

 

But, you want even more controls, like load-outs for donators or admins. Thats easy, instead of the above we are going to put all the settings in a loadout.sqf and save that to a "Scripts" folder in our mission folder or mission.pbo.

 

First, create a new folder in the Mission folder or PBO named Scripts.

Then Create a new text document in that folder called "loadout.sqf", is will warn you that you are changing the file type, thats ok.

 

Copy this code into your new lodout.sqf:

//Default Loadout
DefaultMagazines = ["ItemBandage","ItemBandage","17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemMorphine","ItemPainkiller","ItemWaterbottleBoiled","FoodSteakCooked"];
DefaultWeapons = ["glock17_EP1","ItemFlashlight","ItemHatchet"];
DefaultBackpack = "DZ_Patrol_Pack_EP1";
DefaultBackpackWeapon = "";

//Admin Loadout
if ((getPlayerUID player) in ["12345678","98765432"]) then {  //Admins: Nobody, Somebody
	DefaultMagazines = ["ItemBandage","ItemBandage","ItemBandage","ItemBandage","17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemWaterbottleBoiled","ItemWaterbottleBoiled","FoodSteakCooked","20Rnd_B_AA12_74Slug","20Rnd_B_AA12_Pellets","20Rnd_B_AA12_Pellets","ItemGoldBar10oz"];
	DefaultWeapons = ["glock17_EP1","AA12_PMC","Binocular_Vector","NVGoggles","ItemMap","ItemCompass","ItemGPS","ItemWatch","ItemKnife","Itemtoolbox","ItemCrowbar","Itemetool","ItemHatchet"];
	DefaultBackpack = "DZ_LargeGunBag_EP1";
	DefaultBackpackWeapon = "";
	};

//Moderator Loadout
if ((getPlayerUID player) in ["14725836"]) then {   //Moderators: ThatOtherGuy
	DefaultMagazines = ["ItemBandage","ItemBandage","ItemBandage","ItemBandage","17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemWaterbottleBoiled","ItemWaterbottleBoiled","FoodSteakCooked","8Rnd_B_Saiga12_Pellets","8Rnd_B_Saiga12_Pellets","8Rnd_B_Saiga12_74Slug","ItemGoldBar10oz"];
	DefaultWeapons = ["glock17_EP1","Saiga12K","Binocular_Vector","NVGoggles","ItemMap","Itemtoolbox"];
	DefaultBackpack = "DZ_Backpack_EP1";
	DefaultBackpackWeapon = "";
	};

//Pro-Donator Loadout
if ((getPlayerUID player) in ["96385274"]) then {  //Pro-Donators: MoneyBags
	DefaultMagazines = ["ItemBandage","ItemBandage","ItemBandage","ItemBandage","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemWaterbottleBoiled","ItemWaterbottleBoiled","FoodSteakCooked","8Rnd_B_Beneli_Pellets","8Rnd_B_Beneli_Pellets","8Rnd_B_Beneli_74Slug","ItemGoldBar10oz"];
	DefaultWeapons = ["M9SD","Remington870_lamp","Binocular","ItemMap","ItemCompass","ItemFlashlightRed","ItemKnife","ItemMatchbox","ItemHatchet"];
	DefaultBackpack = "DZ_GunBag_EP1";
	DefaultBackpackWeapon = "";
	};

//Donator Loadout
if ((getPlayerUID player) in ["456789123"]) then {  //Donators: Nobody
	DefaultMagazines = ["ItemBandage","ItemBandage","ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","ItemGoldBar","15Rnd_W1866_Slug","15Rnd_W1866_Slug"];
	DefaultWeapons = ["glock17_EP1","Winchester1866","ItemMap","ItemFlashlightRed","ItemHatchet"];
	DefaultBackpack = "DZ_ALICE_Pack_EP1";
	DefaultBackpackWeapon = "";
	};

Hit save then start looking it over. Here we set the default loadout, then we check to see if the player is anyone we know from admins to donators, and set their loadout outs accordingly.

 

You will need the Players UID you can ask them for it, or if they have been on your server and you have database access then you can find it under "player_data".

 

In the code put their UID in the same place you see the seven or eight number groupings surrounded by parenthesis "  and seperated by commas , if you are setting more than one user for that group. I also write their names at the end of the line in the order that they are placed so I can go back and remember them later.

 

You can edit the different load-outs for each User Group and add more by copying one group and changing the UIDs.

 

Safe the file and Open your init.sqf in your mission folder or mission.pbo. Fine the following lines:

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;}];
	_playerMonitor = 	[] execVM "\z\addons\dayz_code\system\player_monitor.sqf";	
	_void = [] execVM "R3F_Realism\R3F_Realism_Init.sqf";
	
	//Lights
	//[0,0,true,true,true,58,280,600,[0.698, 0.556, 0.419],"Generator_DZ",0.1] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
};

Above "//Run the player monitor" add the following:

	//Custom Loadouts
	[] ExecVM "Scripts\loadout.sqf";

Now we have called the load-out script, and the world is a better place. Save your work, upload your files, and start your server to test out the scripts. Remember, you have to re-spawn for it to work.

 

 

UPDATE

So with each update the epoch devs are giving us server admins more varibles to call and edit in our init.sqf. My hope is they will add a varible to set the default skin when you load in. (logic must be applied when users select between a Male and Female character. Either it ignores females, or it allows for a array to be set: ["Male_Skin","Female_Skin"]) 

 

Further, I would like to make it easyier to set up items in these arrays, but as with everything, it becomes hard. I myself had to visit no less that 5 diffrent sorces to find all the "Item IDs" for diffrent items. But, my current data base is pretty current, with most of the non-OP items listed. Here is a link of the items you can buy and sell on my server all listed by their "ItemID" and organised in a way thats easy to read.

 

As for posts 8-13, I can give no reasoning why the script is failing for them. I my self have broken it many times by forgetting a comma between UIDs, but this only leads to players not getting their custom loadouts, I have not experianced any server issues or stalls from this edit, and I will be the first to admit I dont always know what I'm doing and I am always breaking my server with something.

Link to comment
Share on other sites

Recommended Posts

  • 0
_uid = getPlayerUID player;
switch (_uid) do {
	case "xxxx": {
		// Server Admins
		DefaultMagazines = ["ItemBandage","ItemBandage","ItemPainkiller","HandRoadFlare","30Rnd_9x19_UZI","30Rnd_9x19_UZI","Skin_Sniper1_DZ"]; 
		DefaultWeapons = ["ItemWatch","ItemMap","ItemHatchet_DZE","ItemFlashlight","UZI_EP1"]; 
		DefaultBackpack = "DZ_ALICE_Pack_EP1"; 
	};
	case "xxxx": {
		// Support
		DefaultMagazines = ["ItemBandage","ItemBandage","ItemPainkiller","HandRoadFlare","30Rnd_9x19_UZI","30Rnd_9x19_UZI"]; 
		DefaultWeapons = ["ItemWatch","ItemMap","ItemHatchet_DZE","ItemFlashlight","UZI_EP1"]; 
		DefaultBackpack = "DZ_ALICE_Pack_EP1"; 
	};
	case "xxxx": {
		// Normal Donator
		DefaultMagazines = ["ItemBandage","ItemBandage","ItemPainkiller","HandRoadFlare","30Rnd_9x19_UZI","30Rnd_9x19_UZI","Skin_CZ_Special_Forces_GL_DES_EP1_DZ"]; 
		DefaultWeapons = ["ItemWatch","ItemMap","ItemHatchet_DZE","ItemFlashlight","UZI_EP1"]; 
		DefaultBackpack = "DZ_ALICE_Pack_EP1"; 
	};
	case "xxxx": {
		// Super Donator
		DefaultMagazines = ["ItemBandage","ItemBandage","ItemPainkiller","30Rnd_9x19_UZI","30Rnd_9x19_UZI","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","Skin_Soldier_Sniper_PMC_DZ"]; 
		DefaultWeapons = ["ItemWatch","ItemMap","ItemHatchet_DZE","NVGoggles","UZI_EP1","M4A1_AIM_SD_camo"]; 
		DefaultBackpack = "DZ_Backpack_EP1"; 
        };
		Default{
		DefaultMagazines = ["ItemBandage","ItemBandage","ItemPainkiller","HandRoadFlare","30Rnd_9x19_UZI","30Rnd_9x19_UZI"]; 
		DefaultWeapons = ["ItemWatch","ItemFlashlight","UZI_EP1"]; 
		DefaultBackpack = "DZ_Patrol_Pack_EP1";
	};
};

its right?

Link to comment
Share on other sites

  • 0

If you read about the performance between if and switch you would know that nested if's are faster than switch case. just replace the GGsomething with an array or define them in your variables

 

and if you chooce an array remeber an array looks like thi

 

["0","0","0"]

 

Performance in what way? We wound up switching to switch statements because using the default loadout that comes default with epoch loaded only half the time.

 

Do you refer to performance when the player loads in? or overall server performance. We have not noticed a difference.

Link to comment
Share on other sites

  • 0

i'm referring to bohemias own site regarding code optimization where they state that nested if's are faster than switch case. As you will see if you go a bit back I used to use switch case () So I have done my fair share of testing difference between nested IF's and Switch case and i do see performance increase. it's very little but if you add that up with other performance increases then you suddenly have alot, so never ignore the small performance increases ;)

It would be both Client and server as the waiting time every time a client spawns goes down so the client and server don't have to wait for responses to keep going.

Link to comment
Share on other sites

  • 0

EDIT: Did some changes and everyone gets the loadout 100%. Server lag or not getting gender selection does not effect it anymore. The default loadout that a normal player gets works everytime also.

Step one:

Default loadout. Placed inside the Dayz Epoch Config. In your init.sqf.

DZE_DeathMsgGlobal = true; 
spawnShoremode = 0;
spawnArea= 1500;
MaxVehicleLimit = 150;
MaxDynamicDebris = 0;
dayz_MapArea = 12000;

DefaultMagazines = ["ItemMorphine","ItemBandage","7Rnd_45ACP_1911","7Rnd_45ACP_1911"];
DefaultWeapons = ["Colt1911","ItemCompass","ItemGPS","ItemHatchet_DZE"];
DefaultBackpack = "DZ_TK_Assault_Pack_EP1";
DefaultBackpackWeapon = "";

dayz_paraSpawn = true;

Step 2:

Create a new sqf file named loadout and place this code in it.

My loadout.sqf

waitUntil {(getPlayerUID player) != ""};
_loadList = ["xxxxxxxxx","xxxxxxxxx","xxxxxxxxx"];
_lpID = getPlayerUID player;

//CL1 *** player ***
if ((_lpID in ["xxxxxxxxx"]) && (_lpID in _loadList)) then {
DefaultMagazines = ["5Rnd_86x70_L115A1","Skin_Soldier1_DZ"];
DefaultWeapons = ["ItemCompass","BAF_LRR_scoped"];
DefaultBackpack = "DZ_Backpack_EP1";
DefaultBackpackWeapon = "";
};

//CL2 *** player ***
if ((_lpID in ["xxxxxxxxx"]) && (_lpID in _loadList)) then {
DefaultMagazines = ["5Rnd_86x70_L115A1","Skin_Soldier1_DZ"];
DefaultWeapons = ["ItemCompass","BAF_LRR_scoped"];
DefaultBackpack = "DZ_Backpack_EP1";
DefaultBackpackWeapon = "";
};

//CL3 *** player ***
if ((_lpID in ["xxxxxxxxx"]) && (_lpID in _loadList)) then {
DefaultMagazines = ["5Rnd_86x70_L115A1","Skin_Soldier1_DZ"];
DefaultWeapons = ["ItemCompass","BAF_LRR_scoped"];
DefaultBackpack = "DZ_Backpack_EP1";
DefaultBackpackWeapon = "";
};

In your Init.sqf place the [] execVM "Scripts\loadout.sqf"; inside the if (!isDedicated) then {

My Init.sqf

if (!isDedicated) then {
	0 fadeSound 0;
	waitUntil {!isNil "dayz_loadScreenMsg"};
	dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
	[] execVM "Scripts\loadout.sqf";
	[] execVM "Scripts\kh_actions.sqf";
	
	_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
	_playerMonitor = 	[] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
	[] execVM "Scripts\safezone.sqf";
};

Remember you can add as many loadouts as you want. I have over 60 in mine. Works perfect if you want everyone to have a different loadout.

Edited by syco
Link to comment
Share on other sites

  • 0

When loading up my game, I get this error.

 

"Script Scripts/loadouts.sqf not found"

 

This doesn't contain any information that we can use to help you. All we can do is look at that and say, you are missing your loadouts.sqf.

 

Do you have a loadouts.sqf?

Is it spelled correctly?

Is it located inside the scripts directory?

Link to comment
Share on other sites

  • 0

This doesn't contain any information that we can use to help you. All we can do is look at that and say, you are missing your loadouts.sqf.

 

Do you have a loadouts.sqf?

Is it spelled correctly?

Is it located inside the scripts directory?

 

I have pretty much everything setup, just dont know where to put loadouts.sqf

Link to comment
Share on other sites

  • 0

I would go back to page 1 and follow the step by step Tutorial and then come back with questions if that doesn't work.

 

The procedure works exactly as it is written. As long as you follow step by step what it tells you to do you should be fine.

 

Remember, tutorials are made for those not that great at coding so let the procedure help you be successful.

Link to comment
Share on other sites

  • 0

Ok so I uploaded that file to my server but I still spawned in with default weapons

 

Now that you do not have any errors we know that it is setup right. Now we need to look either in the rpt (error log) or check our loadouts file to see if its setup right.

Link to comment
Share on other sites

  • 0

Here are my loadouts

//DeeFoe's Loadout
if ((getPlayerUID player) in ["NUMBER"]) then {  //Admins: Nobody, Somebody
DefaultMagazines = ["ItemBandage","ItemBandage","ItemBandage","ItemBandage","Itemtoolbox","20Rnd_762x51_FNFAL","ItemMorphine","30Rnd_9x19_UZI_SD","ItemBloodbag","ItemWaterbottleBoiled","ItemWaterbottleBoiled","FoodSteakCooked","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL"];
DefaultWeapons = ["FN_FAL_ANPVS4","UZI_SD_EP1","Binocular_Vector","NVGoggles","ItemMap","ItemCompass","ItemGPS","ItemWatch","ItemKnife","Itemtoolbox","ItemCrowbar","Itemetool","ItemHatchet"];
DefaultBackpack = "DZ_LargeGunBag_EP1";
DefaultBackpackWeapon = "";
};


//Noob's Layout
if ((getPlayerUID player) in ["NUMBER"]) then {
    DefaultMagazines = ["ItemBandage","ItemBandage","ItemMorphine","ItemBloodbag","ItemWaterbottleBoiled","FoodSteakCooked","ItemGoldBar10oz","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","15Rnd_9x19_M9SD"];
    DefaultWeapons = ["M4A3_CCO_EP1","M9SD","ItemCompass","ItemMap","Itemtoolbox"];
    DefaultBackpack = "DZ_LargeGunBag_EP1";
    DefaultBackpackWeapon = "";
    };

Not sure if this is my RPT or not

# 08:56 bin\config.bin/CfgMovesZombie/States/AmovPpneMrunSnonWnonDbr.InterpolateTo: item count not multiple of 2 (is 9)
13:08:56 bin\config.bin/CfgMovesZombie/States/AmovPpneMrunSnonWnonDbr.InterpolateTo: Bad move
13:08:56 bin\config.bin/CfgMovesZombie/States/AmovPpneMrunSnonWnonDfr.InterpolateTo: item count not multiple of 2 (is 11)
13:08:56 bin\config.bin/CfgMovesZombie/States/AmovPpneMrunSnonWnonDfr.InterpolateTo: Bad move
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDnon_medicEnd
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDnon_medic0S
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDnon_medic0
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDnon_medic1
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDnon_medic2
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDnon_medic3
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDr_medic3
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDr_medic4
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDr_medic5
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDnon_medic4
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDnon_medic5
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDr_medic0S
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDr_medic0
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDr_medic1
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.ConnectTo: Bad move AinvPknlMstpSnonWnonDr_medic2
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.InterpolateTo: Bad move AinvPknlMstpSnonWnonDnon_medic0S
13:08:56 bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.InterpolateTo: Bad move AinvPknlMstpSnonWnonDr_medic0S
13:09:12 "CLEANUP: INITIALIZING CLEANUP SCRIPT"
13:09:19 Warning: z\addons\dayz_communityassets\models\razor.p3d:0 Error while trying to generate ST for points: 214, 349, 208
13:10:13 "PDEATH: Player Died NUMBER"
13:14:12 "TIME SYNC: Local Time set to [2013,8,3,9,14]"
13:15:02 "RUNNING EVENT: supply_drop on [2014,4,28,9,15]"
13:19:12 "TIME SYNC: Local Time set to [2013,8,3,9,19]"
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...