Jump to content
  • 0

Donator Spawn loadout without Database triggers


MassAsster

Question

I've been toying around with how not to do database driven donator spawn loot, I've come up with this system that  I am currently testing.

 

Inside the server PBO, inside the compile folder  locate server_playerLogin.sqf

 

AFTER line

if (count _this > 2) then {
	dayz_players = dayz_players - [_this select 2];
};

Insert your custom user spawn setups.

if (_playerID == "3042438") then {
//MassAsster
_inventory =	[["ItemMap","ItemFlashlight","ItemWatch","ItemCompass","revolver_gold_EP1","AKS_GOLD"], ["ItemBandage","6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","30Rnd_762x39_AK47","ItemBandage","ItemPainkiller","ItemEpinephrine","ItemAntibiotic","ItemMorphine","ItemWaterbottle","FoodCanBakedBeans"]];
_backpack = 	["DZ_ALICE_Pack_EP1",[[],[]],[[],[]]]; };

if (_playerID == "3042694") then {
//Adam
_inventory =	[["ItemMap","ItemFlashlight","ItemWatch","ItemCompass","revolver_gold_EP1","AKS_GOLD"], ["ItemBandage","6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","30Rnd_762x39_AK47","ItemBandage","ItemPainkiller","ItemEpinephrine","ItemAntibiotic","ItemMorphine","ItemWaterbottle","FoodCanBakedBeans"]];
_backpack = 	["DZ_ALICE_Pack_EP1",[[],[]],[[],[]]]; };

if (_playerID == "3042630") then {
//jody
_inventory =	[["ItemMap","ItemFlashlight","ItemWatch","ItemCompass","revolver_gold_EP1","AKS_GOLD"], ["ItemBandage","6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","30Rnd_762x39_AK47","ItemBandage","ItemPainkiller","ItemEpinephrine","ItemAntibiotic","ItemMorphine","ItemWaterbottle","FoodCanBakedBeans"]];
_backpack = 	["DZ_ALICE_Pack_EP1",[[],[]],[[],[]]]; };

if (_playerID == "138731014") then {
//Greg
_inventory =	[["ItemMap","ItemFlashlight","ItemWatch","ItemCompass","revolver_gold_EP1","AKS_GOLD"], ["ItemBandage","6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","30Rnd_762x39_AK47","ItemBandage","ItemPainkiller","ItemEpinephrine","ItemAntibiotic","ItemMorphine","ItemWaterbottle","FoodCanBakedBeans"]];
_backpack = 	["DZ_ALICE_Pack_EP1",[[],[]],[[],[]]]; };

Comment out any spawn setups that may exist under these lines.

//Variables
//_inventory =	[[], []];
//_backpack = 	["DZ_ALICE_Pack_EP1",[[],[]],[[],[]]];
//_items = 		[];
//_magazines = 	[];
//_weapons = 		[];
//_medicalStats =	[];

Locate your Init inside your mission.pbo

 

Locate (if they are inside) or insert (if they are not)

DefaultMagazines = ["ItemBandage","ItemBandage","ItemMorphine"];
DefaultWeapons = ["ItemFlashlight","ItemWatch","ItemCompass"];
DefaultBackpack = "DZ_ALICE_Pack_EP1";
DefaultBackpackWeapon = "";

Notice I do not give out a weapon, if i give a pistol to my default setup, than it will cause a bug with my donators setup, donators will get two pistols overlaying each other... To resolve this you can simply not assign a pistol to the default like I have done, or you can assign a pistol to the default and not assign one to the donator, simply give the donator more ammo. Either way you want to work it.

 

 

Have fun!

Link to comment
Share on other sites

Recommended Posts

  • 0

Backpack code doesn't work for me but the inventory works great

 

