[Tutorial] Custom Loot Tables and Adjusting Spawn Rates

Tried this on 1.8 with no success any tips?

Don't see a reason why this wouldn't work with 1.8 as the loot related files don't appear to have changed. The only thing that has changed is you'll have to merge your mission init.sqf, description.ext, and mission.sqm with their counterparts located in dayz_code.pbo\system\mission\
(description.ext merges with description.sqf)

To merge the files so they work, simply copy their contents and paste them into the end of your mission files. Make sure to delete the lines which call them from the dayz_code folder.
 
okay question,

Do I merge them by appending them to the bottom or the top of the file? or dose it matter?

Thanks!
 
okay 2 questions,

1.) Do I merge them by appending them to the bottom or the top of the file? or dose it matter?
2.) What ones should I comment out?
Thanks!

You add them to the bottom of the files.
For example:
init.sqf (in your mission folder) looks like this
Code:
startLoadingScreen ["","RscDisplayLoadCustom"];
cutText ["","BLACK OUT"];
enableSaving [false, false];
 
//Server Settings
dayZ_instance = 1; // The instance
//dayZ_serverName = "UK1337"; // Servername (country code + server number)
dayz_antihack = 0; // DayZ Antihack / 1 = enabled // 0 = disabled
dayz_REsec = 0; // DayZ RE Security / 1 = enabled // 0 = disabled
 
//Game Settings
dayz_spawnselection = 0; // DayZ Spawnselection / 1 = enabled // 0 = disabled, No current spawn limits.
dayz_spawnCrashSite_clutterCutter = 0;    // Helicrash Settings / 0 =  loot hidden in grass // 1 = loot lifted // 2 = no grass around the Helicrash
dayz_spawnInfectedSite_clutterCutter = 0; // Infected Base Settings / 0 =  loot hidden in grass // 1 = loot lifted // 2 = no grass around the infected base
 
#include "\z\addons\dayz_code\system\mission\init.sqf"

At the bottom of that, you want to paste in your other init.sqf (from dayz_code.pbo) so it all looks like this.

Code:
startLoadingScreen ["","RscDisplayLoadCustom"];
cutText ["","BLACK OUT"];
enableSaving [false, false];
 
//Server Settings
dayZ_instance = 1; // The instance
//dayZ_serverName = "UK1337"; // Servername (country code + server number)
dayz_antihack = 0; // DayZ Antihack / 1 = enabled // 0 = disabled
dayz_REsec = 0; // DayZ RE Security / 1 = enabled // 0 = disabled
 
//Game Settings
dayz_spawnselection = 0; // DayZ Spawnselection / 1 = enabled // 0 = disabled, No current spawn limits.
dayz_spawnCrashSite_clutterCutter = 0;    // Helicrash Settings / 0 =  loot hidden in grass // 1 = loot lifted // 2 = no grass around the Helicrash
dayz_spawnInfectedSite_clutterCutter = 0; // Infected Base Settings / 0 =  loot hidden in grass // 1 = loot lifted // 2 = no grass around the infected base
 
initialized = false;
dayzHiveRequest = [];
dayz_previousID = 0;
0 fadeSound 0;
//disable greeting menu
player setVariable ["BIS_noCoreConversations", true];
//disable radio messages to be heard and shown in the left lower corner of the screen
enableRadio false;
 
//Load in compiled functions
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\variables.sqf";                //Initilize the Variables (IMPORTANT: Must happen very early)
progressLoadingScreen 0.1;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\publicEH.sqf";                    //Initilize the publicVariable event handlers
progressLoadingScreen 0.2;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\setup_functions_med.sqf";    //Functions used by CLIENT for medical
progressLoadingScreen 0.4;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";                    //Compile regular functions
progressLoadingScreen 1.0;
 
"filmic" setToneMappingParams [0.153, 0.357, 0.231, 0.1573, 0.011, 3.750, 6, 4]; setToneMapping "Filmic";
 
