Dayz Overwatch - custom starter loadout

Chris Atkins

Valued Member!
Awww :/ Then how do other servers get modified loadout yet still have the spawn selection? Sorry, to sound like a complete annoying noob. Just curious! xD
Other Overwatch servers? No idea. I'm not a scripter, I can't write code, but I can merge it, and troubleshoot it. I have no idea where to start if other Overwatch servers are using modified loadout and still have the spawn selection.

Also, the more I think about it...When I ran Overwatch I don't remember the spawn location selection being broken, just the male/female selection.

You could open your mission.PBO and look in the init.sqf towards the top, around line 12 or 15 (around there) and look for this line of code:
Code:
dayz_spawnselection = 1; // DayZ Spawnselection / 1 = enabled // 0 = disabled, No current spawn limits.
Make sure the spawn selection is enabled, just to double check.
 
Other Overwatch servers? No idea. I'm not a scripter, I can't write code, but I can merge it, and troubleshoot it. I have no idea where to start if other Overwatch servers are using modified loadout and still have the spawn selection.

Also, the more I think about it...When I ran Overwatch I don't remember the spawn location selection being broken, just the male/female selection.

You could open your mission.PBO and look in the init.sqf towards the top, around line 12 or 15 (around there) and look for this line of code:
Code:
dayz_spawnselection = 1; // DayZ Spawnselection / 1 = enabled // 0 = disabled, No current spawn limits.
Make sure the spawn selection is enabled, just to double check.
Hmmm I am sure I had that enabled but it still wouldn't come up. I will check later. xD
 
this is just my best guess, I haven't actually tested it.

Open up your dayz_server.pbo/compiles/player_login.sqf
Look for
//Record initial inventory
_config = (configFile >> "CfgSurvival" >> "Inventory" >> "Default");
_mags = getArray (_config >> "magazines");
_wpns = getArray (_config >> "weapons");
_bcpk = getText (_config >> "backpack");
_randomSpot = true;

Change that bit to something that resembles this but makes more sense ....

Code:
removeallweapons player;
removeallmagazines player;
_mags = ["pistolmagazine","itembandage"];
_wpns = ["pistol","itemmap"];
_bcpk = "superduperbackpack";
edit your _mags, _wpns,_bckpk. Notice the backpack is Text so you just insert a classname in quotes. The _mags and _wpns are arrays so you have to use an array just like the array in your database survivor table.

You can use a code block to create a random gear select and just assign the result to the _mags or _wpns
_selected = [] BIS_fnc_selectRandom;
 
I seem to have a problem with some of the code I have found for loadouts. Heres what I got so far. It works but you can drop all gear on ground then log out and back in and have new set of gear on your character and still the stuff on ground. Not sure were or what I need to change so it does not dupe the loadout. This happens for normal players and the custom loadouts with UID.

Code:
//        Standard Starter Loadouts
//Loadout 1
_loadout1_weapons = ["bizon","DDOPP_X3_b"];
_loadout1_tools    = ["ItemToolbox","ItemMap","ItemCompass"];
_loadout1_items = ["64Rnd_9x19_Bizon","64Rnd_9x19_Bizon","DDOPP_3Rnd_X3","ItemPainkiller","ItemMorphine","ItemBandage","ItemBandage","ItemSodaRabbit","Skin_Camo17_DZ","ItemBloodbag","FoodbaconCooked"];
_loadout1_backpack = "DZ_Assault_Pack_EP1";
_loadout1_backpack_weapons = [];
_loadout1_backpack_items = [];
//Loadout 2
_loadout2_weapons = ["vil_uzimini","DDOPP_X3_b"];
_loadout2_tools    = ["ItemToolbox","ItemMap","ItemCompass"];
_loadout2_items = ["vil_32Rnd_UZI_SD","vil_32Rnd_UZI_SD","DDOPP_3Rnd_X3","ItemPainkiller","ItemMorphine","ItemBandage","ItemBandage","ItemSodaRabbit","Skin_Camo17_DZ","ItemBloodbag","FoodbaconCooked"];
_loadout2_backpack = "DZ_Assault_Pack_EP1";
_loadout2_backpack_weapons = [];
_loadout2_backpack_items = [];
//Loadout 3
_loadout3_weapons = ["M1014","DDOPP_X3_b"];
_loadout3_tools    = ["ItemToolbox","ItemMap","ItemCompass"];
_loadout3_items = ["8Rnd_B_Beneli_74Slug","8Rnd_B_Beneli_74Slug","8Rnd_B_Beneli_74Slug","DDOPP_3Rnd_X3","ItemPainkiller","ItemMorphine","ItemBandage","ItemBandage","ItemSodaRabbit","Skin_Camo17_DZ","ItemBloodbag","FoodbaconCooked"];
_loadout3_backpack = "DZ_Assault_Pack_EP1";
_loadout3_backpack_weapons = [];
_loadout3_backpack_items = [];

