DayZ Base Building 1.3 Discussion

Well....I guess i should share my progress lol :p

If you have DayZ Mod 1.8.1 you can use my method to make base building 1.3 work, mostly. This will diable the need for flags, glag checks and anything flag related. Personally idm because i dont like authorized building in an open world game but, meh. Ok so here goes:

Step 1
Follow the install guide for this addon. Easy enough ;)

Step 2
In the server publish object server file you need to have this at the top:
Code:
private ["_class","_uid","_charID","_object","_worldspace","_key"];
//[dayz_characterID,_tent,[_dir,_location],"TentStorage"]
_charID =        _this select 0;
_object =         _this select 1;
_worldspace =     _this select 2;
_class =         _this select 3;

_failed = false;
if (count _this > 3) then {
    _player = _this select 4;
 
    if (_player distance _object > 10) then {
        _failed = true;
        diag_log format["Player: %1 is too far from object: %2, Distance: %3",_player,_object,(_player distance _object)];
    };
};

_inventory =     [];
_fuel = [];
if (count _this > 4) then {
    _fuel =         _this select 4;
    if (count _fuel > 0) then {
    _inventory = _fuel;
    } else {
        _inventory = [];
    };
};
Not sure if the invenotry - []; block in this position matters but it seems to matter since the whole select _this 1, 2, 3... should be in order right? Idk maybe i am just OCD rofl. The only thing different here is i placed this block last before the #include line. Anyways...

Step 2
Same file you should have this:
Code:
//Send request
    if (_object isKindOf "TrapItems") then {
        _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [_object getVariable ["armed", false]], [], 0,_uid];
    } else {
        if (typeOf(_object) in allbuildables_class) then {
            _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [[[_uid]],[_inventory]], [], 0,_uid];
        } else {
            _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], 0,_uid];
        };
    };
    //diag_log ("HIVE: WRITE: "+ str(_key));
    _key call server_hiveWrite;

    if (typeOf(_object) in allbuildables_class) then { //Forces the variable to be updated so server doesn't need to be restarted to allow interaction
        _updatedAuthorizedUID = [[[_uid]],[_inventory]];
        _object setVariable ["AuthorizedUID", _updatedAuthorizedUID, true]; //sets variable with full useable array
    };
Instead of the one in the tutorial. The change here is we need to preprare the key to save a proper array and not a string which the tutorial creates. Keep in mind this is a new sql database style, different but new :)

So the whole publish objects should look like this now:
Code:
private ["_class","_uid","_charID","_object","_worldspace","_key"];
//[dayz_characterID,_tent,[_dir,_location],"TentStorage"]
_charID =        _this select 0;
_object =         _this select 1;
_worldspace =     _this select 2;
_class =         _this select 3;

_failed = false;
if (count _this > 3) then {
    _player = _this select 4;
 
    if (_player distance _object > 10) then {
        _failed = true;
        diag_log format["Player: %1 is too far from object: %2, Distance: %3",_player,_object,(_player distance _object)];
    };
};

_inventory =     [];
_fuel = [];
if (count _this > 4) then {
    _fuel =         _this select 4;
    if (count _fuel > 0) then {
    _inventory = _fuel;
    } else {
        _inventory = [];
    };
};

#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"

//if (!(_object isKindOf "Building")) exitWith {
//    deleteVehicle _object;
//};

_allowed = [_object, "Server"] call check_publishobject;

if (_allowed) then {
    //diag_log ("PUBLISH: Attempt " + str(_object));

    //get UID
    _uid = _worldspace call dayz_objectUID2;

    //Send request
    if (_object isKindOf "TrapItems") then {
        _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [_object getVariable ["armed", false]], [], 0,_uid];
    } else {
        if (typeOf(_object) in allbuildables_class) then {
            _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [[[_uid]],[_inventory]], [], 0,_uid];
        } else {
            _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], 0,_uid];
        };
    };
    //diag_log ("HIVE: WRITE: "+ str(_key));
    _key call server_hiveWrite;

    if (typeOf(_object) in allbuildables_class) then { //Forces the variable to be updated so server doesn't need to be restarted to allow interaction
        _updatedAuthorizedUID = [[[_uid]],[_inventory]];
        _object setVariable ["AuthorizedUID", _updatedAuthorizedUID, true]; //sets variable with full useable array
    };

    _object setVariable ["ObjectUID", _uid,true];

    if (_object isKindOf "TentStorage" || _object isKindOf "CamoNet_DZ" || _object isKindOf "Land_A_tent") then {
        _object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
    };

    dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];

    #ifdef OBJECT_DEBUG
    diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid);
    #endif

};
Check? Check...