// Cash Spawn with Gear
if (_playerID == "127485254") then {
//MassAsster
_inventory = [["NVGoggles","ItemToolbox","ItemWatch","ItemHatchet","ItemGPS","ItemEtool","ItemCompass","Binocular","ItemKnife","ItemMatchbox","SCAR_L_STD_EGLM_TWS","glock17_EP1"],["17Rnd_9x19_glock17","17Rnd_9x19_glock17","17Rnd_9x19_glock17","17Rnd_9x19_glock17","ItemBandage","ItemBandage","ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","100Rnd_556x45_BetaCMag","100Rnd_556x45_BetaCMag"]];
_backpack =  ["DZ_ALICE_Pack_EP1",[[],[]],[[],[]]]; };

//Variables
//_inventory = [];
//_backpack =  [];
//_items =   [];
//_magazines =  [];
//_weapons =   [];
//_medicalStats = [];
_survival =  [0,0,0];
//_tent =   [];
//_state =   [];
//_direction = 0;
_isInfected =   0;
_model =  "";
//_newUnit =  objNull;
//_botActive = false;
Link to comment
Share on other sites

  • 0

Ive placed this code into my server_playerLogin.sqf, but keep getting the default loadout that is listed in the mission init.sqf when I load in after dying.

 

Ive checked my player ID and made sure I commented out the mentioned parts. Is there anything else I should be looking for?

 

this is on HFB server if that matters at all.

Link to comment
Share on other sites

  • 0

I had that trouble in the beginning but I had forgotten to comment out

 

//Variables //_inventory = []; //_backpack =  []; //_items =   []; //_magazines =  []; //_weapons =   []; //_medicalStats = [];
Link to comment
Share on other sites

  • 0

@hawtrawkr

private ["_isInfected","_doLoop","_hiveVer","_isHiveOk","_playerID","_playerObj","_primary","_key","_charID","_playerName","_backpack","_isNew","_inventory","_survival","_model","_mags","_wpns","_bcpk","_config","_newPlayer"];
//Set Variables

diag_log ("STARTING LOGIN: " + str(_this));

_playerID = _this select 0;
_playerObj = _this select 1;
_playerName = name _playerObj;
//_worldspace = [];

if (_playerName == '__SERVER__' || _playerID == '' || local player) exitWith {};

// Cancel any login until server_monitor terminates. 
// This is mandatory since all vehicles must be spawned before the first players spawn on the map.
// Otherwise, all vehicle event handlers won't be created on players' client side.
if (isNil "sm_done") exitWith { diag_log ("Login cancelled, server is not ready. " + str(_playerObj)); };


if (count _this > 2) then {
	dayz_players = dayz_players - [_this select 2];
};

if (_playerID == "3042438") then {
//MassAsster
_inventory =	[["ItemMap","ItemFlashlight","ItemWatch","ItemCompass","revolver_gold_EP1","AKS_GOLD"], ["ItemBandage","6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","30Rnd_762x39_AK47","ItemBloodbag","ItemPainkiller","ItemEpinephrine","ItemAntibiotic","ItemMorphine","ItemWaterbottle","FoodCanBakedBeans"]];
_backpack = 	["DZ_ALICE_Pack_EP1",[[],[]],[[],[]]]; };

if (_playerID == "3042694") then {
//Adam
_inventory =	[["ItemMap","ItemFlashlight","ItemWatch","ItemCompass","revolver_gold_EP1","AKS_GOLD"], ["ItemBandage","6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","30Rnd_762x39_AK47","ItemBloodbag","ItemPainkiller","ItemEpinephrine","ItemAntibiotic","ItemMorphine","ItemWaterbottle","FoodCanBakedBeans"]];
_backpack = 	["DZ_ALICE_Pack_EP1",[[],[]],[[],[]]]; };

if (_playerID == "3042630") then {
//jody
_inventory =	[["ItemMap","ItemFlashlight","ItemWatch","ItemCompass","revolver_gold_EP1","AKS_GOLD"], ["ItemBandage","6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","30Rnd_762x39_AK47","ItemBloodbag","ItemPainkiller","ItemEpinephrine","ItemAntibiotic","ItemMorphine","ItemWaterbottle","FoodCanBakedBeans"]];
_backpack = 	["DZ_ALICE_Pack_EP1",[[],[]],[[],[]]]; };

