Help with getting a 2nd lootable tent design working.

McKeighan

Well-Known Member
I've been trying to code this for a few days now, and I'm getting a little confused as to why it's not working.

Here's the pertinent information from my dayz_equip.pbo (config.bin)
Code:
class ItemTent: CA_Magazine
    {
        scope = 2;
        count = 1;
        type = "(256 * 3)";
        displayName = "$STR_EQUIP_NAME_20";
        model = "\dayz_equip\models\tentbag_gear.p3d";
        picture = "\dayz_equip\textures\equip_tentbag_ca.paa";
        descriptionShort = "$STR_EQUIP_DESC_20";
        class ItemActions
        {
            class Pitch
            {
                text = "$STR_PITCH_TENT";
                script = "spawn player_tentPitch;";
            };
        };
    };
    class ItemDomeTent: CA_Magazine
    {
        scope = 2;
        count = 1;
        type = "(256 * 3)";
        displayName = "6 Man Dome Family Tent";
        model = "\dayz_equip\models\tentbag_gearcamo.p3d";
        picture = "\dayz_equip\textures\equip_tentbag_ca.paa";
        descriptionShort = "6 Man Dome Family Tent";
        class ItemActions
        {
            class Pitch
            {
                text = "$STR_PITCH_TENT";
                script = "spawn player_dometentPitch;";
            };
        };
    };

and

Code:
    class WeaponHolder_ItemTent: WeaponHolderBase
    {
        scope = 2;
        displayName = "$STR_EQUIP_NAME_20";
        model = "\dayz_equip\proxy\tentbag.p3d";
        class eventHandlers
        {
            init = "[(_this select 0),'cfgMagazines','ItemTent'] execVM '\z\addons\dayz_code\init\object_pickupAction.sqf';";
        };
    };
    class WeaponHolder_ItemDomeTent: WeaponHolderBase
    {
        scope = 2;
        displayName = "6 Man Dome Tent";
        model = "\dayz_equip\proxy\tentbag.p3d";
        class eventHandlers
        {
            init = "[(_this select 0),'cfgMagazines','ItemDomeTent'] execVM '\z\addons\dayz_code\init\object_pickupAction.sqf';";
        };
    };

and

Code:
    class ACamp;
    class Land_A_tent;
    class TentStorage: Land_A_tent
    {
        vehicleClass = "Survival";
        transportMaxMagazines = 100;
        transportMaxWeapons = 10;
        transportMaxBackpacks = 3;
    };
    class DomeTentStorage: ACamp
    {
        vehicleClass = "Survival";
        transportMaxMagazines = 200;
        transportMaxWeapons = 30;
        transportMaxBackpacks = 10;
    };



In essence what is happening is that I can loot both objects from the table just fine (both tents create just fine and are lootable objects). I can create the tent, as each calls a different script. The normal tent works as it should and drops... the larger 6 man tent does not do anything. The character goes through the motions of building a tent, and then after the 5 second delay, there's nothing there. The tent item in my inventory is gone, but the tent itself is not placed in the world.

Here is the code from my dometent_pitch.sqf

Code:
private["_position","_tent","_location","_isOk","_backpack","_tentType","_trg","_key"];
//check if can pitch here
call gear_ui_init;
_playerPos =     getPosATL player;
_item = _this;
_hastentitem = _this in magazines player;
_location = player modeltoworld [0,2.5,0];
_location set [2,0];
_building = nearestObject [(vehicle player), "HouseBase"];
_isOk = [(vehicle player),_building] call fnc_isInsideBuilding;

//_isOk = true;


//diag_log ("Pitch Tent: " + str(_isok) );

_config = configFile >> "CfgMagazines" >> _item;
_text = getText (_config >> "displayName");

if (!_hastentitem) exitWith {cutText [format[(localize "str_player_31"),_text,"pitch"] , "PLAIN DOWN"]};

