[REQ] Random Starting Gear

Discussion in 'Support and Release' started by bFe, May 14, 2014.

  1. bFe

    bFe Member

    Joined:
    Feb 16, 2013
    Messages:
    78
    Likes Received:
    8
    Hi!

    Does anyone know where I can find a working script/whatever to get random starting gear on Overwatch?
     
  2. ||Marc||

    ||Marc|| New Member

    Joined:
    May 24, 2014
    Messages:
    1
    Likes Received:
    0
  3. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,220
    Likes Received:
    67
    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.
     
  4. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,220
    Likes Received:
    67
    does anyone have this? This is one thing I've been looking for a long time and am unable to find, yet I know it exists.
     
  5. Zupa

    Zupa New Member

    Joined:
    Nov 3, 2013
    Messages:
    7
    Likes Received:
    1
    easy to make, just put all items you want to be able in an array; Call 5 times BIS random function on it.
     
    DangerRuss likes this.
  6. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,220
    Likes Received:
    67
    too pro for me
     
  7. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,411
    Likes Received:
    336
    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.
     
    DangerRuss likes this.
  8. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,411
    Likes Received:
    336
    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
     
  9. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,411
    Likes Received:
    336
    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.
     
  10. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,411
    Likes Received:
    336
    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.
     
  11. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,411
    Likes Received:
    336
    Lol my cellphone kept stopping so I kept pressing post reply
     
  12. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,411
    Likes Received:
    336
    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.
     
    DangerRuss likes this.
  13. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,220
    Likes Received:
    67
    very well explained thanks for that!
     
  14. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,220
    Likes Received:
    67
    I think this would only work with epoch though. But I have something else to appease me for the time being thanks!
     
  15. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,411
    Likes Received:
    336
    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.
     
  16. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,220
    Likes Received:
    67
    hahaha my mistake! hahah
    I thought only epoch used cfgsurvival
     
  17. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,411
    Likes Received:
    336
    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;
     
    DangerRuss likes this.

Share This Page