100% Custom Loot tables - TUTORIAL

I have removed the heli crash code, I left it in from it being a pure copy and paste from the config.cpp.

the "","military" are classes of predefined groups. These can't be changed the buildings_spawnLoot.sqf. They would need to be changed in spawn_loot.sqf.
These groups are mainly used for zombie loot but are used for the likes of trash and ammo. They will not spawn weapons.

here is the hunter class:


"ItemBandage",
"5x_22_LR_17_HMR",
"7Rnd_45ACP_1911",
"10x_303",
"ItemWaterbottleUnfilled",
"WoodenArrow",
"ItemHeatPack",
"FoodMRE",
"FoodNutmix"
 
Where can I see everything it'd call from say, "", generic

Useful to know. Fantastic guide by the way.

As well, my server we are encountering a lot of weapons spawning with no ammo. Any way to resolve this or force more ammo to spawn with them?

Not seeing barns as being defined in building calsses either. Wouldn't this then be assigned as residential?
 
I received a PM about adding extra buildings that aren't already predefined in the existing config files. This needs some extra work. You will need to find positions you require your buildings to spawn loot in their local coordinates and add them in manually to new case statements of the original code.

Here is a copy and paste from my reply to this user:


in the switch(_type) section:
Code:
switch (_type) do {
    case "Land_HouseV_1I4": { _LootClass = "Residential"; };
    case "Land_kulna": { _LootClass = "Residential"; };
    case "Land_Ind_Workshop01_04": { _LootClass = "Residential"; };
};
You can easily add positions. Just add a new case and the extra _positions variable.
Code:
case "Land_mYcustombuilding": { _LootClass = "MilitarySpecial"; _positions = [[0.1,-1.9,-2.21],[0.2,-0.45,-1.56]]; };

Actually getting these coordinates will be the challenge, I know there is a code floating about somewhere that makes it easy to get the coordinates but I'm not to sure where to find it.