//blocked
if (["concrete",dayz_surfaceType] call fnc_inString) then { _isOk = true; diag_log ("surface concrete"); };
//Block Tents in pounds
_objectsPond =         nearestObjects [_playerPos, [], 10];
    {
        _isPond = ["pond",str(_x),false] call fnc_inString;
        if (_isPond) then {
            _pondPos = (_x worldToModel _playerPos) select 2;
            if (_pondPos < 0) then {
                _isOk = true;
            };
        };
    } forEach _objectsPond;

//diag_log ("Pitch Tent: " + str(_isok) );

    if (!_isOk) then {
        //remove tentbag
        player removeMagazine _item;
        _dir = round(direction player);    
    
        //wait a bit
        player playActionNow "Medic";
        sleep 1;
        [player,"tentunpack",0,false] call dayz_zombieSpeak;
    
        _id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
        
        sleep 5;
        //place tent (local)
        _tent = createVehicle ["TentDomeStorage", _location, [], 0, "CAN_COLLIDE"];
        _tent setdir _dir;
        _tent setpos _location;
        player reveal _tent;
        _location = getPosATL _tent;

        _tent setVariable ["characterID",dayz_characterID,true];

        //player setVariable ["tentUpdate",["Land_A_tent",_dir,_location,[dayz_tentWeapons,dayz_tentMagazines,dayz_tentBackpacks]],true];

        dayzPublishObj = [dayz_characterID,_tent,[_dir,_location],"TentDomeStorage"];
        publicVariable "dayzPublishObj";
        if (isServer) then {
            dayzPublishObj call server_publishObj;
        };
    
        cutText [localize "str_success_tent_pitch", "PLAIN DOWN"];
    } else {
        cutText [localize "str_fail_tent_pitch", "PLAIN DOWN"];
    };

And yes - I did create a database object in the deployables table called "TentDomeStorage" with a type id set to 1000 (to make it easy to spot in the instance_deployable table).


Any ideas why it's not working?
 
I couldnt get this to work with what you posted. I just changed the standard tent to ACamp.

I noticed in your last code, you still have Land_A_Tent as the class. Change that to ACamp and see if it works.
 
tortured - that's in a commented out section tho.... It's a note from what the dayz guys had their before. the code just below it is what they had working, which I modified.
 
Hmm. I see that now. Honestly I dont know. Seems like you are missing the class Acamp somewhere. I edited the standard tent scripts to be Acamp instead and it worked fine.
 
Sorry. All I did was change the Land_A_Tent for the current tent system to be ACamp to be sure the model works. When I tried to add a second tent I was unable to get the new pitch tent to work. (Probably my fault). I will check on this more later.

I assume you added your dome pitch tent to your variables?
 
Yea. If I remember you need to add your dometentPitch in there. Trying to remember off hand and not in front of the files. I'll be able to look at it later.
 
Did you get this working ? Am currently trying to get a crate to update inventory to the database. I have it spawning and being added to the database, can't get inventory updating. Have trawled through the dayZ code looking for something extra for tents. Have added a server monitor, same as in the tent pitching code.

Am about to create a whole new item to see if it helps. A lot of this is being done as a mission and by the client, don't know if that is having an effect.
 
I kinda put this on the back burner my self. I like using the ACamp tent instead and just change the class.

I do however want to add other items to work much like the tent. Like a camo net in a bag that can be deployed and packed, but doesn't hold gear.

I have this half working and continue to fiddle with it.
 
Well, yes and no.

I can get both tents to deploy and both to pack back up. Both hold items, but sadly, I can only get the old tent to actually hold items over a server restart. The "new" tent is only in game... it never actually writes to the database at all.

I've placed the new tent as an object in the database by hand, and it shows up in game, but the inventory never saves.

I can get you a list of the various pbo files that I've touched or repilcated, and maybe that can help you piece together what you need to get your stuff working Axe.

I worry that it's a limitation due to the hiveEXT.dll - and if it is that, there's pretty much nothing we can do get around it easily short of writing a new version of the hiveEXT.dll.
 
Back
Top