Step 3
Open your update object file in the server pbo and you should have this:
Code:
//####----####----####---- Base Building 1.3 Start ----####----####----####
    _object_inventory = {
        private["_inventory","_previous","_key"];
        if (_object isKindOf "TrapItems") then {
            _inventory = [_object getVariable ["armed", false]];
        } else {
            if (typeOf(_object) in allbuildables_class) then {
                _inventory = _object getVariable ["AuthorizedUID", []]; //Shouldn't need to specify which array since it's all being updated here
                _authorizedOUID = (_inventory select 0) select 0;
                _key = format["CHILD:309:%1:%2:",_authorizedOUID,_inventory]; //was _uid,_inventory
                diag_log ("HIVE: WRITE: "+ str(_key));
                _key call server_hiveWrite;
            } else {
                _inventory = [
                    getWeaponCargo _object,
                    getMagazineCargo _object,
                    getBackpackCargo _object
                ];
                _previous = str(_object getVariable["lastInventory",[]]);
                if (str(_inventory) != _previous) then {
                    _object setVariable["lastInventory",_inventory];
                    if (_objectID == "0") then {
                        _key = format["CHILD:309:%1:%2:",_uid,_inventory];
                    } else {
                        _key = format["CHILD:303:%1:%2:",_objectID,_inventory];
                    };
                    diag_log ("HIVE: WRITE: "+ str(_key));
                    _key call server_hiveWrite;
                };
            };
        };
    };
    //####----####----####---- Base Building 1.3 End ----####----####----####
Now this may be the exact same but better safe than sorry right? Sweet :)
Now you can build anything, even a flagpole if ya wanna lol. When you restart you will get 0 errors from the base building for loading objects right? Maybe not, if you have not already done so please paste this in your dayz_code variables:
Code:
    DayZ_SafeObjects = ["Land_Fire_DZ", "TentStorage","TentStorage0","TentStorage1","TentStorage2","TentStorage3","TentStorage4","StashSmall","StashSmall1","StashSmall2","StashSmall3","StashSmall4","StashMedium","StashMedium1","StashMedium2","StashMedium3", "StashMedium4", "Wire_cat1", "Sandbag1_DZ", "Fence_DZ", "Generator_DZ", "Hedgehog_DZ", "BearTrap_DZ", "DomeTentStorage", "DomeTentStorage0", "DomeTentStorage1", "DomeTentStorage2", "DomeTentStorag3", "DomeTentStorage4", "CamoNet_DZ", "Trap_Cans", "TrapTripwireFlare", "TrapBearTrapSmoke", "TrapTripwireGrenade", "TrapTripwireSmoke", "TrapBearTrapFlare", "Grave", "Concrete_Wall_EP1", "Infostand_2_EP1", "WarfareBDepot", "Base_WarfareBBarrier10xTall", "WarfareBCamp", "Base_WarfareBBarrier10x", "Land_fortified_nest_big", "Land_Fort_Watchtower", "Land_fort_rampart_EP1", "Land_HBarrier_large", "Land_fortified_nest_small", "Land_BagFenceRound", "Land_fort_bagfence_long", "Land_Misc_Cargo2E", "Misc_Cargo1Bo_military", "Ins_WarfareBContructionSite", "Land_pumpa", "Land_CncBlock", "Hhedgehog_concrete", "Misc_cargo_cont_small_EP1", "Land_prebehlavka", "Fence_corrugated_plate", "ZavoraAnim", "Land_tent_east", "Land_CamoNetB_EAST", "Land_CamoNetB_NATO", "Land_CamoNetVar_EAST", "Land_CamoNetVar_NATO", "Land_CamoNet_EAST", "Land_CamoNet_NATO", "Fence_Ind_long", "Fort_RazorWire", "Fence_Ind","Land_sara_hasic_zbroj","Land_Shed_wooden","Land_Barrack2","Land_vez","FlagCarrierBAF","FlagCarrierBIS_EP1","FlagCarrierBLUFOR_EP1","FlagCarrierCDF_EP1","FlagCarrierCDFEnsign_EP1","FlagCarrierCzechRepublic_EP1","FlagCarrierGermany_EP1","FlagCarrierINDFOR_EP1","FlagCarrierUSA_EP1","Land_Ind_Shed_01_main","Land_Fire_barrel","Land_WoodenRamp","Land_Ind_TankSmall2_EP1","PowerGenerator_EP1","Land_Ind_IlluminantTower","Land_A_Castle_Stairs_A","Land_A_Castle_Bergfrit","Land_A_Castle_Bastion","Land_A_Castle_Wall1_20","Land_A_Castle_Wall1_20_Turn","Land_A_Castle_Wall2_30","Land_A_Castle_Gate","Land_House_L_1_EP1","Land_ConcreteRamp","RampConcrete","HeliH","HeliHCivil","Land_ladder","Land_ladder_half","Land_Misc_Scaffolding","CDF_WarfareBUAVterminal","Land_Ind_Shed_01_end","Land_Ind_SawMillPen"];
