[How-To] Customize the Starting Gear/Loadout (no custom dayz_code req.)

Discussion in 'General Discussion' started by Guidez, Mar 19, 2013.

  1. Guidez

    Guidez Member

    Joined:
    Oct 27, 2012
    Messages:
    30
    Likes Received:
    4
    It was interesting that all the replies from people on this subject say that only by modifying dayz_code can you achieve custom starting gear. That is only kinda true, as you can play on plenty of servers that have custom starting gear and they do not require you to download their own signed version of dayz_code. I'll be having an official video for this quick how-to later on (youtube dayzguidez), but in the meanwhile you can follow the below steps.

    Note: Like I said, "kinda true". You cannot remove the starting gear without editing dayz_code, but you can add on items. Also, until the video is out for this, the how-to is for ADVANCED users.

    1. Unpack dayz_server.pbo, and open compile/server_playerLogin.sqf
    2. Scroll down ~line 18, or simply search for "_inventory".
    3. Edit the line to your hearts content. For example:
    Code:
    _inventory =    [["ItemMap","ItemMatchbox"],["FoodMRE","8Rnd_9x18_Makarov"]];
    4. Re-pack dayz_server.pbo, and now any newly spawned characters will have the additional gear.

    As noted earlier, this will only APPEND items to the current loadout IE; your players will start with the usual painkillers, flashlight, and bandage. Also, be wary of line 77 which looks like the below.

    Code:
        _inventory =    _primary select 4;
    You do NOT want to edit that line, as that is for players returning to the server.
     
  2. Guidez

    Guidez Member

    Joined:
    Oct 27, 2012
    Messages:
    30
    Likes Received:
    4
    Editing the backpack line did NOT give me anything though, that one seems a bit trickier.
     
  3. WeaponTheyFear7

    WeaponTheyFear7 New Member

    Joined:
    Feb 13, 2013
    Messages:
    15
    Likes Received:
    0
    Thanks! Successfully added an M9 and two mags to my fresh spawns.
     
  4. McKeighan

    McKeighan Well-Known Member

    Joined:
    Jan 8, 2013
    Messages:
    103
    Likes Received:
    6
    There might be an easier way around this by just using database tables. I know in bliss you can set default loadouts, tied to a loadout id, and then assign that loadout id to each playerUID that is to get the custom loadout.

    With Pwonzor's pack, the database is diferent..... I haven't yet messed around to see if there's a simular functionality, but I would imagine it's possible to wire something together for it to work (by just using database tables).
     
  5. Guidez

    Guidez Member

    Joined:
    Oct 27, 2012
    Messages:
    30
    Likes Received:
    4
    Pwonz0r's build does not have any tables or procedures, but yes, the concept of what needs to be changed CAN be expanded.

    For instance, if you want random loot at spawn, you can quite easily modify the SQF to include random variables and what not and assign the user with random loot at fresh spawn based off of said random variable contents.

    As to integrating the functions directly into the DB, that MAY or may not have to do with the hiveDB.dll file, as I believe that is involved in the direct interaction between the SQL DB and the SQF code itself: ARMA 2 has no inherent ability to interact with programs outside of itself. If you pull other server builds, you might find that they have different SQF code that relates to DB calls that don't exist in the current builds .DLL file. I could be wrong.

    If the latter is the case then the only way to assign specific loadouts to specific people is to include it directly in the SQF code, which means that the effects would only take effect between server restarts / code re-packaging.
     
  6. kitfoo

    kitfoo Member

    Joined:
    Feb 21, 2013
    Messages:
    40
    Likes Received:
    1
    Hey guys, a simple question...

    How do you unpack/pack a pbo? I'm using PBO Manager 1.4beta, but all it seems to do is let me open pbo's.
     
  7. Guidez

    Guidez Member

    Joined:
    Oct 27, 2012
    Messages:
    30
    Likes Received:
    4
    Cpbo from armaholic
     
  8. McKeighan

    McKeighan Well-Known Member

    Joined:
    Jan 8, 2013
    Messages:
    103
    Likes Received:
    6
    I prefer using a tool called Eliteness (do a search for it). It also has the ability to open a .bin file, which you'll run into in a few of the pbo's after unpacking them.
     
  9. kitfoo

    kitfoo Member

    Joined:
    Feb 21, 2013
    Messages:
    40
    Likes Received:
    1
    All the versions of Eliteness that I've found call for some sort of .dll that is supposed to be included in the zip file of the program, but is not. Do you have a reliable link for it?
     
  10. Peter Shepherd

    Peter Shepherd Member

    Joined:
    Mar 21, 2013
    Messages:
    94
    Likes Received:
    2
    well i spawned in my server and there was no items in my back pack.

    I even coped your code as well.
     
  11. McKeighan

    McKeighan Well-Known Member

    Joined:
    Jan 8, 2013
    Messages:
    103
    Likes Received:
    6
    I'll look for it Kit - if i can't find where they stuck the DLL online, I'll upload mine somewhere and get you a download link to it.... or maybe use that handy "upload a file" button here.
     
  12. McKeighan

    McKeighan Well-Known Member

    Joined:
    Jan 8, 2013
    Messages:
    103
    Likes Received:
    6
    Nonov Urbizniz likes this.
  13. Pwnoz0r

    Pwnoz0r Administrator Staff Member

    Joined:
    Oct 18, 2012
    Messages:
    255
    Likes Received:
    110
    Stickied, thanks for your contribution!
     
  14. kitfoo

    kitfoo Member

    Joined:
    Feb 21, 2013
    Messages:
    40
    Likes Received:
    1
    Thanks!
     
  15. benskie

    benskie New Member

    Joined:
    Apr 2, 2013
    Messages:
    3
    Likes Received:
    0
    This works a charm but the only problem I am having is when I restart the server players get the default loot again as if they just respawnd or joined the server for first time. Any ideas on what might be causing this?
     
  16. McKeighan

    McKeighan Well-Known Member

    Joined:
    Jan 8, 2013
    Messages:
    103
    Likes Received:
    6
    Yes... I have been researching this exact problem. It has to do with the server side SQF file called server_playerLogin.sqf

    Within this file, near the bottom, there is code that checks to see if the skins are allowed.

    Code:
    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 ["SurvivorW2_DZ","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","SurvivorW2_DZ"])) then {
            _model = "Survivor2_DZ";
        };
       
    } else {
        _model =        _primary select 3;
        _hiveVer =        _primary select 4;
        if (isNil "_model") then {
            _model = "Survivor2_DZ";
        } else {
            if (_model == "") then {
                _model = "Survivor2_DZ";
            };
        };
    
    What I've found interesting is that while this seems to work for the stock DZ skins, or any skin renamed to the stock DZ skin name, any additional skins added to the
    Code:
    if(!_model in [])
    statement DO NOT WORK. I have been trying a few days now to discover why exactly this keeps happening, and can't seem to find where in the code it's ignoring the list.

    It's entirely possible that this listing doesn't actually work correctly.....

    Anyway, the easiest way to do it would be to comment this area out, and maybe include an if statement to only cover if the model is NULL or blank.

    I have one or two more tests in me to get this running correctly before I revert this segement back to the 1.7.5 DayZ version, which worked 100% of the time.
     
  17. Guidez

    Guidez Member

    Joined:
    Oct 27, 2012
    Messages:
    30
    Likes Received:
    4
    Are you sure you edited line 18 and NOT the line containing "_inventory = _primary select 4;" ? I might need to do some additional testing, but my understanding is that it works like so:

    IF user connecting is dead or has never played, then supply user with gear from line 18's version of the _inventory variable.
    ELSE user connecting is alive, then supply user with gear saved in the database, selecting column 4 ( _inventory = _primary select 4; )
     
  18. benskie

    benskie New Member

    Joined:
    Apr 2, 2013
    Messages:
    3
    Likes Received:
    0
    I tested it again. I logged in got myself killed, respawned with starting loot ( I added a map, makarov, and 2 makarov mags) I ran off a bit and fired off a whole mag, logged out and then restarted the server, when I logged back in I was where I logged out but I had 2 full makarov mags again, and yeah the only line I edited was 18
     
  19. McKeighan

    McKeighan Well-Known Member

    Joined:
    Jan 8, 2013
    Messages:
    103
    Likes Received:
    6
    The full mags issue is in a different place. There's a count ammo script somewhere if i'm remembering it right.
     
  20. Jrb

    Jrb New Member

    Joined:
    Jan 4, 2013
    Messages:
    7
    Likes Received:
    0
    Hey guys, I'm having a problem with this. Just testing a few things (added a M240 as a startup weapon), but it doesn't want to work. I feel like I may not be making the array correctly:

    Code:
    //Variables
    _inventory =    [["ItemMap","ItemMatchbox","M240_DZ"],["Skin_Camo1_DZ","100Rnd_M240","100Rnd_M240"]];
    _backpack =    [];
    _items =        [];
    _magazines =    [];
    _weapons =        [];
    _medicalStats =    [];
    _survival =        [0,0,0];
    _tent =            [];
    _state =        [];
    _direction =    0;
    _model =        "";
    _newUnit =        objNull;
    _botActive = false;
    It will let me spawn with the M240 (sometimes), but not the ammo. Any ideas?
     

Share This Page