[] spawn {
    while {true} do {
        waitUntil {((isNil "BIS_Effects_Rifle") OR {(count(toArray(str(BIS_Effects_Rifle)))!=7)})};
        diag_log "Res3tting B!S effects...";
        /* BIS_Effects_* fixes from Dwarden */
        BIS_Effects_EH_Killed = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\BIS_Effects\killed.sqf";
        BIS_Effects_AirDestruction = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\BIS_Effects\AirDestruction.sqf";
        BIS_Effects_AirDestructionStage2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\BIS_Effects\AirDestructionStage2.sqf";
 
        BIS_Effects_globalEvent = {
            BIS_effects_gepv = _this;
            publicVariable "BIS_effects_gepv";
            _this call BIS_Effects_startEvent;
        };
 
        BIS_Effects_startEvent = {
            switch (_this select 0) do {
                case "AirDestruction": {
                        [_this select 1] spawn BIS_Effects_AirDestruction;
                };
                case "AirDestructionStage2": {
                        [_this select 1, _this select 2, _this select 3] spawn BIS_Effects_AirDestructionStage2;
                };
                case "Burn": {
                        [_this select 1, _this select 2, _this select 3, false, true] spawn BIS_Effects_Burn;
                };
            };
        };
 
        "BIS_effects_gepv" addPublicVariableEventHandler {
            (_this select 1) call BIS_Effects_startEvent;
        };
 
        BIS_Effects_EH_Fired = {false};
        BIS_Effects_Rifle = {false};
        sleep 1;
    };
};
 
if ((!isServer) && (isNull player) ) then
{
    waitUntil {!isNull player};
    waitUntil {time > 3};
};
 
if ((!isServer) && (player != player)) then
{
    waitUntil {player == player};
    waitUntil {time > 3};
};
 
if (isServer) then {
    _serverMonitor = [] execVM "\z\addons\dayz_code\system\server_monitor.sqf";
    "PVDZ_sec_atp" addPublicVariableEventHandler {
        _x = _this select 1;
        if (typeName _x == "STRING") then {
            diag_log _x;
        }
        else {
            _unit = _x select 0;
            _source = _x select 1;
            if (((!(isNil {_source})) AND {(!(isNull _source))}) AND {((_source isKindOf "CAManBase") AND {(owner _unit != owner _source)})}) then {
                diag_log format ["P1ayer %1 hit by %2 %3 from %4 meters",
                    _unit call fa_plr2Str,  _source call fa_plr2Str, _x select 2, _x select 3];
                if (_unit getVariable["processedDeath", 0] == 0) then {
                    _unit setVariable [ "attacker", name _source ];
                    _unit setVariable [ "noatlf4", diag_ticktime ]; // server-side "not in combat" test, if player is not already dead
                };
            };
        };
    };
};
 
if (!isDedicated) then {
    //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";
    };
};
 
// 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;
    };
};
 
if (dayz_REsec == 1) then {
#include "\z\addons\dayz_code\system\REsec.sqf"
};

Notice how I removed
Code:
#include "\z\addons\dayz_code\system\mission\init.sqf"
Since this is no longer needed and would prevent your edits being used.
You do the same for all three files.
 
We have set up as much as we could for 1.8, some things may or may not be there. I'll have to do some poking around to see what all is needed for 1.8 loot when I have the chance.
 
Everything looks good, what I'm thinking is you are going to need to take the BuildingLoot folder and put that in your mission.pbo and then it should work. If you want to go ahead and try that and let me know if it works, if not I'll sit down later tonight and filter through everything.
 
Everything looks good, what I'm thinking is you are going to need to take the BuildingLoot folder and put that in your mission.pbo and then it should work. If you want to go ahead and try that and let me know if it works, if not I'll sit down later tonight and filter through everything.

Ill try it when our server depopulates again.
 