//------------------------UID--------------------------------------
_custom_loadout_players = ["9999999","8888888","7777777"];

//----------------------Loadouts-----------------------------------

//Custom 1 -
_custom1_weapons = ["FHQ_ACR_WDL_CCO_SD","RH_Deagleg"];
_custom1_tools    = ["ItemMap","ItemCompass","ItemToolbox","NVGoggles","ItemCrowbar","ItemKnife","Binocular_Vector"];
_custom1_items = ["FHQ_rem_30Rnd_680x43_ACR_SD","FoodbaconCooked","ItemSodaRabbit","ItemBloodbag","Skin_Sniper3_DZ","ItemBandage","ItemBandage","ItemBandage","ItemBandage","RH_7Rnd_50_AE","RH_7Rnd_50_AE","RH_7Rnd_50_AE","RH_7Rnd_50_AE"];
_custom1_backpack = "DZ_CivilBackpack_EP1";
_custom1_backpack_weapons = ["FHQ_MSR_DESERT"];
_custom1_backpack_items = ["FHQ_rem_10Rnd_338Lapua_MSR_NT"];
_custom1_players = ["9999999"];

//Custom 2 -
/*_custom2_weapons = ["M40A3","RH_m9sd"];
_custom2_tools    = ["ItemMap","ItemCompass","ItemToolbox","Binocular_Vector","ItemFlashlightRed","ItemEtool","ItemCrowbar","ItemMatchbox","ItemGPS","ItemHatchet","ItemKnife"];
_custom2_items = ["5Rnd_762x51_M24","5Rnd_762x51_M24","5Rnd_762x51_M24","5Rnd_762x51_M24","5Rnd_762x51_M24","5Rnd_762x51_M24","FoodSteakCooked","ItemSodaRabbit","ItemBloodbag","Skin_Sniper3_DZ","ItemBandage","ItemBandage","ItemBandage","ItemBandage","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD"];
_custom2_backpack = "DZ_CivilBackpack_EP1";
_custom2_backpack_weapons = [];
_custom2_backpack_items = ["ItemBloodbag","ItemMorphine","ItemAntibiotic","ItemPainkiller","FoodSteakCooked","ItemSodaRabbit"];
_custom2_players = ["8888888"];*/

//Custom 3 -
/*_custom1_weapons = ["SCAR_L_CQC_CCO_SD"];
_custom1_tools    = ["ItemMap","ItemCompass","ItemToolbox","NVGoggles","ItemCrowbar","ItemKnife"];
_custom1_items = ["30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","ItemBandage","ItemBandage","ItemBandage"];
_custom1_backpack = "DZ_CivilBackpack_EP1";
_custom1_backpack_weapons = ["FHQ_MSR_DESERT"];
_custom1_backpack_items = ["FHQ_rem_10Rnd_338Lapua_MSR_NT","FHQ_rem_10Rnd_338Lapua_MSR_NT","FHQ_rem_10Rnd_338Lapua_MSR_NT","FHQ_rem_10Rnd_338Lapua_MSR_NT","FHQ_rem_10Rnd_338Lapua_MSR_T","FHQ_rem_10Rnd_338Lapua_MSR_T"];
_custom1_players = ["7777777"];*/