if (_playerID == "138731014") then {
//Greg
_inventory =	[["ItemMap","ItemFlashlight","ItemWatch","ItemCompass","revolver_gold_EP1","AKS_GOLD"], ["ItemBandage","6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","30Rnd_762x39_AK47","ItemBloodbag","ItemPainkiller","ItemEpinephrine","ItemAntibiotic","ItemMorphine","ItemWaterbottle","FoodCanBakedBeans"]];
_backpack = 	["DZ_ALICE_Pack_EP1",[[],[]],[[],[]]]; };

if (_playerID == "141134726") then {
//Rengeki
_inventory =	[["ItemMap","ItemFlashlight","ItemWatch","ItemCompass","revolver_gold_EP1","AKS_GOLD"], ["ItemBandage","6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","30Rnd_762x39_AK47","30Rnd_762x39_AK47","ItemBloodbag","30Rnd_762x39_AK47","ItemEpinephrine","ItemPainkiller","ItemAntibiotic","ItemWaterbottle","FoodCanBakedBeans"]];
_backpack = 	["DZ_ALICE_Pack_EP1",[[],[]],[[],[]]]; };

//Variables
//_inventory =	[[], []];
//_backpack = 	["DZ_ALICE_Pack_EP1",[[],[]],[[],[]]];
//_items = 		[];
//_magazines = 	[];
//_weapons = 		[];
//_medicalStats =	[];
_survival =		[0,0,0];
//_tent =			[];
//_state = 		[];
//_direction =	0;
_isInfected =   0;
_model =		"";
//_newUnit =		objNull;
//_botActive = false;

if (_playerID == "") then {
	_playerID = getPlayerUID _playerObj;
};

if ((_playerID == "") or (isNil "_playerID")) exitWith {
	diag_log ("LOGIN FAILED: Player [" + _playerName + "] has no login ID");
};

//??? endLoadingScreen;
diag_log ("LOGIN ATTEMPT: " + str(_playerID) + " " + _playerName);

//Do Connection Attempt
_doLoop = 0;
while {_doLoop < 5} do {
	_key = format["CHILD:101:%1:%2:%3:",_playerID,dayZ_instance,_playerName];
	_primary = _key call server_hiveReadWrite;
	if (count _primary > 0) then {
		if ((_primary select 0) != "ERROR") then {
			_doLoop = 9;
		};
	};
	_doLoop = _doLoop + 1;
};

if (isNull _playerObj or !isPlayer _playerObj) exitWith {
	diag_log ("LOGIN RESULT: Exiting, player object null: " + str(_playerObj));
};

if ((_primary select 0) == "ERROR") exitWith {
    diag_log format ["LOGIN RESULT: Exiting, failed to load _primary: %1 for player: %2 ",_primary,_playerID];
};

//Process request
_newPlayer = 	_primary select 1;
_isNew = 		count _primary < 7; //_result select 1;
_charID = 		_primary select 2;
//_randomSpot = false;

//diag_log ("LOGIN RESULT: " + str(_primary));

/* PROCESS */
_hiveVer = 0;

if (!_isNew) then {
	//RETURNING CHARACTER		
	_inventory = 	_primary select 4;
	_backpack = 	_primary select 5;
	_survival =		_primary select 6;
	_model =		_primary select 7;
	_hiveVer =		_primary select 8;
	
	if (!(_model in AllPlayers)) then {
		_model = "Survivor2_DZ";
	};
	
} else {
	_isInfected =	_primary select 3;
	_model =		_primary select 4;
	_hiveVer =		_primary select 5;
	
	if (isNil "_model") then {
		_model = "Survivor2_DZ";
	} else {
		if (_model == "") then {
			_model = "Survivor2_DZ";
		};
	};

	//Record initial inventory only if not player zombie 
	if(_isInfected != 1) then {
		_config = (configFile >> "CfgSurvival" >> "Inventory" >> "Default");
		_mags = getArray (_config >> "magazines");
		_wpns = getArray (_config >> "weapons");
		_bcpk = getText (_config >> "backpack");

		if(!isNil "DefaultMagazines") then {
			_mags = DefaultMagazines;
		};
		if(!isNil "DefaultWeapons") then {
			_wpns = DefaultWeapons;
		};
		if(!isNil "DefaultBackpack") then {
			_bcpk = DefaultBackpack;
		};
		//_randomSpot = true;
	
		//Wait for HIVE to be free
		_key = format["CHILD:203:%1:%2:%3:",_charID,[_wpns,_mags],[_bcpk,[],[]]];
		_key call server_hiveWrite;
	};
};
diag_log ("LOGIN LOADED: " + str(_playerObj) + " Type: " + (typeOf _playerObj));

