Loot on a aircraft carrier

Merg

Well-Known Member
So i have the GLT_LHD addon that you put in the addon folder and spawn it as a building through the database, and I've tried to make loot spawn on it. I copied the loot positions from breaking point but loot is still not spawning.

This is my work so far:

CfgBuildinPos.hpp

PHP:
//Aircraft Carrier
    class Land_LHD_house_1: Carrier {
        lootPos[] = {{7.03467,-3.85144,5.80088},{-5.24951,-4.0293,5.87479},{-8.35547,-15.0105,6.19898},{1.46973,-7.62476,6.14285},{10.3423,-3.7583,24.0386},{5.56738,-4.36592,24.4561},{18.0376,-4.50415,23.7435},{8.18262,-16.6764,30.7902},{9.92041,-10.7733,30.0377},{12.0806,-16.1384,30.4988},{15.751,-19.5176,16.8451}};
    };
    class Land_LHD_2: Carrier {
        lootPos[] = {{-18.7207,21.0803,26.7471}};
    };
    class Land_LHD_6: Carrier {
        lootPos[] = {{-3.03564,-16.5674,32.8217},{-6.69873,-16.3793,33.1615}};
    };
    class Land_LHD_elev_R: Carrier {
        lootPos[] = {{20.1255,-0.354858,35.3469}};
    };
    class Land_LHD_house_2: Carrier {
        lootPos[] = {{-1.80127,-5.62732,5.92738},{-5.84717,6.41016,5.52392},{15.5205,-1.38013,12.4102},{9.66016,-1.55664,12.5189},{12.7695,4.48242,12.255},{14.9766,13.6207,11.6659},{19.1577,14.4927,11.5493},{21.1787,9.00769,15.6585},{12.9468,18.5112,20.4233},{9.4082,-1.43701,21.4673},{17.3555,-8.15857,24.4478},{13.8301,-4.60852,28.821},{-16.9253,-19.6313,13.1851},{10.0269,-18.606,13.6471}};
    };
     class Land_LHD_1: Carrier {
        lootPos[] = {{15.1196,16.3479,26.7699},{19.4146,-3.37622,25.7863},{-14.3667,15.4812,26.303}};
    };
and CfgBuildingLoot.hpp

PHP:
    //aircraft carrier
        class Carrier: Default {
        zombieChance = 0;
        minRoaming = 0;
        maxRoaming = 0;
        zombieClass[] = {"z_soldier_pilot"};
        lootChance = 1;
        lootPos[] = {};
        lootType[] = {
        //one spawn
        //tools
            {"Binocular","weapon",0.30},
            {"ItemFlashlightRed","generic",0.05},
            {"ItemKnife","generic",0.05},
            {"ItemGPS","weapon",0.01},
            {"ItemMap","generic",0.50},
            {"Binocular_Vector","generic",0.01},
        //weapons
            {"M16A2","weapon",0.05},
            {"M16A2GL","weapon",0.05},
            {"M249_DZ","weapon",0.01},
            {"M9SD","weapon",0.40},
            {"MakarovSD","weapon",0.20},
            {"AK_74","weapon",0.05},
            {"M4A1_Aim","weapon",0.02},
            {"AKS_74_kobra","weapon",0.05},
            {"AKS_74_U","weapon",0.05},
            {"AK_47_M","weapon",0.05},
            {"M24","weapon",0.01},
            {"SVD_CAMO_DZ","weapon",0.01},
            {"SVD_DZ","weapon",0.30},
            {"M1014","weapon",0.07},
            {"DMR_DZ","weapon",0.70},
            {"M4A1","weapon",0.05},
            {"M14_EP1","weapon",0.03},
            {"UZI_EP1","weapon",0.08},
            {"Remington870_lamp","weapon",0.06},
            {"glock17_EP1","weapon",0.07},
            {"M240_DZ","weapon",0.01},
            {"M4A1_AIM_SD_camo","weapon",0.04},
            {"M16A4_ACG","weapon",0.05},
            {"M4A1_HWS_GL_camo","weapon",0.02},
            {"Mk_48_DZ","weapon",0.01},
            {"M4A3_CCO_EP1","weapon",0.03},
            {"Sa58V_RCO_EP1","weapon",0.20},
            {"Sa58V_CCO_EP1","weapon",0.20},
            {"G36_C_SD_camo","weapon",0.01},
            {"M40A3","weapon",0.02},
            {"Sa58P_EP1","weapon",0.02},
            {"Sa58V_EP1","weapon",0.02},
        //special
            //{"AmmoBoxSmall_556","object",0.04},
            //{"AmmoBoxSmall_762","object",0.02},
            //{"WeaponHolder_ItemCamoNet","object",0.03},
        //mags special
            //{"PipeBomb","magazine",0.01},
            //{"100Rnd_762x54_PK","magazine",0.01},
        //bags
            //{"DZ_CivilBackpack_EP1","object",0.01}, // 24
            //{"DZ_Backpack_EP1","object",0.01}, // 24       
        //multiple spawns
        //    {"","military",0.70},
        //    {"","generic",0.10}
        };
    };