//remove default overwatch items
{player removeMagazine _x} forEach magazines player;
player removeWeapon "DDOPP_X26";
removeBackpack player;


if ((getPlayerUID player) in _custom_loadout_players) then {
    if ((getPlayerUID player) in _custom1_players) exitWith {
        {player addMagazine _x} forEach _custom1_items;
        {player addWeapon _x} forEach _custom1_weapons;
        {player addWeapon _x} forEach _custom1_tools;
        player addBackpack _custom1_backpack;
        {(unitBackpack player) addWeaponCargoGlobal [_x, 1]} forEach _custom1_backpack_weapons;
        {(unitBackpack player) addMagazineCargoGlobal [_x, 1]} forEach _custom1_backpack_items;
    };
    if ((getPlayerUID player) in _custom2_players) exitWith {
        {player addMagazine _x} forEach _custom2_items;
        {player addWeapon _x} forEach _custom2_weapons;
        {player addWeapon _x} forEach _custom2_tools;
        player addBackpack _custom2_backpack;
        {(unitBackpack player) addWeaponCargoGlobal [_x, 1]} forEach _custom2_backpack_weapons;
        {(unitBackpack player) addMagazineCargoGlobal [_x, 1]} forEach _custom2_backpack_items;
    };
    if ((getPlayerUID player) in _custom3_players) exitWith {
        {player addMagazine _x} forEach _custom3_items;
        {player addWeapon _x} forEach _custom3_weapons;
        {player addWeapon _x} forEach _custom3_tools;
        player addBackpack _custom3_backpack;
        {(unitBackpack player) addWeaponCargoGlobal [_x, 1]} forEach _custom3_backpack_weapons;
        {(unitBackpack player) addMagazineCargoGlobal [_x, 1]} forEach _custom3_backpack_items;
    };
   
} else {
    randomvar = round (random 3);
    //diag_log("randomvar = " + str(randomvar));
   
    switch (randomvar) do
    {
        case 0:
        {
            {player addMagazine _x} forEach _loadout1_items;
            {player addWeapon _x} forEach _loadout1_weapons;
            {player addWeapon _x} forEach _loadout1_tools;
            player addBackpack _loadout1_backpack;
            (unitBackpack player) addMagazineCargoGlobal _loadout1_backpack_items;
            (unitBackpack player) addWeaponCargoGlobal _loadout1_backpack_weapons;
        };
        case 1:
        {
            {player addMagazine _x} forEach _loadout2_items;
            {player addWeapon _x} forEach _loadout2_weapons;
            {player addWeapon _x} forEach _loadout2_tools;
            player addBackpack _loadout2_backpack;
            (unitBackpack player) addMagazineCargoGlobal _loadout2_backpack_items;
            (unitBackpack player) addWeaponCargoGlobal _loadout2_backpack_weapons;
        };
        case 2:
        {
            {player addMagazine _x} forEach _loadout3_items;
            {player addWeapon _x} forEach _loadout3_weapons;
            {player addWeapon _x} forEach _loadout3_tools;
            player addBackpack _loadout3_backpack;
            (unitBackpack player) addMagazineCargoGlobal _loadout3_backpack_items;
            (unitBackpack player) addWeaponCargoGlobal _loadout3_backpack_weapons;
        };
   
    };
};
 
yeah, I guess that would happen since it gives you gear at login. you need to be able to determine if the player is a fresh spawn, or a returning character. If you look in your player_login.sqf file there is a line that says

if (!_isNew) then {

and that code block gives the gear from the database to returning characters. It ends with

} else {
if (_model == "") then {
_model = "Survivor2_DZ";
} ;
//PUT YOUR 'DONATE TO CHEAT' CODE HERE
};


That is the code block I would place your code into as that is only executed for newly spawned players. Again, code has not been tested
 
} ;
//PUT YOUR 'DONATE TO CHEAT' CODE HERE
};
Indeed, love it. Nothing like a bunch of hyenas and vultures turning ratchet to make a buck. They can call it what they want, donator pack/loadout, whatever, fact is they are SELLING loadouts...no matter how long you polish a turd, it's still a turd.
 
