[HELP NEEDED] Custom Loadouts - Based on UID.... (1.8.3)

Hello,

I have put the following into
server_playerLogin.sqf:
Code:
//Variables
_inventory = [["glock17_EP1","ItemHatchet","ItemMap","ItemToolbox"], ["ItemAntibiotic","ItemBandage","ItemBloodbag","ItemMorphine","17Rnd_9x19_glock17","17Rnd_9x19_glock17"]];
_backpack =     [];
_items =         [];
_magazines =     [];
_weapons =         [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =         [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
_botActive = false;

This works fine, when you spawn on the server you are given the above items.



How can I create a Custom Loadout based on UID ?
I have tried to mix and match some code to get this working but can't figure it out

In
init.sqf
Code:
if (!isDedicated) then {
    [] ExecVM "custom_monitor.sqf";
    [] ExecVM "loadout.sqf";
    [] execVM "Scripts\kh_actions.sqf";
    if (dayz_POIs) then { execVM "\z\addons\dayz_code\system\mission\chernarus\poi\init.sqf"; };

loadout.sqf
Code:
//Written by Matt L http://opendayz.net/members/matt-l.7134/
// 5/12/2014
//Feel free to edit to your liking, just give credit where it is due!
//Thanks to Armbot for the idea && test server

if ((getPlayerUID player) in ["########"]) then {  //Clan: Name, Name

    _pathToScriptsHero1 = "Scripts\Loadout\";

    _scriptArrayHero1 = "1.sqf";

    _randomScriptHero1 = [_scriptArrayHero1] call BIS_fnc_selectRandom;

    [] execVM format["%1%2",_pathToScriptsHero1,_randomScriptHero1];
   
    sleep 2;
   
     };
In Scripts\Loadout\:
1.sqf
Code:
//Written by Matt L http://opendayz.net/members/matt-l.7134/
// 5/12/2014
//Feel free to edit to your liking, just give credit where it is due!
//Thanks to Armbot for the idea && test server

if (dayz_combat == 1) then {
    titleText ["wut.", "PLAIN DOWN", 3];
    sleep 5;
    titleFadeOut 1;
} else {

    player addWeapon 'MeleeHatchet';
    player addWeapon 'M9';
    player selectWeapon 'M9';
    player addMagazine '15Rnd_9x19_M9';
    player addMagazine 'ItemMorphine';
    player addMagazine 'ItemSodaMdew';
    player addMagazine 'FoodCanBakedBeans';
    player addMagazine 'ItemPainkiller';
    player addMagazine 'ItemBandage';
    player addMagazine 'ItemBandage';
    player addWeapon 'ItemMap';
    player addWeapon 'ItemKnife';
    player addWeapon 'ItemEtool';
    removeBackpack player;
    player addBackPack "DZ_CompactPack_EP1";
    reload player;
   
    cuttext ["you are a hero level 1", "PLAIN DOWN"];

    sleep 2;
   
};

I literally just want to be able to add some UID's to the loadout.sqf file which would have them receive a different set of starting gear.

Can anyone please help me to get this working,,
Many thanks
 
in your server_playerlogin.sqf file it works perfectly, right?
the lines immediately following what you have edited to customize the inventory is
Code:
if (_playerID == "") then {
    _playerID = getPlayerUID _playerObj;
};
Move that above the set inventory code and use an if clause to test for each uid.
Code:
if (_playerID == "") then {
    _playerID = getPlayerUID _playerObj;};

if (_playerID == "################") then {
//*****************CUSTOM LOADOUT ****************************
_inventory = [["glock17_EP1","ItemHatchet","ItemMap","ItemToolbox"], ["ItemAntibiotic","ItemBandage","ItemBloodbag","ItemMorphine","17Rnd_9x19_glock17","17Rnd_9x19_glock17"]];
_backpack =     [];
_items =         [];
_magazines =     [];
_weapons =         [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =         [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
_botActive = false;
}
//**************COPY ABOVE BLOCK  AND INSERT ADDITIONAL UIDS**********

else {
//****************DEFAULT LOADOUT (FOR TRUE DAYZ PLAYERS ONLY, NO PUSSIES ALLOWED)***********************
_inventory = [];
_backpack =     [];
_items =         [];
_magazines =     [];
_weapons =         [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =         [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
_botActive = false;
};
If you want to have a group of UIDs that have identical loadouts then you can do this
Code:
_group1 = ["UID##########","UID##########","UID##########"];
_group2 = ["UID##########","UID##########","UID##########"];
if ((_playerID) in _group1 then {
 
Last edited:
Hi,

Can you correct me here please. When I do this code, I get stuck on Requesting Authentication...
I have entered a correct UID in both fields though,

server_playerLoign.sqf

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

_group1 = ["0000000000000","0000000000000"];
if ((_playerID) in _group1 then {
//*****************CUSTOM LOADOUT ****************************
_inventory = [["M9SD","ItemHatchet","ItemMap","ItemToolbox"], ["ItemBloodbag","ItemBloodbag","ItemMorphine","ItemAntibiotic","Skin_Sniper1_DZ","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD"]];
_backpack =     [DZ_British_ACU];
_items =         [];
_magazines =     [];
_weapons =         [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =         [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
_botActive = false;
}
//**************COPY ABOVE BLOCK  AND INSERT ADDITIONAL UIDS**********

else {
//****************DEFAULT LOADOUT (FOR TRUE DAYZ PLAYERS ONLY, NO PUSSIES ALLOWED)***********************
_inventory = [["glock17_EP1","ItemHatchet","ItemMap","ItemToolbox"], ["ItemAntibiotic","ItemBandage","ItemBloodbag","ItemMorphine","17Rnd_9x19_glock17","17Rnd_9x19_glock17"]];
_backpack =     [];
_items =         [];
_magazines =     [];
_weapons =         [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =         [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
_botActive = false;
};
 
Oh, yeah, had to look at that code a bit to see the error. Ironically I had just pointed out to someone that mismatched braces are the most common errors and I always check for them, and there I go!
Code:
if ((_playerID) in _group1
 
It happens :)

If I wanted to add another loadout would this work?
I dont know how to use the 'else'

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

_group1 = ["0000000000000","0000000000000"];
_group2 = ["1111111111111","1111111111111"];

if ((_playerID) in _group1) then {

//*****************CUSTOM LOADOUT 1 ****************************
_inventory = [["M9SD","ItemHatchet","ItemMap","ItemToolbox"], ["ItemBloodbag","ItemBloodbag","ItemMorphine","ItemAntibiotic","Skin_Sniper1_DZ","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD"]];
_backpack =     [DZ_British_ACU];
_items =         [];
_magazines =     [];
_weapons =         [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =         [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
_botActive = false;
}
//**************COPY ABOVE BLOCK  AND INSERT ADDITIONAL UIDS**********



else {
if ((_playerID) in _group2) then {
//*****************CUSTOM LOADOUT 2 ****************************
_inventory = [["M9SD","ItemHatchet","ItemMap","ItemToolbox"], ["ItemBloodbag","ItemBloodbag","ItemMorphine","ItemAntibiotic","Skin_Sniper1_DZ","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD"]];
_backpack =     [DZ_British_ACU];
_items =         [];
_magazines =     [];
_weapons =         [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =         [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
_botActive = false;
}
//**************COPY ABOVE BLOCK  AND INSERT ADDITIONAL UIDS**********



else {
//****************DEFAULT LOADOUT (FOR TRUE DAYZ PLAYERS ONLY, NO PUSSIES ALLOWED)***********************
_inventory = [["glock17_EP1","ItemHatchet","ItemMap","ItemToolbox"], ["ItemAntibiotic","ItemBandage","ItemBloodbag","ItemMorphine","17Rnd_9x19_glock17","17Rnd_9x19_glock17"]];
_backpack =     [];
_items =         [];
_magazines =     [];
_weapons =         [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =         [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
_botActive = false;
};
 
the If and else. The last curly brace at the end has a semicolon.
Code:
if (condition)
  {
   code
   }
else {
        };
As the code i had previously pasted here had multiple if's it wont work. Your code would have to be like this to work.

Code:
//DEFAULT INVENTORY FIRST!
inventory = [....]
//now we check if a player is in the special GUID lists and the default inventory will be changed.
if (GUID)
    {
     SPECIAL INVENTORY
    };
if (GUID)
    {
     SPECIAL INVENTORY
    };
if (GUID)
    {
     SPECIAL INVENTORY
    };
//If none of the special GUIDS had joined, then the inventory is still the default from the top.
//we cant put the default at the bottom because it will overwrite all the special inventory.
 
Last edited:
Edited the code above.. Its correct now and will work.
Code:
if (_playerID == "") then {
    _playerID = getPlayerUID _playerObj;};

_group1 = ["0000000000000","0000000000000"];
_group2 = ["1111111111111","1111111111111"];

//****************DEFAULT LOADOUT ***********************
_inventory = [["glock17_EP1","ItemHatchet","ItemMap","ItemToolbox"], ["ItemAntibiotic","ItemBandage","ItemBloodbag","ItemMorphine","17Rnd_9x19_glock17","17Rnd_9x19_glock17"]];
_backpack =     [];
_items =         [];
_magazines =     [];
_weapons =         [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =         [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
_botActive = false;

//*****************CUSTOM LOADOUT 1 ****************************
if ((_playerID) in _group1) then {
_inventory = [["M9SD","ItemHatchet","ItemMap","ItemToolbox"], ["ItemBloodbag","ItemBloodbag","ItemMorphine","ItemAntibiotic","Skin_Sniper1_DZ","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD"]];
_backpack =     [DZ_British_ACU];
_items =         [];
_magazines =     [];
_weapons =         [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =         [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
_botActive = false;
};

//*****************CUSTOM LOADOUT 2 ****************************
if ((_playerID) in _group2) then {
_inventory = [["M9SD","ItemHatchet","ItemMap","ItemToolbox"], ["ItemBloodbag","ItemBloodbag","ItemMorphine","ItemAntibiotic","Skin_Sniper1_DZ","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD"]];
_backpack =     [DZ_British_ACU];
_items =         [];
_magazines =     [];
_weapons =         [];
_medicalStats =    [];
_survival =        [0,0,0];
_tent =            [];
_state =         [];
_direction =    0;
_model =        "";
_newUnit =        objNull;
_botActive = false;
};
//**************COPY ABOVE BLOCK  AND INSERT ADDITIONAL UIDS**********
 

HospitalChair

Well-Known Member
Is there a way to get someone to spawn wearing certain clothing. I mean i can put it in their inventory or bag but if i try changing the model it doesn't seem to have any effect. Ill post the code im using. Just slightly different than how you guys are doing it. The red chunk is what i was interested in.


//Variables
_inventory = [["ItemMap","ItemCompass","ItemKnife","ItemRadio","ItemHatchet","ItemMatchbox","ItemToolbox","M9","M4A3_CCO_EP1"],["bloodBagONEG","FoodSteakCooked","ItemMorphine","ItemAntibiotic","ItemBandage","ItemBandage","HandGrenade_west","ItemWaterBottle","15Rnd_9x19_M9","15Rnd_9x19_M9","15Rnd_9x19_M9","15Rnd_9x19_M9","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag"]];
_backpack = ["DZ_Assault_Pack_EP1"];
_items = [];
_magazines = [];
_weapons = [];
_medicalStats = [];
_survival = [0,0,0];
_tent = [];
_state = [];
_direction = 0;
_model = "";
_newUnit = objNull;
_botActive = false;

//Hospital Loadout
if (_playerID == "xxxxxxxxxxxxx") then {
_playerID = getPlayerUID _playerObj;
_inventory = [["ItemMap","ItemCompass","ItemKnife","ItemRadio","ItemHatchet","ItemMatchbox","ItemToolbox","M9SD","DMR"],["bloodBagONEG","FoodSteakCooked","ItemMorphine","ItemAntibiotic","ItemBandage","ItemBandage","HandGrenade_west","ItemWaterBottle","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","20Rnd_762x51_DMR","20Rnd_762x51_DMR","20Rnd_762x51_DMR","20Rnd_762x51_DMR"]];
_backpack = ["DZ_Backpack_EP1",[["M4A3_RCO_GL_EP1"],[1]],[["Skin_Sniper1_DZ","30Rnd_556x45_Stanag"],[1,4]]];

};
 

HospitalChair

Well-Known Member
Doesn't seem to work after respawns though. I imagine it has something to do with choosing your character after dying. I've tried spawning as a ghillie and it sticks me in the default skin. I can give it a try later when i get home in case i had a punctuation error.
 
no, i had almost mentioned that might be an issue but i couldnt remembr for sure.
off the top of my head i think what happens is the code after assumes you are not a new player and loads the skin. but it loads survivor skins based on humanity. look for some later model lines ...
 
Top