I went back threw and got it working on 1.8 tyvm for the help, I think I missed a line of code somewhere the 1st time I did it, but now it works like a charm.

Question: Is this correct if I want to add "Skin_Soldier1_DZ"? Is this all I should have to change? I tryed it and it spawned a lot of NVG's lol :D

Code:
class HeliCrashWEST: Default {
        zombieChance = 1;
        maxRoaming = 8;
        zombieClass[] = {"z_soldier_pilot"};
        lootChance = 0.5;
        lootPos[] = {};
        lootType[] = {
 
        //helicopter crash
            {"Skin_Soldier1_DZ","magazine",0.3},
 
        //one spawn
        //tools
            {"NVGoggles","weapon",0.01},
        //weapons
            {"FN_FAL","weapon",0.04},
            {"FN_FAL_ANPVS4","weapon",0.01},
            {"Mk_48_DZ","weapon",0.03},
            {"M249_DZ","weapon",0.04},
            {"BAF_L85A2_RIS_Holo","weapon",0.03},
            {"G36C","weapon",0.03},
            {"G36C_camo","weapon",0.03},
            {"G36_C_SD_camo","weapon",0.01},
            {"G36A_camo","weapon",0.03},
            {"G36K_camo","weapon",0.03},
            {"M9SD","weapon",0.02},
        //special
            {"MedBox0","object",0.05},
            {"AmmoBoxSmall_556","object",0.05},
            {"WeaponHolder_ItemCamoNet","object",0.01},
        //mags special
            {"Skin_Camo1_DZ","magazine",0.05},
            {"Skin_Sniper1_DZ","magazine",0.05},
        //bags
        //multiple spawns
        //multiple spawns
            {"","medical",0.25},
            {"","militaryWEST",0.25}
        };
    };
 
That should be correct yes. My OCD brain tells me you should list it with the other skin options already in that table though, just because it would be neat and tidy that way haha.
Your NV Goggles are only set to 0.01 chance of spawning though so I'm not sure why that would spawn a lot of them. :S
 
That should be correct yes. My OCD brain tells me you should list it with the other skin options already in that table though, just because it would be neat and tidy that way haha.
Your NV Goggles are only set to 0.01 chance of spawning though so I'm not sure why that would spawn a lot of them. :S


Ya I an very confused atm, I set the rate for the "Skin_Soldier1_DZ" to 0.9 and all I got was NVG's... Everything looks correct, but ill try putting it in OCD style :D and see what happens.
 
Ya I an very confused atm, I set the rate for the "Skin_Soldier1_DZ" to 0.9 and all I got was NVG's... Everything looks correct, but ill try putting it in OCD style :D and see what happens.

The line position wont change it's change. I was just being OCD for it haha, like to keep things together. :)
About the NVGs though, try checking the other loot files for entries to make sure none of them have NVGs set at a higher spawn rate. Perhaps it's coming from another file.

Oh actually, I don't know if it would cause it, but you could try changing the loot chance for your soldier skin to 0.90 instead of just 0.9
 
The line position wont change it's change. I was just being OCD for it haha, like to keep things together. :)
About the NVGs though, try checking the other loot files for entries to make sure none of them have NVGs set at a higher spawn rate. Perhaps it's coming from another file.

Oh actually, I don't know if it would cause it, but you could try changing the loot chance for your soldier skin to 0.90 instead of just 0.9

Ya idk what is happening:
Code:
    {"WeaponHolder_ItemCamoNet","object",0.01},
//mags special
    {"100Rnd_762x54_PK","magazine",0.01},
    {"Skin_Soldier1_DZ","magazine",0.90},
//bags
//multiple spawns
    {"","medical",0.25},
    {"","militaryEAST",0.25}

I did that and now all I see is medical supplies, seems where ever I put:
Code:
{"Skin_Soldier1_DZ","magazine",0.90},
The item below is getting the spawn chance