Chris any chance you could point me in the right direction to get the loadouts by UID to work? Would be nice for myself and my admins. As you said "Looks almost identical to my custom loadout code. Code travels...". Seem if this is close to your code for loadouts by UID then you have it working and could be a nice guy and help me get it working? Any help will be nice.

ShootingBlanks suggestion to add the code in player_login.sqf did not work. Thanks for the info anyways.
 
Your loadout is damn near the same one I have....forked from someone's mission file. Anyhow, you need to call it from the init.sqf.

Save your custom loadout as say, loadout.sqf. Obviously place it in the root of your mission file or within another folder there...

My init.sqf is highly modified, but look for this block of code:
Code:
            if (!isDedicated)
   then {   
            waitUntil {!isNil "dayz_loadScreenMsg"};   
            dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");   
            _id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];   
            _playerMonitor = something about dayz\addon\dayz_code\player_monitor.fsm
Underneath that block, add:
Code:
p2_loadouts = compile preprocessFileLineNumbers "Loadouts\spawn_goodies.sqf";
if (PVCDZ_plr_Login2 select 2) then {        
            player spawn p2_loadouts;           
            player addWeapon "ItemToolbox";           
            player addWeapon "ItemMap";           
            player addWeapon "ItemCompass";       
            };
Obviously you don't have to give players a toolbox, map, etc....

My custom loadouts is mixed in with my halo spawn, so what I provided here should work, or be close to what it needs to be. Let me know either way and I'll dissect my end a bit more.
 
Cant seem to get it to work still. Not sure if im missing something or if its something on my end. Here is what I have in my init.sqf.
Code:
if (!isDedicated) then {
[] execVM "Scripts\kh_actions.sqf";
    //Conduct map operations
    waitUntil {!isNil "dayz_loadScreenMsg"};
    dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");

    //Run the player monitor
    _id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
    _playerMonitor = [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";   
    if (dayz_antihack == 1) then {
//    [] execVM "\z\addons\dayz_code\system\antihack.sqf";
    };
};
p2_loadouts = compile preprocessFileLineNumbers "Scripts\loadouts.sqf";
if (PVCDZ_plr_Login2 select 2) then {       
            player spawn p2_loadouts;          
            player addWeapon "ItemToolbox";          
            player addWeapon "ItemMap";          
            player addWeapon "ItemCompass";      
            };
// Logo watermark: adding a logo in the bottom left corner of the screen with the server name in it
if (!isNil "dayZ_serverName") then {
    [] spawn {
        waitUntil {(!isNull Player) and (alive Player) and (player == player)};
        waituntil {!(isNull (findDisplay 46))};
        5 cutRsc ["wm_disp","PLAIN"];
        ((uiNamespace getVariable "wm_disp") displayCtrl 1) ctrlSetText dayZ_serverName;
    };
};
Also I have a custom spawn location with UID. Not sure if this is causing it not to work. This is also in my init.sqf at the bottom.

Code:
 //##UID Based Custom Spawn Locations##
p2_newspawn = compile preprocessFileLineNumbers "Scripts\newspawn.sqf";
waitUntil {!isNil ("PVDZ_plr_LoginRecord")};
if (PVCDZ_plr_Login2 select 2) then
{
    player spawn p2_newspawn;
};
My Server_playersetup.sqf block of code I edited to get the custom spawn location to work.

Code:
//Record player for management
dayz_players set [count dayz_players,_playerObj];

//record player pos locally for server checking
_playerObj setVariable["characterID",_characterID,true];
_playerObj setVariable["humanity",_humanity,true];
_playerObj setVariable["humanity_CHK",_humanity];
//_playerObj setVariable["worldspace",_worldspace,true];
//_playerObj setVariable["state",_state,true];
_playerObj setVariable["lastPos",getPosATL _playerObj];

PVCDZ_plr_Login2 = [_worldspace,_state,_randomSpot];
_clientID = owner _playerObj;
_clientID publicVariableClient "PVCDZ_plr_Login2";

//record time started
_playerObj setVariable ["lastTime",time];
//_playerObj setVariable ["model_CHK",typeOf _playerObj];
 
Top