[Tutorial] Custom Loot Tables and Adjusting Spawn Rates

You should check that you have the correct item code, and that the weapon is 'allowed'. If it is not allowed, it may be spawning then immediately deleted. You could test with another weapon that normally spawns with the spawn chance set to 0.9 to doublecheck that your code is basically correct. If so, then add back the desert eagle or whatever other weapon you wish to have spawn frequently.
 
Okay, thank you guys.
I will try that and report back tomorrow.
And sorry I forgot to say I'm running overwatch that does have the deagle in the mod, might make it a bit more clear.
 
Im having trouble with so many coyote backpacks spawning in barracks. 5 of them in 2 barracks that are right next to eachother.

I checked the hpp files for military and its not even listed. It's only listed in CfgBuildingLoot.hpp with a spawn chance of .01
so it shouldn't be spawning so often

{"DZ_Backpack_EP1","object",0.01}, // 24

anyone know how to resolve this?
 
im getting this error in my rpt log and ive made no changes to the files downloaded from git

7:12:52 Error Zero divisor
7:12:52 File mpmissions\__cur_mp.chernarus\Fixes\compile\spawn_loot.sqf, line 31
7:12:52 Error in expression <find _iClass;
_weights = dayz_CLChances select _index;
_cntWeights = count _weig>
7:12:52 Error position: <select _index;
_cntWeights = count _weig>

and it spams this over and over, i was testing my server out for about an hr, and my rpt log was 126mb

edit: running 1.8.0.3 reality private hive
 
Last edited:
well since there is no reply about a fix, does anyone know how to disable the log file, i ran the server for a few hrs and the log file got up to 500mb, half a freakn gig, the loot seems to spawn correctly, and i have made no changes to any of the files downloaded from git, even redownloaded to make sure i had clean files and still the same error spamming the log file, i would like to disable the log file so i can at least run my server without having all my hdd space being eatn up by a text file
 
It seems you have an error in your spawn_loot.sqf file on line 31. I would start by replacing your modified spawn_loot.sqf with an unmodified copy to see if that corrects the problem. If so, I would repeat the process of the editing of spawn_loot.sqf once more, or take a modified version from the github for which a link is provide on page 1 of this thread. I hope this helps.
 
the one from git is the one causing the problem, i put the 1.7.7.1 in place of the one for 1.8.0.3 and the error is gone, i just hadnt had time to post what i had done, but in any case, the file provided needs to be fixed on the git download for 1.8
 
I believe you could call the zombie_generate function or wild_spawnZombies functions using the coordinates at which you want to spawn the zombies as the position.

for example,

[_position] call wild_spawnZombies;

// [postion to spawn zombies, true they will loiter, [array of zombie types to spawn]]
[_position,true,_unitTypes] call zombie_generate;
 
I believe you could call the zombie_generate function or wild_spawnZombies functions using the coordinates at which you want to spawn the zombies as the position.

for example,

[_position] call wild_spawnZombies;

// [postion to spawn zombies, true they will loiter, [array of zombie types to spawn]]
[_position,true,_unitTypes] call zombie_generate;
I want a area map without zombies, dont use NUKE EM OUT because dont work in my server.
When a player enter in a area spawn zeds in this area, What file is the condition to spawn zombies?
Could you ask in that file that is if the coordinates x, y map does not spawn zombies?
 
Last edited:
There are a few ways you can do this.

The new Basebuilding 1.3 has an antizombie generator that is quite nice. It just pushes zombies outside a perimeter. This is the cleanest solution for ordinary DayZ.

http://opendayz.net/threads/base-building-dayz-1-2-released.8579/

There is a zombie safe-zone script around for Epoch that is based on plot poles. I have not tried it but it looks like it works. The concern is that spaming plot poles will defeat a lot of zombies:

http://epochmod.com/forum/index.php?/topic/616-zombie-free-bases/

You could use sensors to protect specific regions by adapting the protected dome function from dayz.st.

the safezone is triggered whenever a player is within a pre-specified distance from a trader. Player location relative to the trader is detected using 'sensor' functions defined in the mission.sqm which flip a variable called canbuild thus triggering the safezone.sqf script to initiate the safezone behavior. You could add sensors that also trigger the safezone script, or add a new variable like nozombieattacks that is flipped by the specific sensor you define. If you chose the latter you would need to write a modified safezone.sqf that tested for the nozombieattack variable. note that the safezone.sqf disables player firearms so you might want to make some changes to that script for your zombie safe zones.

If you really want to modify zombie spawn code, this is getting beyond my expertise, but here is what I came up with. . You would begin by defining an array with locations that zombies don't spawn, for example at the end of your init.sqf:

safezones = [
[0,0,0],
[1,1,1],
];

you would then copy zombie_generate.sqf from dayz_code to a folder in your mission folder (for example fixes).

then in your fixes\zombie_generate.sqf add this

_isSafeZone = false;
{
if ((_pos distance (_x select 0)) <= (_x select 1)) then {_isSafeZone = true;};
} forEach safezones;
if (_isSafeZone) then exitWith {};

below this