////////////////////////////////////////
As is said, still no luck. Does anyone know how to do this?

Thanks
 

clifdayz

Well-Known Member
Only 18+ months later, but I'll ask anyway...

Anyone have code working for this? I spawned in a carrier via the server pbo. Found the code here someplace - you do a createvehicle["PBX".....] then gets its position, then spawn each of the parts. Works great. You can go onto it and explore. Vehicles don't stay during restart, but thats not the issue now.

I'd like to get some loot, so I added the code above to the mission file (as part of the custom loot code). Alas, no loot. I put myself on the carrier, then got my position and the position I spawned it at, did the delta and tried to add that as a loot spot, but nothing.

It's a tough one to debug for sure.
 

Zeehond23

Valued Member!
Stuff spawns at a position relative to the ground. Therefore, if you want loot at the carrier in the ocean you'd have to get the loot position plus the height from the ground (ocean floor). If you don't incorporate this you'll have one loot rich ocean floor.
 

clifdayz

Well-Known Member
Needs to be in the water. I don't think the issue is gear falling to the ground. Let me post what I'm using:

First, call the code from the server side in server_functions.sqf

[] execVM "\z\addons\dayz_server\CustomBuildings\AC.sqf";

if (isServer) then {

diag_log "[AC] Creating Aircraft Carrier";

_this = createVehicle ["PBX", [13464.0,8356.50,-8], [], 0, "CAN_COLLIDE"];
_carrier = _this;
_this setDir 253;
_this setPos [13464.0,8356.50,-8];

_LHDspawn = _carrier;
_LHDspawnpoint = getposasl _LHDspawn;
deletevehicle _LHDspawn;
_parts =
[
"Land_LHD_house_1",
"Land_LHD_house_2",
"Land_LHD_elev_R",
"Land_LHD_1",
"Land_LHD_2",
"Land_LHD_3",
"Land_LHD_4",
"Land_LHD_5",
"Land_LHD_6"
];
{
_dummy = _x createvehicle _LHDspawnpoint;
_dummy setdir 235;
_dummy setpos _LHDspawnpoint;
}foreach _parts;
diag_log "[AC] Completed Aircraft Carrier";
};

So far, so good, the carrier shows up. I googled around looking for code to set class based loot positions. I can't recall where, but it was on opendayz.net. The poster claimed these positions worked on his carrier.

I found this code and added it to cfgBuildingPos.hpp, since that seemed like the logical place, but maybe it's not. I have that file and other files in the mission since I have updated loot tables.

class Land_LHD_2: Carrier {
lootPos[] = {{-18.7207,21.0803,26.7471}};
};
class Land_LHD_6: Carrier {
lootPos[] = {{-3.03564,-16.5674,32.8217},{-6.69873,-16.3793,33.1615}};
};
class Land_LHD_elev_R: Carrier {
lootPos[] = {{20.1255,-0.354858,35.3469}};
};
class Land_LHD_house_2: Carrier {
lootPos[] = {{-1.80127,-5.62732,5.92738},{-5.84717,6.41016,5.52392},{15.5205,-1.38013,12.4102},{9.66016,-1.55664,12.5189},{12.7695,4.48242,12.255},{14.9766,13.6207,11.6659},{19.1577,14.4927,11.5493},{21.1787,9.00769,15.6585},{12.9468,18.5112,20.4233},{9.4082,-1.43701,21.4673},{17.3555,-8.15857,24.4478},{13.8301,-4.60852,28.821},{-16.9253,-19.6313,13.1851},{10.0269,-18.606,13.6471}};
};
class Land_LHD_1: Carrier {
lootPos[] = {{15.1196,16.3479,26.7699},{19.4146,-3.37622,25.7863},{-14.3667,15.4812,26.303}};
};

No loot nor zombies on the carriers. I did learn that positions are not the same as worldspace. I have yet to get the adds-ons working that show you the loot position for a building, etc. so i can try and verify these.

Someone out there must have a working carrier with loot, just hoping they can share...
 

Zeehond23

Valued Member!
It doesn't have to be on water. At least not all of it. I had a beached carrier on my server just never got round to adding loot.
 

Zeehond23

Valued Member!
Like I, and many others before me have said, the arma engine has some limitations. One of those limitations is that water does not count as a solid foundation (just like real life!).
Every world/building position is counted from the ground (solid) up. If you want to have loot above water you will have to incorporate the height from the seabed up.
For a general idea compare the loot position of any building to the loot position in the namalsk bunker entrance.
 