tried everything regarding this after you send me the answer in a PM, tried both with using arrays [[]] and {{}}, to no avail, and used my own coordinates based on an XYZ key (which me and a couple friends think is the formula for the lootpos. Also used preset coordinates in big amounts just to test if it would spawn loot in the air/what not. Again, with no results :(.

Here are the different cases i ran so you can see if i made any mistakes in what you think is the right one:::

http://pastebin.com/vT49y6PF
 
Care to expand on what these positions are? Are they in reference to the top left hand corner of the building when azimuth is at zero?

Well we could never figure out a definite answer to what it is. But we predicted that it was XYZ format. So we just subtracted the worldspace for the center of the model and the loot spawn and then converted it. But we never got the loot to spawn at all so im not sure if thats correct or not

(but if your talking about the huge list, its just preset lootpos from another building)
 
I don't know whether or not I'm understanding this thing wrong, but may I ask what the deal with the 2.5 spawn and such spawn chances are?

Like here:
Code:
LOOT:
["","medical"],
["","generic"],
["","military"],
 
.....
 
CHANCES:
0.10,
1.00,
2.50,

How does "military" loot spawn with a 2.50 chance? Does that mean like 250% chance? o_O
 
It a weighted percentage. Take the three examples. Say every 0.01 = 1 so 0 to 9 is medical 10 to 109 is generic and 110 to 359 is military
You would then run a random int from 0 to the max total items (359). If it lands in any of these ranges it will decide on what item is spawning. The more of the same item is going to give it a higher chance of spawning.

There are many ways of handling this. But this is the simplest way to explain what is going on.
 
Hey, Seven

I want to use your custom loot tables on the Taviana.eu server I run. My confusion - after reading this entire thread - lies in your arrangement of building_spawnLoot.sqf. Obviously Taviana contains a number of buildings not found on Chernarus, however some of them do not seem to spawn anything. What I glean from comparing building_spawnLoot.sqf. to the config.cpp from the .EU Code, is that you have inverted the definition of building classses with that of loot classes and their respective arrays. What I was planning to do, was to convert the entire relevant blocks of cpp code for Tavi.eu to sqf as you've done for Chernarus. I am just not certain how to arrange my own custom building_spawnLoot.sqf. as you have.

Also, Tavi.eu comes with special loot classes that I wish to keep. Another thought I had had was creating and assigning a custom loot class for the infamous offshore drilling platforms - to give my players a good reason to go out there.

Also, what would I do about loot positions for each building class? I see that in your building_spawnLoot.sqf. you did not carry them over. Is defining the building class enough to tell the map/mod specific code where to spawn each pile of loot?
 
I managed to convert you're 100% Custom Loot table for Chernarus over to Taviana.eu 1.5.1. I used your building_spawnLoot.sqf. as a template (thanks much), and from there transfered the necessary building and loot classes. I have not tested this yet:

https://github.com/Saethkept/Parabellum/blob/master/building_spawnLoot.sqf

Additionally, while I successfully transferred all of the building classes over - and there were a ton of them - there is this bit at the bottom of the Tavi.eu config.cpp that I was unsure about - all the 'roaming' stuff. Not certain if any of the below needs to go into building_spawnLoot.sqf or not:

Code:
class HouseRoaming: Residential {
        lootChance = 0;
        zombieChance = 0;
        maxRoaming = 2;
    };
    class FarmRoaming: Farm {
        lootChance = 0;
        zombieChance = 0;
        maxRoaming = 2;
    };
    class Land_Shed_W03: HouseRoaming {}; // Qty: 206
    class Land_HouseV_1I3: HouseRoaming {}; // Qty: 117
    class Land_HouseV_1L1: HouseRoaming {}; // Qty: 97
    class Land_HouseV_1I2: HouseRoaming {};
    class Land_HouseV_2L: HouseRoaming {};
    class Land_HouseV_2T1: HouseRoaming {};
    class Land_houseV_2T2: HouseRoaming {};
    class Land_HouseV_3I2: HouseRoaming {};
    class Land_HouseV_3I3: HouseRoaming {};
    class Land_HouseBlock_A1: HouseRoaming {};
    class Land_HouseBlock_A1_2: HouseRoaming {};
    class Land_HouseBlock_A2: HouseRoaming {};
    class Land_HouseBlock_A2_1: HouseRoaming {};
    class Land_HouseBlock_A3: HouseRoaming {};
    class Land_HouseBlock_B1: HouseRoaming {};
    class Land_HouseBlock_B2: HouseRoaming {};
    class Land_HouseBlock_B3: HouseRoaming {};
    class Land_HouseBlock_B4: HouseRoaming {};
    class Land_HouseBlock_B5: HouseRoaming {};
    class Land_HouseBlock_B6: HouseRoaming {};
    class Land_HouseBlock_C1: HouseRoaming {};
    class Land_HouseBlock_C2: HouseRoaming {};
    class Land_HouseBlock_C3: HouseRoaming {};
    class Land_HouseBlock_C4: HouseRoaming {};
    class Land_HouseBlock_C5: HouseRoaming {};
    class Land_HouseV2_01B: HouseRoaming {}; // Qty: 20
    class Land_Misc_Cargo1D: HouseRoaming {}; // Qty: 29
    class Land_HouseV2_03: HouseRoaming {}; // Qty: 8
    class Land_Ind_Shed_01_end: HouseRoaming {}; // Qty: 266
    class Land_A_statue01: HouseRoaming {
        zombieClass[] = {"zZombie_Base","zZombie_Base","z_teacher","z_suit1","z_suit2","z_soldier","z_soldier_heavy","z_policeman"};
        minRoaming = 2;
        maxRoaming = 8;
    }; // Qty: 3
    class Land_Shed_W02: FarmRoaming {}; // Qty: 213
    //allow
    class Grave: HouseRoaming {
        maxRoaming = 3;
    };
    class GraveCross1: HouseRoaming {   
        maxRoaming = 2;
    };
    class GraveCross2: HouseRoaming {   
        maxRoaming = 2;
    };
    class GraveCrossHelmet: Military {   
        maxRoaming = 4;
    };
};
 
/*
class Land_Mil_House: Default {}; // Qty: 5
 
You do not need the end chunk. The buildings you would need to add are only the ones that have positions defined for where the loot goes.
The last extra buildings you see are non-enterable buildings that still need to be defined for the zombie spawn logic.

You still need to finish your code however. Now that you have added all the buildings, you need to convert all of the actual loot tables, since tavi uses a lot of extra weapons. Plus depending on the version might not have the new backpacks.
 
Ok, thank you for the pointers, Seven. Taviana has both a 'Farm' and 'Church' loot class that I did carry over, but rather than bringing over the 'Office' class of loot, I just assigned 'Residential' to spawn in the buildings that call for it. Going to try to complete and test it sometime today.
 
Yet a couple of more questions ... I am embarrassingly new at this.

When adding a weapon to the loot arrays under a loot case such a 'Military', will ammo for said weapon automatically spawn in game? I understand that banned weapons cannot be added, however with DayZ.st the inventory editor provides options for a number of not spawning but not banned weapons, such as the L86 LSW which I have tested as working on Tavi.eu.

I have edited the various loot classes such as 'Farm', 'Military', etc. to match the config.cpp file for Taviana.eu. Will the rest of your excellent coding - such as the functions in your original building_spawnLoot.sqf - work properly with Taviana.eu, or must they be modified as well? I know that Taviana.eu (1.5.1) runs on DayZ code 1.7.5.1.
 
Most of the time when a weapon spawns it will spawn up to 4 mags with it. These mags are pulled from the weapons class definition, no extra code is required for this to work.
Although if the weapons mags aren't spawned naturally by cfg_loot.hpp they will not appear in random junk piles unless there were a few modifications made to the spawn_loot.sqf to handle the new items.

I have tested this code from 1.7.4.4 and up. The code is based of the original loot spawning rather than the new weight system that was added in 1.7.5.1
 
Thank you, I will post my modified code today. I also had to remove the 'Hunting' loot case, as this did not appear in the Tavi.eu config.cpp, and so I changed tree stands back to 'Military'.
 
Back
Top