private["_position","_doLoiter","_unitTypes","_isNoone","_loot","_array","_agent","_type","_radius","_method","_nearByPlayer","_attempt","_myDest","_newDest","_lootType"];
_position = _this select 0;
_doLoiter = _this select 1;
_unitTypes = _this select 2;


You would then need to be sure that this customized zombie_generate.sqf file was compiled, which will require the following.

Create a new file in the fixes folder of your mission folder and call it compiles2.sqf.

In it create one line:

zombie_generate = compile preprocessFileLineNumbers "fixes\zombie_generate.sqf"; //Server compile, used for loiter behaviour

save the file to your fixes folder.

now in init.sqf

below this
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf"; //Compile regular functions

add this
call compile preprocessFileLineNumbers "fixes\compiles2.sqf";

recompile and upload then test it out.

Depending on the version of Dayz you run you may need to also edit the script to spawn wild zombies using the above as a guide.
 
Code:
Turns out there are three files in dayz_server which also need edited. They don't cause a problem unless you edit the heli crash loot table or castle loot table which is probably why most people haven't noticed or haven't cared about the errors spamming their RPT.

The files you need to edit are
dayz_server\compile\fa_hiveMaintenance.sqf on line 76
Code:

    _config = configFile >> "CfgBuildingLoot" >> "HeliCrash";


dayz_server\compile\fn_bases.sqf on line 25
Code:

    _itemTypes =    [] + getArray (configFile >> "CfgBuildingLoot" >> _lootTable >> "lootType");


dayz_server\compile\server_spawnCrashSite.sqf on line 84

Code:

            _itemTypes = [] + getArray (missionconfigFile >> "CfgBuildingLoot" >> _lootTable >> "lootType");

Ok...so now what? What needs to be done with these 3 lines?
 
First off. Great tutorial and thanks for uploading all the custom code Avendetta.
Everything is working fine except I seem to be getting 100% loot chance on all loot locations in buildings. There is no dayz_lootspawnbias in the variables. I have edited the loot chances in the CFGBuildingLoot.sqf, CFGBuildingPos.sqf and it doesn't seem to work unless I decrease the values to 0. Obviously this will make no loot spawn.

I am sure this is an easy fix. I just cant seem to find it. The help would be greatly appreciated, I really want to roll this out onto our public server.

-garden
 
Hi, I'm having some trouble installing this on Epoch. I thought I had it down by following all initial instructions but when it didn't work I saw that there might be some issues with Epoch and the config.cpp file. The game couldn't find other sqf files like stream_locationFill after doing the initial changes. This file is still in the Dayz_code and not copied to the fixes folder. I couldn't go in 3rd person mode either. I figured this might be because of the config.cpp.

I have the config.cpp file in the root of @Dayz/addons/Dayz_Code.pbo Problem is it doesn't include the "class CfgBuildingLoot {" Only mention in the cpp file is "#include "Configs\CfgLoot\CfgBuildingLoot.hpp".
What should I do with this config.cpp file?? I don't know how to separate them or where to put them. I suppose the game doesn't recognize the CfgBuildingLoot.hpp and CfgLoot.hpp in my mission folder.

Thanks for any help
-Rune
 
Hi, I'm having some trouble installing this on Epoch. I thought I had it down by following all initial instructions but when it didn't work I saw that there might be some issues with Epoch and the config.cpp file. The game couldn't find other sqf files like stream_locationFill after doing the initial changes. This file is still in the Dayz_code and not copied to the fixes folder. I couldn't go in 3rd person mode either. I figured this might be because of the config.cpp.

I have the config.cpp file in the root of @Dayz/addons/Dayz_Code.pbo Problem is it doesn't include the "class CfgBuildingLoot {" Only mention in the cpp file is "#include "Configs\CfgLoot\CfgBuildingLoot.hpp".
What should I do with this config.cpp file?? I don't know how to separate them or where to put them. I suppose the game doesn't recognize the CfgBuildingLoot.hpp and CfgLoot.hpp in my mission folder.

Thanks for any help
-Rune
try this
http://opendayz.net/threads/tutoria...adjusting-spawn-rates.11589/page-5#post-70532
 
Guys Im getting this error in loot_init.sqf which is unmodified except for changing config to missionconfig.. I have no idea what its trying to tell me... Im running overwatch 0.25 fyi

Code:
22:18:39 "PRELOAD_ Functions\init [[<No group>:0 (FunctionsManager)],any]"
22:18:39 "MPframework inited"
22:18:39 Error in expression <nd (((_itemChances select _l) select 1) * 100);
for "_k" from 0 to (_weight - 1)>
22:18:39 Error position: <* 100);
for "_k" from 0 to (_weight - 1)>
22:18:39 Error *: Type String, expected Number
22:18:39 File mpmissions\__cur_mp.chernarus\custom\loot_init.sqf, line 45
22:18:39 Error in expression <;
_recompile = (count _this) > 0;

if (BIS_fnc_init && !_recompile) exitwith {t>
22:18:39 Error position: <BIS_fnc_init && !_recompile) exitwith {t>
22:18:39 Error Undefined variable in expression: bis_fnc_init
22:18:39 File ca\Modules\Functions\init.sqf, line 28
 
Back
Top