_isHiveOk = false;	//EDITED
if (_hiveVer >= dayz_hiveVersionNo) then {
	_isHiveOk = true;
};
//diag_log ("SERVER RESULT: " + str("X") + " " + str(dayz_hiveVersionNo));

//Server publishes variable to clients and WAITS
//_playerObj setVariable ["publish",[_charID,_inventory,_backpack,_survival,_isNew,dayz_versionNo,_model,_isHiveOk,_newPlayer],true];

dayzPlayerLogin = [_charID,_inventory,_backpack,_survival,_isNew,dayz_versionNo,_model,_isHiveOk,_newPlayer,_isInfected];
if(!isNull _playerObj) then {
	(owner _playerObj) publicVariableClient "dayzPlayerLogin";
};

full server_playerlogin.sqf

check it against yours.

Link to comment
Share on other sites

  • 0

The only differences was the syntax on some lines which had been commented out on both of our files and that I was running the version with removed spawn as zombie code. I removed it and made my file identical to yours and still no joy on the backpack. It spawns with the default but the inventory works great.

Link to comment
Share on other sites

  • 0

yeah, still working on the backpack thing,  anyone out there have an example of the proper pack set up?

 

I've attempted formatting like ["DZ_Backpack_EP1",[["G36A_camo"],[1]],[["30Rnd_556x45_Stanag","ItemMorphine","ItemPainkiller"],[4,3,3]]]

 

my next guess is to remove the formatting from the init for the backpack, but this would most likely cause your default loadout to not have one at all...

Link to comment
Share on other sites

  • 0

got it working. Turned out I was in need of a lesson on how not to backup dayz_server.pbo files. I was downloading the file to play with, but didn't realize that if I simply changed the name of the original file to origdayz_server.pbo while leaving it in the default location it would still be read by the server. I had to delete my original .pbo then the modified one worked for me.

 

thanks for the help and for sharing this with us MassAsster. it is much appreciated. I was able to realize what was going on when you shared your .pbo with me and I tried using it and got the same results as before. needless to say today was quite the learning experience for me.

Link to comment
Share on other sites

  • 0

I can't get this to work. Here's the sections that needed to be modified:

 

 

if (_playerID == "4358144") then {

//BetterDeadThanZed
_inventory = [["ItemMachete","ItemEtool","ItemMap"],["ItemBandage","ItemMorphine","ItemPainkiller","FoodCanBakedBeans","ItemWaterbottle","ItemAntibiotic"]];
_backpack = ["DZ_Patrol_Pack_EP1",[[],[]],[[],[]]]; };
 
// Statistics
//_inventory = [];
//_backpack = [];
//_items = [];
//_magazines = [];
//_weapons = [];
//_medicalStats = [];
_survival = [0,0,0];
_tent = [];
_state = [];
_direction = 0;
_model = "";
_newUnit = objNull;
_botActive = false;

 

 
I end up with the default loadout I defined in my init.sqf file, not the one listed above.
Link to comment
Share on other sites

  • 0

After death you ended up with the default load out?

You sure you replaced your server pbo ?

