[REQ] Random Starting Gear

DangerRuss

OpenDayZ Rockstar!
actually Im curious about this myself and that first link you posted is worthless. It links to another page that's 404 and there's not other explanation in the thread.
 
In player login or player setup in your days server.pbo Forget which one, it loads in the players gear and skin from the hive. Right below that, Put in an array of gear you want and select from that randomly.
This is the function you need to use and the example seems clear.
https://community.bistudio.com/wiki/BIS_fnc_selectRandom
You need to make sure you use one array just for weapons and one for items. A good reference would be the sargeAI where it selects random gear for the ai.
 
In player login or player setup in your days server.pbo Forget which one, it loads in the players gear and skin from the hive. Right below that, Put in an array of gear you want and select from that randomly.
This is the function you need to use and the example seems clear.
https://community.bistudio.com/wiki/BIS_fnc_selectRandom
You need to make sure you use one array just for weapons and one for items. A good reference would be the sargeAI where it selects random gear for the ai.

https://github.com/Swiss-Sarge/DayZ...er/dayz_server/compile/server_playerLogin.sqf
Here is the file to edit them lines 65 to 87 is where it reads in the data base gear so just after that clear all the inventory then insert your select random gear function an
 
In player login in your days server.pbo it loads in the players gear and skin from the hive. Right below that, Put in an array of gear you want and select from that randomly.
This is the function you need to use and the example seems clear.
https://community.bistudio.com/wiki/BIS_fnc_selectRandom
You need to make sure you use one array just for weapons and one for items. A good reference would be the sargeAI where it selects random gear for the ai.

https://github.com/Swiss-Sarge/DayZ...er/dayz_server/compile/server_playerLogin.sqf
Here is the file to edit. See lines 65 to 87 is where it reads in the data base gear so just after that clear all the inventory then insert your select random gear function

I can post code when I get home if needed.
 
In player login in your days server.pbo it loads in the players gear and skin from the hive. Right below that, Put in an array of gear you want and select from that randomly.
This is the function you need to use and the example seems clear.
https://community.bistudio.com/wiki/BIS_fnc_selectRandom
You need to make sure you use one array just for weapons and one for items. A good reference would be the sargeAI where it selects random gear for the ai.

https://github.com/Swiss-Sarge/DayZ...er/dayz_server/compile/server_playerLogin.sqf
Here is the file to edit. See lines 65 to 87 is where it reads in the data base gear so just after that clear all the inventory then insert your select random gear function

I can post code when I get home if needed.
 
https://github.com/Swiss-Sarge/DayZ...er/dayz_server/compile/server_playerLogin.sqf
Now I am home and can read that sqf file easier, you want to replace the code between line 87 and 110 (or thereabouts) with your random weapon functions. The first part, 65-87 is for returning players and gets the gear from the database .. you WANT that. What you want to change is the part where it assigns gear to new players which starts at the else { on line 95

There are two parts to this: *this is the part you will edit*
Code:
// Record initial inventory
    _config     = (configFile >> "CfgSurvival" >> "Inventory" >> "Default");
    _mags         = getArray (_config >> "magazines");
    _wpns         = getArray (_config >> "weapons");
    _bcpk         = getText (_config >> "backpack");
This gets an array of magazines and weapons and a backpack(in text) from the configfile, and then it saves it to the database in this line
Code:
    _key = format["CHILD:203:%1:%2:%3:", _charID, [_wpns, _mags], [_bcpk, [], []]];
So what you want is to replace the _mags =, _wpns = and _bcpk = with
an array of magazines (items that go into your INVENTORY, not weapons or special items like the compass, map etc) .. so _mags = ["flare","magazine1","can of soup"]; and then _wpns = ["rifle","map"]; and _bcpk= "alice pack";
And you need to use the select random function to get items into that array.
 
I dont know why it would only work with epoch ... do I look like one of those epoch fags? With all that UNDERSERVED and UNEARNED gear bought from those traders using 46 different types of money? Epoch and now especially Overpoch might as well spawn every player with a weapons crate so they can just choose all the gear they want. :p

That is a vanilla dayz solution I explained.
 

DangerRuss

OpenDayZ Rockstar!
I dont know why it would only work with epoch ... do I look like one of those epoch fags? With all that UNDERSERVED and UNEARNED gear bought from those traders using 46 different types of money? Epoch and now especially Overpoch might as well spawn every player with a weapons crate so they can just choose all the gear they want. :p

That is a vanilla dayz solution I explained.
hahaha my mistake! hahah
I thought only epoch used cfgsurvival
 
Nope, that was directly from my Dayz 1.8.0.3 server_playerlogin.sqf file.
Here is some non-functional code, untested and just off the top of my head. But it gives you the idea of what you have to do. The default gear is retrieved from the config file and then we overwrite those values with the random values. And then the values are written to the database for the player.

Code:
//Record initial inventory
    _config = (configFile >> "CfgSurvival" >> "Inventory" >> "Default");
    _mags = getArray (_config >> "magazines");
    _wpns = getArray (_config >> "weapons");
    _bcpk = getText (_config >> "backpack");
    _randomSpot = true;
   
//******************************RANDOM GEAR CODE************************
    //this selects a random ARRAY of the weapon and its specific ammo
    _weapon = [["m16a2","30Rnd_556x45_Stanag"],["AK_47_S","30Rnd_762x39_AK47"]] call BIS_fnc_selectRandom;
    _tools = ["map","gps"]call BIS_fnc_selectRandom;
    _items = ["bakedbeans","soda"]call BIS_fnc_selectRandom;
     _backpack = ["alicepack","coyotepack","fagbag"]call BIS_fnc_selectRandom;

    //*********overwrite the default values with what we randomly selected above*******
     _bcpk = _backpack;
    _wpns = [_weapon select 0,_tools];
    _mags = [_weapon select 1,_items];
//*****************************END RANDOM SELECTION*******************
   
    //Wait for HIVE to be free
    _key = format["CHILD:203:%1:%2:%3:",_charID,[_wpns,_mags],[_bcpk,[],[]]];
    _key call server_hiveWrite;
 
Top