ok to get zombies spawning you need to change
Code:
class Land_LHD_2: Carrier {
lootPos[] = {{-18.7207,21.0803,26.7471}};
};
to
Code:
class Land_LHD_2: Carrier {
zombieClass[] = {"z_soldier_pilot","z_soldier_heavy"}; //the type of zombies to spawn
zombieChance = 1; //this will always spawn zombies
maxRoaming = 0;
lootPos[] = {{-18.7207,21.0803,26.7471}};
lootPosZombie[] = {{-7.97119,0.0888672,-0.223236},{-5.29053,-0.952148,-0.223236},{-1.9707,-1.5957,-0.223236},{1.48193,-2.20313,-0.223236},{5.24463,-2.05664,-0.223236}}; //where the zombies will spawn
};
you also need to make sure you define carrier in CfgBuildingLoot.hpp

you can simply add this (its just some random loot)
Code:
class Carrier: Default {
lootChance = 1;
lootPos[] = {};
lootType[] = {
{"ItemKnife","weapon",0.01},
{"ItemMap","generic",0.01},
{"ItemCompass","weapon",0.01},
{"ItemFlashlight","weapon",0.01},
//weapons
{"WeaponHolder_ItemHatchet","object",0.01},
//special
{"WeaponHolder_ItemTent","object",0.01},
//{"WeaponHolder_DomeTentStorage","object",0.01},
//mags special
{"PartWoodPile","magazine",0.04},
//bags
//Multiple spawns
{"","Residential",0.60},
{"","generic",0.40}
};
};
above this
Code:
#include "CfgBuildingPos.hpp"
in the CfgBuildingLoot.hpp

as for getting it to spawn ON the carrier you need to change the Z axis in the position

lootPos[] = {{-18.7207,21.0803,26.7471}};

i think 26.7471 could be the Z axis after comparing loot pos for other buildings change

you will also need to do the same for the zombie spawns

lootPosZombie[] = {{-7.97119,0.0888672,-0.223236},{-5.29053,-0.952148,-0.223236},{-1.9707,-1.5957,-0.223236},{1.48193,-2.20313,-0.223236},{5.24463,-2.05664,-0.223236}}; //where the zombies will spawn


this will be alot of trial and error but this should be enough to get you going :)
 

clifdayz