also your init will overwrite any changes you make into this system,  IE  if you define a starting pistol in both locations, your init will win. (technically you will have two pistols overlaying each other and you will have to drop the first pistol before having access to the 2nd one, but who's being specific)

Link to comment
Share on other sites

  • 0

After death you ended up with the default load out?

You sure you replaced your server pbo ?

also your init will overwrite any changes you make into this system,  IE  if you define a starting pistol in both locations, your init will win. (technically you will have two pistols overlaying each other and you will have to drop the first pistol before having access to the 2nd one, but who's being specific)

 

Yes, after death I had the loadout that was defined in init instead of server_playerLogin.sqf.

In my init file, I have this:

 

 

DefaultMagazines = ["ItemBandage","ItemMorphine","ItemPainkiller","FoodCanBakedBeans","ItemWaterbottle","ItemAntibiotic"]; 

DefaultWeapons = ["ItemMachete","ItemEtool"]; 
DefaultBackpack = "DZ_Patrol_Pack_EP1"; 
DefaultBackpackWeapon = "";

 

 
In my server_playerlogin.sqf I have what I posted above.
Link to comment
Share on other sites

  • 0

for one, you don't need to repeat your load out from the default into the donator section, your going to get what ever is in the default anyway.

the only difference I note is your receiving a ItemMap when you spawn?

 

Do this -

load your char up with the items you want to have - check the database for correct formatting on the item layout . the only thing i can think of at the moment is there is an error in the syntax of your item/weapon loadout

Link to comment
Share on other sites

  • 0

for one, you don't need to repeat your load out from the default into the donator section, your going to get what ever is in the default anyway.

the only difference I note is your receiving a ItemMap when you spawn?

 

Do this -

load your char up with the items you want to have - check the database for correct formatting on the item layout . the only thing i can think of at the moment is there is an error in the syntax of your item/weapon loadout

 

The custom loadout I put in the server_playerlogin.sqf was for testing purposes only. If I spawned with the gear I'm used to spawning with, plus a map, I know the custom loadout is working. No sense in coming up with a fancy custom loadout if it doesn't work, right? :)

 

The syntax for the custom loadout in server_playerlogin.sqf is copied directly from the init.sqf. Since the starting loadout defined in init.sqf works, I know the syntax is correct in the server_playerlogin.sqf. 

Link to comment
Share on other sites

  • 0

The best guess I have at the moment is the default layout may be over riding the donator load out on the tool belt items, try placing your tool belt items into the donator section exactly as they are in your default, then add your map. I've never attempted to just add a single item before but my experience with the tool belt items (pistol particularly) is that the default load will overwrite.

 

Example

 

Default - Slot1: GPS slot2: Tool box  slot3: crowbar

Custom- Slot1: Map

-------------------------------------------------------------------

Final:   Gps  toolbox   crowbar

 

 

 

Default - Slot1: GPS slot2: Tool box  slot3: crowbar

Custom- Slot1: GPS slot2: Tool box  slot3: crowbar slot4: map

-------------------------------------------------------------------

Final:   Gps  toolbox   crowbar map

Link to comment
Share on other sites

  • 0

When I first tested this, I used the example you provided just to see if it would work:

 

_inventory =    [["ItemMap","ItemFlashlight","ItemWatch","ItemCompass","revolver_gold_EP1","AKS_GOLD"], ["ItemBandage","6Rnd_45ACP","6Rnd_45ACP","6Rnd_45ACP","30Rnd_762x39_AK47","ItemBloodbag","ItemPainkiller","ItemEpinephrine","ItemAntibiotic","ItemMorphine","ItemWaterbottle","FoodCanBakedBeans"]];

 

but I spawned with the default loadout.

Link to comment
Share on other sites

  • 0

there has to be something your missing... something simple..

 

Confirm your GUID

Confirm total replacement of your server pbo

confirm total replacement of your mission pbo

 

inside your database - find your latest char file, set alive to 0 -  creating a brand new char on next load

Link to comment
Share on other sites

  • 0

Hi, 

 

I've tried this and it works almost like a charm. Only thing is that players, when they start a new char, spawn in the debug zone. When they log out to the lobby and log back in again, they spawn without a hitch and with the spawn gear.

 

Any idea why?

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
  • Advertisement
×
×
  • Create New...