Adding custom loot spawns?

roarnesbo

Member
Hi! This might be a noob question, but hey - I'm a noob!

I've built several "junkyards" on open spots on the map, and I want to create a custom loot spawn there, with X chance for engine parts, x chance for car wheel, etc.

How would I go about doing that?
 
You have to add the lootdrops and-chances in the dayz_code->config.cpp, for example like this:
Code:
class Custom_Lootspawn: Default {
        zombieChance = 0.7;
        maxRoaming = 4;
        zombieClass[] = {"zZombie_Base","z_teacher","z_villager1","z_villager2","z_villager3"};
        lootChance = 0.5;
        lootPos[] = {};
        itemType[] =    {
            //TOOLS
            {"ItemCompass","generic"},
            {"ItemMap","weapon"},
            {"ItemKnife","generic"},
            {"Binocular","weapon"},
            {"ItemMatchbox","generic"}
                    };
        itemChance[] =    {
            //TOOLS
            0.03,            //ItemCompass
            0.03,            //ItemMap
            0.05,            //ItemKnife
            0.04,            //Binocular
            0.05,            //ItemMatchbox
                }; 
    };

Note that others need your custom dayz files.
About the custom loot places I'm not sure though.

If you look here:
Code:
class Land_A_FuelStation_Build: Industrial {
        lootChance = 0.5;
        zombieClass[] = {"zZombie_Base","zZombie_Base","z_teacher","z_suit1","z_suit2"};
        lootPos[] = {{-1.31958,-0.655151,-1.57448},{1.82349,0.769653,-1.57458},{1.67871,-0.918701,-1.57458},{-1.23242,1.26794,-1.57458}};
    };

This is the class for the Fuelstations in Chernarus. You see the loottype is Industrial and below that there are coordinates, where the loot should drop inside that building. I don't know though how to get the coords for other buidlings. Would be cool to know.
 
I've managed to do :p, over write the process instead of loading from the Config files, build array data with all the information and use them arrays.
 
I have custom Ammo or cardboard boxes that spawn on server start.

I use the 3D editor to place these objects, then use the mission editor to enter the initialisation string so I get the items I want in the boxes. (Though I have to edit the BEC Scripts.txt file to stop BEC kicking me for #115 errors.
ie it by default catches the 'addMagazineCargo' line.

Seems to work...

Code:
clearMagazineCargo this; clearWeaponCargo this; this addMagazineCargo ["ItemSodaCoke",2]; this addMagazineCargo ["FoodCanSardines",3]; this addMagazineCargo ["FoodSteakCooked",1]; this addMagazineCargo ["FoodSteakRaw",4];  this setpos [4043.0413, 11663.627, 10.272475];

No code needs changed on Players machines. :)
 
I've managed to do :p, over write the process instead of loading from the Config files, build array data with all the information and use them arrays.
Seven, i know it seems like leeching... but iam searching for ages for a tut on howto overwrite the config.cpp inside my dayz_server.pbo. PLEEEEEAAAASE!
 
Seven, i know it seems like leeching... but iam searching for ages for a tut on howto overwrite the config.cpp inside my dayz_server.pbo. PLEEEEEAAAASE!

Surely everyone joining your server then needs this file too?


Have you looked up how to replace routines as per the fixes folder for a map?

The name of the .sqf placed here replaces the one in the mission/mod?

ie
..\Steam\steamapps\common\arma 2 operation arrowhead\server_setup\bliss_files\mission\world\chernarus\fixes

or

..\Steam\steamapps\common\arma 2 operation arrowhead\MPMissions\dayz_1.chernarus\fixes
 
yeah i looked it up, but couldnt find a way to replace the config.bin inside dayz_code.pbo in my fixes-folder
 
yeah i looked it up, but couldnt find a way to replace the config.bin inside dayz_code.pbo in my fixes-folder

You cannot replace a bin or cpp file through missions. Either you must distribute your files, or run with Verify Signatures off.
 
I actually have another idea for this, in the editor you can add Weapon Boxes like Russian Basic etc... You could maybe edit them and make them less overpowered. I know this works but im trying to find a solution to add more or fewer weapons.
 
Sure, you can also spawn MedBoxes via DB with Weapons and Stuff in it... Problem is that the Content doesnt save to DB like Tents, so after each Restart the Boxes are full again. Its Ok for pure Deathmatch Servers like Wasteland and such Stuff, but this isnt DayZ anymore ;)
 
Sure, you can also spawn MedBoxes via DB with Weapons and Stuff in it... Problem is that the Content doesnt save to DB like Tents, so after each Restart the Boxes are full again. Its Ok for pure Deathmatch Servers like Wasteland and such Stuff, but this isnt DayZ anymore ;)
Yeah thats what im trying to find out aswell, keep me updated if you find a solution and i will too :)
 
I actually have another idea for this, in the editor you can add Weapon Boxes like Russian Basic etc... You could maybe edit them and make them less overpowered. I know this works but im trying to find a solution to add more or fewer weapons.

Just assign a script to the box's init line and perform something like this:

Code:
init="null = this execVM ""scripts\ammo.sqf"";";

Script ammo.sqf
Code:
while {alive _this} do
{
 
// Remove all the stock items from the crate
clearMagazineCargo _this;
clearWeaponCargo _this;
 
_this addWeaponCargo ["ItemMachete", 3];
 
// Sidearm
_this addWeaponCargo ["glock17_EP1", 2];
_this addWeaponCargo ["M9SD", 2];
_this addWeaponCargo ["Colt1911", 2];
 
// Grenades & Satchels
_this addMagazineCargo ["HandGrenade_West", 2];
 
// Restock time in seconds
sleep 3600;
};

Place script in : ...\Steam\steamapps\common\arma 2 operation arrowhead\scripts
 
Just assign a script to the box and perform something like this:

Code:
while {alive _this} do
{
 
// Remove all the stock items from the crate
clearMagazineCargo _this;
clearWeaponCargo _this;
 
_this addWeaponCargo ["ItemMachete", 3];
 
// Sidearm
_this addWeaponCargo ["glock17_EP1", 2];
_this addWeaponCargo ["M9SD", 2];
_this addWeaponCargo ["Colt1911", 2];
 
// Grenades & Satchels
_this addMagazineCargo ["HandGrenade_West", 2];
 
// Restock time in seconds
sleep 3600;
};

Have you tested it amd does it work? is it possible to add KSVK, RPK, PKM etc.. Will the gear save? so it doesnt respawn after every restart but after time
 
Wont Save, after Restart the box is full again, the only thing i could imagine is to spawn a box like a tent, only with a custom-model and to handle it like a tent...
 
Hmm i would have no idea how to do that, if you find a solution please make tutorial or PM me ;) Because i would love Ammo Boxes spawning loot over time
 
Have you tested it amd does it work? is it possible to add KSVK, RPK, PKM etc.. Will the gear save? so it doesnt respawn after every restart but after time

Well of course it will not save the contents! :) That is performed by the database.
Of course since it is script bound you can of course get the script to write the current contents to disk or the database and reload them at every start up. Once it's in script form, you're not limited. :)

Just add an extra table to the Db and get the script to write to it?
 
I have received quite a few pm's due to my previous post in this topic, So I can see its not as simple to figure out as I thought people would. So I will write up a tutorial on how to achieve custom loot spawns tonight or tomorrow.
 
Back
Top