OR I AM VERY VERY VERY VERY unlucky :C (checked 15 crashes)
 
For people with a single 'config.cpp' in the root of dayz_code.pbo INSTEAD of both 'cfgBuildingLoot.hpp' and 'cfgBuildingPos.hpp' in dayz_code\Configs\CfgLoot\.




I had the same problem with Oring. I found a solution though.
Open your config.cpp and find "cgfBuildingLoot", it should look something like this (the brace may be on the next line);
Code:
class CfgBuildingLoot {
Select it's first brace '{' then scroll to the bottom of the file to make sure the closing brace '}' is highlighted red.
If it is, then you want to copy everything from (including) 'class cfgBuildingLoot' all the way down to include the closing brace.

Now, make a new file in notepadd++ and on the first line type
Code:
#include "CfgLoot.hpp"
Then paste what you just copied underneath that.
Save this file as 'cfgBuildingLoot.hpp' in the root of your mission.pbo AND copy the file 'cfgloot.hpp' from the dayz_code.pbo also into the root of your mission.pbo.

Now just make the edits that are in the tutorial on the first page and it should all be working. :)


Did anyone get this working for Takistan? I tried the above, then switched out empty tin cans/bottles for m240 ammo in both cfg files to test. The result is there are empty cans and botttles everywhere.

I copied the CfgBuildingLoot class into CfgBuildingLoot.hpp and put #include "CfgBuildingLoot.hpp" into the description.ext.

I put #include "cfgLoot.hpp" at the top of CfgBuildingLoot.hpp.

I put the required sqf files into the mission pbo, and pointed to them in compiles. I also edited them to missionConfigFile >> "CfgBuildingLoot".

And the game is still reading the default config somehow. Anyone know how to fix? Thanks.
 
Ya idk what is happening:
Code:
    {"WeaponHolder_ItemCamoNet","object",0.01},
//mags special
    {"100Rnd_762x54_PK","magazine",0.01},
    {"Skin_Soldier1_DZ","magazine",0.90},
//bags
//multiple spawns
    {"","medical",0.25},
    {"","militaryEAST",0.25}

I did that and now all I see is medical supplies, seems where ever I put:
Code:
{"Skin_Soldier1_DZ","magazine",0.90},
The item below is getting the spawn chance



OR I AM VERY VERY VERY VERY unlucky :C (checked 15 crashes)

Huh... That's strange, I've never seen that happen before. I'm honestly not sure at all what would cause that, I can't see any errors in the way it's added.

Did anyone get this working for Takistan? I tried the above, then switched out empty tin cans/bottles for m240 ammo in both cfg files to test. The result is there are empty cans and botttles everywhere.

I copied the CfgBuildingLoot class into CfgBuildingLoot.hpp and put #include "CfgBuildingLoot.hpp" into the description.ext.

I put #include "cfgLoot.hpp" at the top of CfgBuildingLoot.hpp.

I put the required sqf files into the mission pbo, and pointed to them in compiles. I also edited them to missionConfigFile >> "CfgBuildingLoot".


And the game is still reading the default config somehow. Anyone know how to fix? Thanks.


Can you upload your mission files so I can take a look at them please?
 
np, let me know if theirs anything weird, tyvm

http://www.filedropper.com/pbos_1

Well I had a look and I honestly can't see a fault in there. I've never seen that happen before though so I really don't know what's causing it. Sadly my test server is in a bit of a state just now as I'm trying to get base building working so I can't install the custom loot to my server and see if it does the same thing.
 
Well I had a look and I honestly can't see a fault in there. I've never seen that happen before though so I really don't know what's causing it. Sadly my test server is in a bit of a state just now as I'm trying to get base building working so I can't install the custom loot to my server and see if it does the same thing.

Could it be that "Skin_Soldier1_DZ" is maybe banned or something weird like that so the server is replacing it? Ill try different items really quick.
 
Back
Top