Well-Known Member
darn it, I already had the carrier code in CfgBuildingLoot.hpp (and I can't get the popup to let me set the spolier in chrome, but thats another story). It's right before #include "CfgBuildingPos.hpp"


//aircraft carrier
class Carrier: Default {
zombieChance = 0.5;
minRoaming = 5;
maxRoaming = 10;
zombieClass[] = {"z_soldier_pilot","z_soldier","z_soldier_heavy","z_doctor"};
lootChance = 1;
lootPos[] = {};
lootType[] = {
//one spawn
//tools
{"Binocular","weapon",0.30},
{"ItemFlashlightRed","generic",0.05},
{"ItemKnife","generic",0.05},
{"ItemGPS","weapon",0.10},
{"ItemMap","generic",0.50},
{"Binocular_Vector","generic",0.01},
{"NVGoggles","generic",0.01},
//weapons
{"M4A1_GL_CCO_DZ","weapon",0.05},
{"M240_DZ","weapon",0.02},
{"M249_DZ","weapon",0.02},
{"DMR_DZ","weapon",0.01},
{"L85_Holo_DZ","weapon",0.20},
{"Revolver_DZ","weapon",0.05},
{"SA58_ACOG_DZ","weapon",0.02},
{"G17_DZ","weapon",0.05},
{"M9_DZ","weapon",0.05},
{"M1911_DZ","weapon",0.05},
{"FNFAL_ANPVS4_DZ","weapon",0.01},
{"M24_DZ","weapon",0.01},
{"M16A2_GL_DZ","weapon",0.30},
{"M1014","weapon",0.07},
{"DMR_DZ","weapon",0.70},
{"G36K_Camo_DZ","weapon",0.05},
{"M16A4_GL_DZ","weapon",0.03},
//special
{"AmmoBoxSmall_556","object",0.04},
{"AmmoBoxSmall_762","object",0.02},
{"ItemCamoNet","object",0.03},
//mags special
//{"PipeBomb","magazine",0.01},
//{"100Rnd_762x54_PK","magazine",0.01},
//bags
{"DZ_British_ACU","object",0.20}, // 18
{"DZ_CivilBackpack_EP1","object",0.30}, // 24
//multiple spawns
{"","medical",0.25},
{"","ammo",0.10},
{"","attachmentsWest",0.20},
{"","militaryWEST",0.25}
};
};
 
in fallingsheeps example code ...
Code:
class Land_LHD_2: Carrier {
zombieClass[] = {"z_soldier_pilot","z_soldier_heavy"}; //the type of zombies to spawn
zombieChance = 1; //this will always spawn zombies
maxRoaming = 0;
lootPos[] = {{-18.7207,21.0803,26.7471}};
lootPosZombie[] = {{-7.97119,0.0888672,-0.223236},{-5.29053,-0.952148,-0.223236},{-1.9707,-1.5957,-0.223236},{1.48193,-2.20313,-0.223236},{5.24463,-2.05664,-0.223236}}; //where the zombies will spawn
};
isn't the base class supposed to come after the new class? You are defining a new class CARRIER which is derived from Land_LHD_2 so it should be class Carrier : Land_LHD_2 {
... me guesses ....
 

clifdayz

Well-Known Member
In CfgBuildingLoot.hpp I define Carrier : Default. That file then includes CfgBuildingPos where I declare the various LAND_LHD* classes based on Carrier., so I think I have the hierarchy correct.

I also wondered whether the spawn code was messing up the coords (and I still can't get the "more options popup to work anymore), so after calling createVehicle, I grabbed the coord back and reset them on the object. That messed everything up. for some reason.

I press on.
 
Ignore what I said in my previous post. I was just thinking about C# class definitions and ... well .. it was an incorrect thought, after actually looking at the loot files its correct as is. ...

I wonder if the problem is that the Carrier parts are not actually buildings and therefore dont have the ability for loot spawns. Anyways, a workaround might be to use actual worldspace coords (including the Z axis above the seabed as mentioned) and create the loot at the bottom of the script that creates the actual carrier. You might have to use triggers to delete and recreate the loot or else it will only spawn once on server start. Refer to the animated heli crash script for what I am talking about ... it creates the crashsite, then loot positions and then spawns in the loot.

Code:
// SPAWN THE LOOT 
       
        for "_x" from ((round(random _randomizedLoot)) + _guaranteedLoot) to 1 step -1  do {
                //create loot
                _itemTypes = [] + getArray (configFile >> "CfgBuildingLoot" >> _lootTable >> "lootType");
                _CBLBase = dayz_CBLBase find _lootTable;
                _weights = dayz_CBLChances select _CBLBase;
                _cntWeights = count _weights;
                _index1 = floor(random _cntWeights);
                _index2 = _weights select _index1;
                _itemType = _itemTypes select _index2;

                _lootpos = [];
                for [{_y = 0}, {_y < 10 && ((count _lootpos) == 0)}, {_y = _y + 1}] do {
                    _angle = random 360;
                    _radius = 0.9 + random 0.6;
                    _lootpos = _crash modelToWorld [_radius*_width*sin(_angle), _radius*_length*cos(_angle), 0];
                    _lootpos = _lootpos findEmptyPosition [0,_length/3, "WeaponHolder"];
                };

                if ((count _lootpos) >= 2) then {
                    _lootpos set [2,0];
                    _item = [_itemType select 0, _itemType select 1, _lootpos, 1] call spawn_loot;
                    _item setVariable ["permaLoot",true];
                   
                    switch true do {
                        case (dayz_spawnCrashSite_clutterCutter == 1): { // shift loot upward to 5cm
                            _lootpos set [2,0.05];
                            _item setPosATL _lootpos;
                        };
                        case (dayz_spawnCrashSite_clutterCutter == 2): { // cutterclutter
                            _clutter = createVehicle ["ClutterCutter_small_2_EP1", _lootpos, [], 0, "CAN_COLLIDE"];
                            _clutter setPos _lootpos;
                        };
                        case (dayz_spawnCrashSite_clutterCutter == 3): { // shift loot upward to 5cm
                            createVehicle ["Sign_sphere100cm_EP1", [_lootpos select 0, _lootpos select 1, 0.30], [], 0, "CAN_COLLIDE"];
                        };
                    };
                     
                    //diag_log(format["CRASHSPAWNER: Loot spawn at '%1 - %3' with loot table '%2'", _crashName, str(_itemType),_lootpos]);
                    sleep 0.001;
                };
            }; // loot loop
 

clifdayz

Well-Known Member
good idea, I will try it. Funny, I have the animated heli code, but I haven't put it in yet. Off the top of my head

1) I wonder if something like the admin dome code I have would work as well, just might be harder to define the boundaries.
2) I have the DZMS code which has some similar-ish code with triggers on complete
3) (Out loud) - Can I redefine the carrier pieces as a building type? I tried declaring them as type "ship" but that wasn't working.
4) In the editor there is a frigate or something - maybe that would work easier.
5) back to your idea, I still wonder the actual position of the pieces since you are only setting the one and letting others fall into place I think. Anyway, could I place something on the carrier that already spawns loot+zombies? Hmm, maybe it will fall through which is another issue.
6) Another thread claimed that breaking point had figured it out, but I can't confirm it nor find the arma2 code anywhere. Still asking around for that.

not giving up yet!
 
Top