Jump to content

[HOW TO] Default Starting Loadouts and Custom Loadouts through Database


Recommended Posts

This will allow you to do both a starting loadout as well as custom individual loadouts through the database finally.

 

DISCLAIMER: ONLY TESTED WITH .ST SERVERS SO IT MAY NOT WORK FOR EVERYONE!!!!

 

First you will need to replace your server_playerLogin with this http://pastebin.com/G4LHvFCZ once you have done so go into your database and run an sql for these 3 tables:

CREATE TABLE IF NOT EXISTS `instance` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `world_id` smallint(5) unsigned NOT NULL DEFAULT '1',
  `inventory` varchar(2048) NOT NULL DEFAULT '[]',
  `backpack` varchar(2048) NOT NULL DEFAULT '["DZ_Patrol_Pack_EP1",[[],[]],[[],[]]]',
  PRIMARY KEY (`id`),
  KEY `fk1_instance` (`world_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2760 ;
CREATE TABLE IF NOT EXISTS `cust_loadout` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `inventory` varchar(2048) NOT NULL,
  `backpack` varchar(2048) NOT NULL,
  `model` varchar(100) DEFAULT NULL,
  `description` varchar(1024) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=204 ;
CREATE TABLE IF NOT EXISTS `cust_loadout_profile` (
  `cust_loadout_id` bigint(20) unsigned NOT NULL,
  `unique_id` varchar(128) NOT NULL,
  PRIMARY KEY (`cust_loadout_id`,`unique_id`),
  KEY `fk2_cust_loadout_profile` (`unique_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Once you have done these you can now go into your instance and you can hit insert

 

First start with ID which would be your instance id.

Second would be world_id which would be 1.

Third would be inventory: player inventory goes [[weapons and tools],[ammo and items]]

Fourth would be backpack: backpacks go [backpack name,[[weapon],[#]],[[item, tool, ammo],[#,#,#]]]

 

All items are case sensitive and surrounded by quotes and commas

 

Example of an inventory:

INSERT INTO `instance` (`id`, `world_id`, `inventory`, `backpack`) VALUE
(####, 1, '[["ItemCompass","ItemHatchet"],["ItemBandage","ItemBandage"]]', '["",[[],[]],[[],[]]]');

Now you can also do your custom loadouts by going to cust_loadout and hitting insert.

 

Same thing applies to this but instead id would be the number of the loadout you want to assign the person.

 

Example of a cust_loadout:

INSERT INTO `cust_loadout` (`id`, `inventory`, `backpack`, `model`, `description`) VALUES
(1, '[["Makarov","ItemKnife","ItemMatchbox","ItemCompass","ItemMap","ItemHatchet","ItemFlashlight"],["ItemBandage","ItemBandage","8Rnd_9x18_Makarov","8Rnd_9x18_Makarov","ItemSodaCoke","FoodCanBakedBeans","ItemAntibiotic","ItemMorphine"]]', '["DZ_Patrol_Pack_EP1",[[],[]],[[],[]]]', NULL, 'Subscription Starter');

Then go to cust_loadout_profile and hit insert.

 

You will then put the id of the loadout you want to give the person and then place the unique_id of the individual inside that and hit go.

 

Example of a cust_loadout_profile:

 

INSERT INTO `cust_loadout_profile` (`cust_loadout_id`, `unique_id`) VALUES

(1, '#########');

 

And that is it, tested and working on .ST Servers.

Link to comment
Share on other sites

Think it only works on dayz ST, I have this in my files and it just overwrites with standaard gear :(  days.ST maybe has modified hive.dll ? 

Hive log:

2013-10-27 13:11:46 HiveExt: [Information] Result: ["PASS",false,"8",0,"Survivor2_DZ",0.96]
2013-10-27 13:11:46 HiveExt: [Information] Method: 203 Params: 8:[[ItemFlashlight],[ItemBandage,ItemPainkiller]]:[DZ_Patrol_Pack_EP1,[],[]]:

It gives normal items, not the items I have put in the DB.


EDIT: Hmm, I think you have uploaded the wrong playerlogin.sqf.. since there is no change from the original as far I can see... Can someone confirm ?
Link to comment
Share on other sites

Hmm, you are correct was super tired and ended up copy/pasting the wrong server_playerLogin.sqf have posted the correct pastebin now. Apologies,

Ah I see... unfortunately it use child 999 to get the data out of the database, epoch does not support this by default :(

Anyway, big thanks for the time you have put into it to post it here. 

I really hope child 999 wil be on epoch soon :(

Link to comment
Share on other sites

also if you are using st there is another way so you dont have to to use your database for people who dont want to mess with it 

 

just download your mission file from dayzst and open it 

 

then open your init.sqf

 

look for this line DZE_TRADER_SPAWNMODE = true; //Vehicles bought with traders will parachute in instead of just spawning on the ground.

 

right below it past these

DefaultMagazines = ["ItemBandage","ItemBandage","ItemPainkiller","ItemMap","8Rnd_9x18_MakarovSD","8Rnd_9x18_MakarovSD","8Rnd_9x18_MakarovSD"]; 
DefaultWeapons = ["MakarovSD"]; 
DefaultBackpack = "DZ_Assault_Pack_EP1"; 
DefaultBackpackWeapon = "";
 
this is a starting example u can change it around to what ever u like 
 
remember the magazines are items and ammo that you use
weapon is main and second hand weapons including crow bars bats and pistols and all the other stuff
and be sure to have the right names of the backpacks as if u don't have the ep and what not they will not load 
 
ps allways remember to use " " and , when spacing items but when you have added the last item do not end it with a , learned that after trying to figure out why my stuff wouldn't load
 
save repack and upload and wala done
 
also u can add certain uid and player ids to have certain gear with also but i will add that at a later time
Link to comment
Share on other sites

999 will not be getting shipped with epoch as it was reported to me by Tansien that there maybe security issues with the existing implementations of it. We really need to use the more updated 500-505 calls from the author of the hive. I assume that dayz.st has this figured out and secure if so please share your findings.

Link to comment
Share on other sites

  • 2 weeks later...

999 will not be getting shipped with epoch as it was reported to me by Tansien that there maybe security issues with the existing implementations of it. We really need to use the more updated 500-505 calls from the author of the hive. I assume that dayz.st has this figured out and secure if so please share your findings.

 

Are these currently implemented ?

How would I go about finding which calls do what to the database?  I don't mind working with the confines that are already in place, and if there are calls that you can pass table names to, that would be perfect.  But I've yet to find a listing of the CHILD:### along with example arguments to it, so that I may see which ones I could use for more customizations.

 

If you could point me in the right direction, that would be very much appreciated.

Link to comment
Share on other sites

  • 7 months later...
  • 1 month later...

CONFIRMED WORKING OVERPOCH 1.0.5.2/125548

 

Yes, I have been using it for ever.

IMHO it's the best way to achieve loadouts.

 

Small section of server_player_login.sqf 

ex.

 

if (count _this > 2) then {
dayz_players = dayz_players - [_this select 2];
};
 
//Stench
if (_playerID == "##################") then {
_inventory = [["RH_m9csd","RH_hk417sdacog","Binocular_Vector","NVGoggles","ItemMap","ItemMatchbox_DZE","ItemToolbox","ItemCompass","ItemGPS","ItemWatch","ItemKnife","ItemCrowbar","ItemEtool","ItemHatchet_DZE"],["ItemAntibiotic","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemWaterbottleBoiled","ItemWaterbottleBoiled","FoodSteakCooked","FoodSteakCooked","RH_20Rnd_762x51_SD_hk417","RH_20Rnd_762x51_SD_hk417","RH_20Rnd_762x51_SD_hk417","RH_20Rnd_762x51_SD_hk417","ItemBandage","ItemBandage","ItemBandage","ItemBandage","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD"]];
_backpack = ["DZ_LargeGunBag_EP1",[["RH_hk417sdsp","RH_m1stacog"],[1,1]],[["RH_20Rnd_762x51_SD_hk417","20Rnd_762x51_DMR","Skin_Soldier_TL_PMC_DZ"],[5,3,1]]]; };
 
//X
if (_playerID == "#####################") then {
_inventory = [["RH_m9csd","RH_hk417sdacog","Binocular_Vector","NVGoggles","ItemMap","ItemMatchbox_DZE","ItemToolbox","ItemCompass","ItemGPS","ItemWatch","ItemKnife","ItemCrowbar","ItemEtool","ItemHatchet_DZE"],["ItemAntibiotic","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemWaterbottleBoiled","ItemWaterbottleBoiled","FoodSteakCooked","FoodSteakCooked","RH_20Rnd_762x51_SD_hk417","RH_20Rnd_762x51_SD_hk417","RH_20Rnd_762x51_SD_hk417","RH_20Rnd_762x51_SD_hk417","ItemBandage","ItemBandage","ItemBandage","ItemBandage","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD"]];
_backpack = ["DZ_LargeGunBag_EP1",[["RH_hk417sdsp","RH_m1stacog"],[1,1]],[["RH_20Rnd_762x51_SD_hk417","20Rnd_762x51_DMR","Skin_Soldier_TL_PMC_DZ"],[5,3,1]]]; };
 
//Esco
if (_playerID == "#####################") then {
_inventory = [["RH_m9csd","RH_hk417sdacog","Binocular_Vector","NVGoggles","ItemMap","ItemMatchbox_DZE","ItemToolbox","ItemCompass","ItemGPS","ItemWatch","ItemKnife","ItemCrowbar","ItemEtool","ItemHatchet_DZE"],["ItemAntibiotic","ItemMorphine","ItemPainkiller","ItemBloodbag","ItemWaterbottleBoiled","ItemWaterbottleBoiled","FoodSteakCooked","FoodSteakCooked","RH_20Rnd_762x51_SD_hk417","RH_20Rnd_762x51_SD_hk417","RH_20Rnd_762x51_SD_hk417","RH_20Rnd_762x51_SD_hk417","ItemBandage","ItemBandage","ItemBandage","ItemBandage","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD"]];
_backpack = ["DZ_LargeGunBag_EP1",[["RH_hk417sdsp","RH_m1stacog"],[1,1]],[["RH_20Rnd_762x51_SD_hk417","20Rnd_762x51_DMR","Skin_Soldier_TL_PMC_DZ"],[5,3,1]]]; };
 
//Variables
//_inventory = [];
//_backpack = [];
_survival = [0,0,0];
_isInfected =   0;
_model = "";
 
Pro Tip: Do not use with Halo Spawn as your back pack spawns at your feet.
I used to fill my pack with bear_traps but they no longer function  :(
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
  • Discord

×
×
  • Create New...