This is slightly different in this update so we need to make it use the right variable ;)
Use this playerbuild2 and playerremove.sqf file instead of the ones from the tutorial
https://www.dropbox.com/sh/hgell0cdspx88zs/AADmOrW7H_XruYTiGvMRznPza
 
Last edited:
Sorry for the long and probably confusing post everyone lol :p but this should be everyting needed to make base building work for 1.8.1


*EDIT*
If you noticed there are two step 2s then turn to the nearest person and give them a high five!
 
Last edited:
In the end I decided to remove bb1.3 as much as I enjoyed using the script I found it to have too many bugs for an Epoch server.
 
I have been working with this in 1.8.1 still and I have found a few more issues. Though they are not preventing the addition from functioning there are some parts of it that don't work quite right. So far the only thing that does not seem to work properly is the ability to open and close gates, I am assuming this is from the omission of the UID system I am running. So to correct myself, this is not running bug free, however; in 1.8.1 it will save, remove and function as it should in most everything from what we can tell. I wouldn't mind some suggestions about how to get this working with the hivemind structure in regard to UIDs if anyone had an idea.
 
What can i do to stop gear from spawning in the buildings?
I am pretty sure there is a part of the tutorial that covers that. Check your compiles, settings, and variables in the dayz_code you download for this and I am sure I have seen that option in there.
 
ya every time i do it, it stops the who server from spawning gear and zs anyone have a working player_spawnCheck.sqf"; i just want gear not to spawn at the buildings that they build.
 
ya every time i do it, it stops the who server from spawning gear and zs anyone have a working player_spawnCheck.sqf"; i just want gear not to spawn at the buildings that they build.
Last time i did that i had to edit my spawn points and spawn tables to select what buildings just didn't spawn loot. There is a thread on it, if i can find it i will link it for you.
 
Anyone get the building items to stay gone after they are removed after a restart for epoch 1.0.5.1. people are starting to abuse this bad on my server.
 
Anyone get the building items to stay gone after they are removed after a restart for epoch 1.0.5.1. people are starting to abuse this bad on my server.
Find your original server pbo and open the update objects file. Look at the bottom and it will say something like PVCDZ update objects or something similar. You need to change the base build code block to match how epoch saves. Once the variables and save calls match then you will be fine.

EDIT:
Make this code block match the player_remove file of base build not the one i previously mentioned.
 
Last edited:
What do i change it to?
open your epoch pbo and find the player remove file used for tents, prob in the compile folder in dayz_code pbo and what not by default. Then use the same wordings used to remove tents and update the to remove the base build stuff too. Basically you are seeing how epoch has it set to remove tents and use that same logic to remove stuff with the base build player remove file.

EDIT:
Man i am making this cornfuzing I am sorry here:

Open your @epoch dayz_code pbo
Open the player remove file inside of the compile folder
Scroll to the part that says PVDZEsavedatabase or something like that and make your player remove file inside the base building work the same.
 
hrm, i dont have epoch installed atm. Unpack the dayz_code pbo in your dayz_epoch folder. Open the compile folder that comes out of said pbo. You will see a file named player_remove or something to that nature. It may be towards the bottom of the list of files in the compile folder. Every dayz has one. Open this file with your text editor and scroll down to the variables that actually update the DB to remove said object. Those are the variables you need to paste in place of the existing base building player remove variables at the end ( there may be two parts that update the DB when the remove file is executed. Make sure you find all the variables and change them.)
 
Like i said there is not a player_remove in the compile I opened @epoch found dayz_code unpacked it went to compile and its not there. Just download it and you can see its not there. I have been installing scripts for a while. I am not the best but I understand where everything is.
 
Back
Top