Overpochins base building

Discussion in 'Scripting Discussions' started by FallingSheep, Sep 21, 2017.

  1. FallingSheep

    FallingSheep OpenDayZ Lord!

    Joined:
    Mar 17, 2013
    Messages:
    1,980
    Likes Received:
    576
    Anyone interested in origins buildings for epoch 1.0.6.1?

    For origins 1.7.9.5
    Tied to plot poles and no blueprints needed (going to add later maybe)
    Saves to DB
    Inventory saves as well
     
  2. KiritoKun223

    KiritoKun223 New Member

    Joined:
    Oct 17, 2017
    Messages:
    1
    Likes Received:
    0
    Who wouldn't be? I'm trying to set this up, with working Nestings and so on. Can you help me with that? Just checked the MySQL Database, Gear doesn't save and the "Gear" tab in the database looks different to the one of vehicles for example.
     
    Last edited: Oct 17, 2017
  3. FallingSheep

    FallingSheep OpenDayZ Lord!

    Joined:
    Mar 17, 2013
    Messages:
    1,980
    Likes Received:
    576
    ok so gear saves but gets wiped when unlocking/locking, im working on a fix

    below is the files i have modified

    the code now uses plotpoles to check if you can build and checks nearby buildings to see if you already have a level1/2/3 house nearby, it also only lets the plotowner build a stronghold

    origins\build_it.sqf
    Code:
    private ["_canBuildOnPlot","_hero1","_hero2","_hero3","_garage1","_garage2","_pyramid1","_stronghold1","_bandit1","_bandit2","_bandit3","_houselevel","_humanityNeed","_classname","_buildingpart","_name","_case","_humanity","_playerUID","_hasLevel1","_hasLevel2","_hasLevel3","_hasSG","_hasLG","_hasKING","_hasSH","_canBuild","_hasone"];
    closeDialog 0;
    _houselevel = _this select 0;    // H1
    _humanityNeed = _this select 1;    // 5000
    _classname = _this select 2;    // "Uroven1VelkaBudka"
    _buildingpart = _this select 3; // "ItemSodaSmashtEmpty"
    _name = _this select 4; // "Bandit Level 1 House"
    _case = _this select 5; // "house"
    _humanity = player getVariable["humanity",0];
    _playerUID = dayz_playerUID;
    
    // Need Near Requirements
    _abort = false;
    _reason = "";
    _canBuildOnPlot = false;
    _classnametmp = _classname;
    
    _requireplot = DZE_requireplot;
    _isAllowedUnderGround = 0;
    
    if (_classname in DZE_Origins_Stronghold) then {
        _offset = [0,30,0];
    } else {
        _offset = [0,10,0];
    };
    
    _isPole = (_classname == "Plastic_Pole_EP1_DZ");
    _isLandFireDZ = (_classname == "Land_Fire_DZ");
    
    _distance = DZE_PlotPole select 0;
    _needText = "ORIGINS: Plot Pole";
    
    if(_isPole) then {
        _distance = DZE_PlotPole select 1;
    };
    
    // check for near plot
    _findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
    _findNearestPole = [];
    
    {
        if (alive _x) then {
            _findNearestPole set [(count _findNearestPole),_x];
        };
    } count _findNearestPoles;
    
    _IsNearPlot = count (_findNearestPole);
    
    // If item is plot pole && another one exists within 45m
    if(_isPole && _IsNearPlot > 0) exitWith {  dayz_actionInProgress = false; cutText [ "ORIGINS: To close to another PlotPole!" , "PLAIN DOWN"]; };
    
    if(_IsNearPlot == 0) then {  // no plot pole close
        // Allow building of plot
        if(_requireplot == 0 || _isLandFireDZ) then {
            _canBuildOnPlot = true;
        };
    } else { // there is a plot pole close
        // check nearby plots ownership && then for friend status
        _nearestPole = _findNearestPole select 0;
    
        // Find owner   
        _hasAccess     = false;
        _hasAccess     = [player, _nearestPole] call FNC_check_access;
        _allowed     = ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3) or (_hasAccess select 4));
        _can_build_stronghold = ((_hasAccess select 0) or (_hasAccess select 2));
        can_build_stronghold = _can_build_stronghold;
        // 0= owner + 2= plot owner + 3= plot friends + 4=plot admins 
        if(_allowed) then {  //Keep ownership
            // owner can build anything within his plot except other plots
            _canBuildOnPlot = true; // 0= owner + 2= plot owner + 3= plot friends + 4=plot admins -> can build
        };
        if(_isPole) then { // not if it is a plot
            _canBuildOnPlot = false;
        };
    };
    
    if (_canBuildOnPlot) then{
    /*
        _findNearestKINGs = nearestObjects [(vehicle player), ["kingramida"], _distance];
        _findNearestKING = [];
        {
            if (alive _x) then {
                _findNearestKING set [(count _findNearestKING),_x];
            };
        } count _findNearestKINGs;
        _hasKING = count (_findNearestKING);
       
        _findNearestLGs = nearestObjects [(vehicle player), ["velkaGaraz"], _distance];
        _findNearestLG = [];
        {
            if (alive _x) then {
                _findNearestB2 set [(count _findNearestB2),_x];
            };
        } count _findNearestB2s;
        _findNearestSGs = nearestObjects [(vehicle player), ["malaGaraz"], _distance];
        _findNearestSG = [];
        {
            if (alive _x) then {
                _findNearestB2 set [(count _findNearestB2),_x];
            };
        } count _findNearestB2s;
    
    */
        // check level 1 house nearby
        _findNearestB1s = nearestObjects [(vehicle player), ["Uroven1DrevenaBudka","Uroven1VelkaBudka"], _distance];
        _findNearestB1 = [];
        {
            if (alive _x) then {
                _findNearestB1 set [(count _findNearestB1),_x];
            };
        } count _findNearestB1s;
        _hasLevel1x = count (_findNearestB1);
        if(_hasLevel1x > 0)then{
        _hasLevel1 = true;
        }else{
        _hasLevel1 = false;
        };
        // check level 2 house nearby
        _findNearestB2s = nearestObjects [(vehicle player), ["Uroven2KladaDomek","Uroven2MalyDomek"], _distance];
        _findNearestB2 = [];
        {
            if (alive _x) then {
                _findNearestB2 set [(count _findNearestB2),_x];
            };
        } count _findNearestB2s;
        _hasLevel2x = count (_findNearestB2);
        if(_hasLevel2x > 0)then{_hasLevel2 = true;
        }else{
        _hasSH = false;
        };
        // check level 3 house nearby
        _findNearestB3s = nearestObjects [(vehicle player), ["Uroven3DrevenyDomek","Uroven3VelkyDomek"], _distance];
        _findNearestB3 = [];
        {
            if (alive _x) then {
                _findNearestB3 set [(count _findNearestB3),_x];
            };
        } count _findNearestB3s;
        _hasLevel3x = count (_findNearestB3);
        if(_hasLevel3x > 0)then{
        _hasLevel3 = true;
        }else{
        _hasLevel3 = false;
        };
       
        _findNearestSHs = nearestObjects [(vehicle player), ["krepost"], _distance];
        _findNearestSH = [];
        {
            if (alive _x) then {
                _findNearestSH set [(count _findNearestSH),_x];
            };
        } count _findNearestSHs;
       
        _hasSHx = count (_findNearestSH);
        if(_hasSHx > 0)then{
        _hasSH = true;
        }else{
        _hasSH = false;
        };
       
    } else {
    //default to old orgins method (dosnt work but sets variables up)
        _hasLevel1 = (_playerUID in owner_H1 || _playerUID in owner_B1);
        _hasLevel2 = (_playerUID in owner_H2 || _playerUID in owner_B2);
        _hasLevel3 = (_playerUID in owner_H3 || _playerUID in owner_B3);
        _hasSG = (_playerUID in owner_SG);
        _hasLG = (_playerUID in owner_LG);
        _hasKING = (_playerUID in owner_KING);
        _hasSH = (_playerUID in owner_SH);
    };
    
    _canBuild = false;
    _hasone = false;
    
    switch (_case) do {       
        case "house": {
            if ((_humanityNeed > 0 && _humanity >= _humanityNeed) || (_humanityNeed < 0 && _humanity <= _humanityNeed)) then {
                if (_houselevel in ["H1","B1"] ) then { _canBuild = true; };
                if (_houselevel in ["H2","B2"] ) then { _canBuild = true; };
                if (_houselevel in ["H3","B3"] ) then { _canBuild = true; };
            } else {
                cutText [format["You do not have %1 humanity for this house!",_humanityNeed], "PLAIN DOWN"];
            };
        };
        case "garage": {
            if (_houselevel in ["SGH","SGB"]) then {
                if (_hasLevel1 && !_hasSG) then {
                    _canBuild = true;
                } else {
                    cutText [format["%1 you need level 1 house before you can build %2 or you already own %2",name player,_name], "PLAIN DOWN"];
                };
            };
            if (_houselevel in ["LGH","LGB"]) then {
                if (_hasLevel3 && !_hasLG) then {
                    _canBuild = true;
                } else {
                    cutText [format["%1 you need level 3 house before you can build %2 or you already own %2",name player,_name], "PLAIN DOWN"];
                };
            };
            if (_houselevel in ["KINGH","KINGB"]) then {
                if !("ItemEmerald" in magazines player) exitWith { cutText [format["%1 you need one Emerald for %2. Sector B urals might have one!",name player,_name], "PLAIN DOWN"]; };
                if (_hasLevel3 && !_hasKING) then {
                    _canBuild = true;
                } else {
                    cutText [format["%1 you need level 3 house before you can build %2 or you already own %2",name player,_name], "PLAIN DOWN"];
                };
            };
            if (_houselevel in ["SHH","SHB"] && !_hasSH) then {
                if (!_can_build_stronghold) exitWith {cutText["Only the plot owner can build a Stronghold!"];};
                if (_hasLevel3 && !_hasSH) then {
                    _canBuild = true;
                } else {
                    cutText [format["%1 you need a level 3 house before you can build %2 or you already own %2",name player,_name], "PLAIN DOWN"];
                };
            };
        };
    };
    
    //if (_hasone) then { cutText [format["%1 you already have %2! You can only own one!",name player,_name], "PLAIN DOWN"]; };
    if (_canBuild) then { [_houselevel,_classname,_name,_buildingpart] execVM "origins\player_build.sqf"; };
    
    
     
  4. FallingSheep

    FallingSheep OpenDayZ Lord!

    Joined:
    Mar 17, 2013
    Messages:
    1,980
    Likes Received:
    576
  5. FallingSheep

    FallingSheep OpenDayZ Lord!

    Joined:
    Mar 17, 2013
    Messages:
    1,980
    Likes Received:
    576
    fn_selfActions.sqf
    http://textuploader.com/d4f4k!

    this is the orginis building code for fn_selfActions

    place just under
    Code:
    if (DZE_NameTags > 0) then {
        if (s_player_showname < 0 && !_isPZombie) then {
            if (DZE_NameTags < 2) then {
                s_player_showname = 1;
                player setVariable["DZE_display_name",true,true];
            } else {
                s_player_showname = player addAction [localize "STR_EPOCH_ACTIONS_NAMEYES", "\z\addons\dayz_code\actions\display_name.sqf",true, 0, true, false];
                s_player_showname1 = player addAction [localize "STR_EPOCH_ACTIONS_NAMENO", "\z\addons\dayz_code\actions\display_name.sqf",false, 0, true, false];
            };
        };
    };
    
     
  6. FallingSheep

    FallingSheep OpenDayZ Lord!

    Joined:
    Mar 17, 2013
    Messages:
    1,980
    Likes Received:
    576
    origins\config.sqf
    Code:
    //****************************************************************************
    //************** DayZ Origins Buildings Config made by Rotzloch **************
    //****************************************************************************
    DZE_Origins_Building_System = true;
    DZE_Use_PlotPole4Life = false;
    DZE_Origins_LockUnlock_Distance = 20;
    DZE_Origins_Build_Distance = 10;
    //In which Box/Container the Player must place their stuff for building the house
    DZE_Origins_Container = "WoodCrate_DZ";       
    DZE_Origins_Build_Tools_Require = ["ItemToolbox","ItemEtool","ItemSledge"];
    // Humanity Need for House Levels. Hero/Bandit1 == Small Garage AND Hero/Bandit3 == Large Garage && Stronghold
    DZE_Origins_Humanity = 
    [
        ["Hero1",5000],
        ["Hero2",12000],
        ["Hero3",25000],
        ["Bandit1",-5000],
        ["Bandit2",-12000],
        ["Bandit3",-25000]
    ];
    
    //What needed for Building Houses
    DZE_Origins_House1 = [
        ["PartGeneric",1]
    ];
    DZE_Origins_House2 = [
        ["PartGeneric",1]
    ];
    DZE_Origins_House3 = [
        ["PartGeneric",1]
    ];
    DZE_Origins_SG = [
        ["PartGeneric",1]
    ];
    DZE_Origins_LG = [
        ["PartGeneric",1]
    ];
    DZE_Origins_King = [
        ["PartGeneric",1]
    ];
    DZE_Origins_Stronghold = [
        ["PartGeneric",1]
    ];
    
    DZE_Origins_NameLookup = [
        ["Uroven1DrevenaBudka","Bandits - Wooden Shed (Level 1)"],
        ["Uroven2KladaDomek","Bandits - Log House (Level 2)"],
        ["Uroven3DrevenyDomek" ,"Bandits - Wooden House (Level 3)"],
        ["Uroven1VelkaBudka","Heroes - Large Shed (Level 1)"],
        ["Uroven2MalyDomek","Heroes - Small House (Level 2)"],
        ["Uroven3VelkyDomek" ,"Heroes - Big House (Level 3)"],
        ["kingramida","Pyramid"],
        ["velkaGaraz","Large Garage"],
        ["malaGaraz" ,"Small Garage"],
        ["krepost", "Stronghold"]
    ];
    
    DZE_Origins_Build_HousesGarages = [
        ["H1", ((DZE_Origins_Humanity select 0) select 1), "Heroes - Large Shed (Level 1)","Uroven1VelkaBudka",DZE_Origins_House1],
        ["H2", ((DZE_Origins_Humanity select 1) select 1), "Heroes - Small House (Level 2)","Uroven2MalyDomek",DZE_Origins_House2],
        ["H3", ((DZE_Origins_Humanity select 2) select 1), "Heroes - Big House (Level 3)","Uroven3VelkyDomek",DZE_Origins_House3],
        ["B1", ((DZE_Origins_Humanity select 3) select 1), "Bandits - Wooden Shed (Level 1)","Uroven1DrevenaBudka",DZE_Origins_House1],
        ["B2", ((DZE_Origins_Humanity select 4) select 1), "Bandits - Log House (Level 2)","Uroven2KladaDomek",DZE_Origins_House2],
        ["B3", ((DZE_Origins_Humanity select 5) select 1), "Bandits - Wooden House (Level 3)","Uroven3DrevenyDomek",DZE_Origins_House3],
        ["SGH", ((DZE_Origins_Humanity select 0) select 1), "Small Garage","malaGaraz",DZE_Origins_SG],
        ["SGB", ((DZE_Origins_Humanity select 3) select 1), "Small Garage","malaGaraz",DZE_Origins_SG],
        ["LGH", ((DZE_Origins_Humanity select 2) select 1), "Large Garage","velkaGaraz",DZE_Origins_LG],
        ["LGB", ((DZE_Origins_Humanity select 5) select 1), "Large Garage","velkaGaraz",DZE_Origins_LG],
        ["KINGH", ((DZE_Origins_Humanity select 2) select 1), "Pyramid","kingramida",DZE_Origins_King],
        ["KINGB", ((DZE_Origins_Humanity select 5) select 1), "Pyramid","kingramida",DZE_Origins_King],
        ["SHH", ((DZE_Origins_Humanity select 2) select 1), "Stronghold","krepost",DZE_Origins_Stronghold],
        ["SHB", ((DZE_Origins_Humanity select 5) select 1), "Stronghold","krepost",DZE_Origins_Stronghold]
    ];
    
    DZE_Origins_Houses = ["Uroven1DrevenaBudka","Uroven2KladaDomek","Uroven3DrevenyDomek","Uroven1VelkaBudka","Uroven2MalyDomek","Uroven3VelkyDomek"];
    DZE_Origins_Garages= ["malaGaraz","velkaGaraz","kingramida","Uroven3DrevenyDomek","Uroven3VelkyDomek"];
    DZE_Origins_Stronghold = ["krepost"];
    DZE_Origins_Buildings = DZE_Origins_Houses + DZE_Origins_Garages + DZE_Origins_Stronghold;
    
    //dayz_allowedObjects --> DayZ_SafeObjects
    DayZ_SafeObjects = DayZ_SafeObjects + DZE_Origins_Buildings;
    diag_log("Origins Base Building Config initialized!");
    
    basically just changes this
    Code:
    dayz_allowedObjects= dayz_allowedObjects+ DZE_Origins_Buildings;
    
    to this
    Code:
    DayZ_SafeObjects = DayZ_SafeObjects + DZE_Origins_Buildings;
    
     
  7. FallingSheep

    FallingSheep OpenDayZ Lord!

    Joined:
    Mar 17, 2013
    Messages:
    1,980
    Likes Received:
    576
    origins\compiles.sqf
    Code:
    if (!isDedicated) then {
        origins_checkNeededMaterial = compile preprocessFileLineNumbers "origins\origins_checkNeededMaterial.sqf";
        origins_removeActions = compile preprocessFileLineNumbers "origins\origins_removeActions.sqf";
    };
    
     
  8. FallingSheep

    FallingSheep OpenDayZ Lord!

    Joined:
    Mar 17, 2013
    Messages:
    1,980
    Likes Received:
    576
    origins\origins_checkNeededMaterial.sqf

    Code:
    private["_crate","_itemIn","_countIn","_content","_qty","_proceed","_missing","_missingQty","_neededMaterials"];
    _crate = _this select 0;
    _neededMaterials = _this select 1;
    _proceed = true;
    {
        _itemIn = _x select 0;
        _countIn = _x select 1;
        _content = getMagazineCargo _crate;
        _qty = 0;
        {
            if(_x == _itemIn) then {
                _qty = _qty + ((_content select 1) select _forEachIndex);
            };
        } forEach (_content select 0);
       
        if(_qty < _countIn) exitWith { 
            _missing = _itemIn; 
            _missingQty = (_countIn - _qty); 
            _proceed = false;
            cutText [format["Missing %1 more of %2!", _missingQty,_missing], "PLAIN DOWN",3];
         
        };
    } count _neededMaterials;
    _proceed
    
     
  9. FallingSheep

    FallingSheep OpenDayZ Lord!

    Joined:
    Mar 17, 2013
    Messages:
    1,980
    Likes Received:
    576
    origins\origins_removeActions.sqf
    Code:
    private["_type"];
    _type = _this select 0;
    if (_type == 0 || _type == 1) then {
        player removeAction s_player_build_origins_house;
        s_player_build_origins_house = -1;
        player removeAction s_player_build_origins_garage;
        s_player_build_origins_garage = -1;
        player removeAction s_player_build_origins_stronghold;
        s_player_build_origins_stronghold = -1;
    };
    if (_type == 0 || _type == 2) then {
        player removeAction s_player_origins_unlock;
        s_player_origins_unlock = -1;
    };
    if (_type == 0 || _type == 3) then {
        player removeAction s_player_origins_stronghold_doors;
        s_player_origins_stronghold_doors = -1;
    };
    //uiSleep 2;
    true
    
     
  10. FallingSheep

    FallingSheep OpenDayZ Lord!

    Joined:
    Mar 17, 2013
    Messages:
    1,980
    Likes Received:
    576
    add the below to your init.sqf just above progressLoadingScreen 0.2;
    Code:
    call compile preprocessFileLineNumbers "origins\compiles.sqf"; 
    call compile preprocessFileLineNumbers "origins\config.sqf";
    
    add these to the bottom of your variables.sqf (prop not needed anymore but add just incase)
    Code:
    //Origins Houses
    if(isNil "owner_H1") then {
        owner_H1 = [];
    };
    if(isNil "owner_H2") then {
        owner_H2 = [];
    };
    if(isNil "owner_H3") then {
        owner_H3 = [];
    };
    if(isNil "owner_B1") then {
        owner_B1 = [];
    };
    if(isNil "owner_B2") then {
        owner_B2 = [];
    };
    if(isNil "owner_B3") then {
        owner_B3 = [];
    };
    if(isNil "owner_SG") then {
        owner_SG = [];
    };
    if(isNil "owner_KING") then {
        owner_KING = [];
    };
    if(isNil "owner_SH") then {
        owner_SH = [];
    };
    if(isNil "owner_LG") then {
        owner_LG = [];
    };
    
     
  11. FallingSheep

    FallingSheep OpenDayZ Lord!

    Joined:
    Mar 17, 2013
    Messages:
    1,980
    Likes Received:
    576
    SERVER FILES

    origins\variables.sqf
    Code:
    publicVariable "owner_B1";
    publicVariable "owner_B2";
    publicVariable "owner_B3";
    publicVariable "owner_H1";
    publicVariable "owner_H2";
    publicVariable "owner_H3";
    publicVariable "owner_SG";
    publicVariable "owner_LG";
    publicVariable "owner_KING";
    publicVariable "owner_SH";
    diag_log (format["HOUSE SERVER: Owners Are: B1 %1 B2 %2 B3 %3 H1 %4 H2 %5 H3 %6 SG %7 LG %8 KING %9 SH %10", owner_B1, owner_B2, owner_B3, owner_H1, owner_H2, owner_H3, owner_SG, owner_LG, owner_KING,owner_SH]);
    "OriginsLockUnlock" addPublicVariableEventHandler 
    {
        originsObject = _this select 1 select 0;
        originsObjectType = _this select 1 select 1;
        originsState = _this select 1 select 2;
        originsPlayerUid = _this select 1 select 3;
        originsCombination = _this select 1 select 4;
        [originsObject,originsObjectType,originsState,originsPlayerUid,originsCombination] execVM "\z\addons\dayz_server\origins\server_LockUnlockOrigins.sqf";
    };
    
    server_LockUnlockOrigins.sqf
    Code:
    private["_originsBuilding","_typeOfOriginsBuilding","_action","_playerUID","_ownerUID","_state","_update","_weapons","_magazines","_backpacks","_objWpnTypes","_objWpnQty","_countr","_combinationEntry","_combinationStronghold"];
    _originsBuilding = _this select 0;
    _typeOfOriginsBuilding = _this select 1;
    _action = _this select 2;
    _playerUID = _this select 3;
    _ownerUID = _originsBuilding getVariable ["OwnerUID","0"];
    _charID = _originsBuilding getVariable ["CharacterID","0"];
    _pos = _originsBuilding getVariable ["OEMPos",getPosATL _originsBuilding];
    _dir = direction _originsBuilding;
    _vector = [vectorDir _originsBuilding, vectorUp _originsBuilding];
    _objectID = _originsBuilding getVariable ["ObjectID","0"];
    _objectUID = _originsBuilding getVariable ["ObjectUID","0"];
    _state = 0;
    _update = false;
    
    //_combinationEntry = _this select 4;
    //_combinationStronghold = _originsBuilding getVariable ["CharacterID","0"];
    
    //if(_playerUID != _ownerUID && !(_typeOfOriginsBuilding in DZE_Origins_Stronghold)) exitWith { diag_log("Origins: House is not yours");};
    //if(_typeOfOriginsBuilding in DZE_Origins_Stronghold && _combinationEntry != _combinationStronghold) exitWith{diag_log("Origins: Wrong Stronghold Code");};
    
    if(!_action) then {
        _state = 1;
        _update = true;
    };
    
    if(_typeOfOriginsBuilding in DZE_Origins_Garages) then {
        {
            _originsBuilding animate [_x,_state];
        } count ['dvereGarazLeve','vrataGaraz','dvereGarazPrave','dvereGarazLeveDva','dvereGarazPraveDva','vrataGarazLeve','vrataGarazPrave','vrataGaraz2','dvereJednaC'];
    };
     if(_typeOfOriginsBuilding in DZE_Origins_Houses) then {
        {
            _originsBuilding animate [_x,_state];
        } count ['vratka','dvereJednaA','vratkaDva','dvereJedna','dvere1'];
    };
    if(_typeOfOriginsBuilding in DZE_Origins_Stronghold) then {
        {
            _originsBuilding animate [_x,_state];
        } count ['vrata','hride1','kolo1','vaha','kolo2','svich'];
    };
    
    /*
    //save gear using the same method as safes 
            [_originsBuilding,"gear"] call server_updateObject;
            _weapons = getWeaponCargo _originsBuilding;
            _magazines = getMagazineCargo _originsBuilding;
            _backpacks = getBackpackCargo _originsBuilding;
            if (Z_singleCurrency) then {
                _coins = _originsBuilding getVariable [Z_MoneyVariable,0];
            } else {
                _coins = 0;
            }
            _holder = _originsBuilding createVehicle [0,0,0];
            _holder setDir _dir;
            _holder setVariable ["memDir",_dir,true];
            _holder setVectorDirAndUp _vector;
            _holder setPosATL _pos;
            _holder setVariable ["CharacterID",_charID,true];
            _holder setVariable ["ObjectID",_objectID,true];
            _holder setVariable ["ObjectUID",_objectUID,true];
            _holder setVariable ["OEMPos",_pos,true];
            if (DZE_permanentPlot) then {_holder setVariable ["ownerPUID",_ownerID,true];};
            if (Z_singleCurrency) then {_holder setVariable [Z_MoneyVariable,_coins,true];};
            deleteVehicle _originsBuilding;
           
            // Local setVariable gear onto new locked safe for easy access on next unlock
            // Do not send big arrays over network! Only server needs these
            _holder setVariable ["WeaponCargo",_weapons,false];
            _holder setVariable ["MagazineCargo",_magazines,false];
            _holder setVariable ["BackpackCargo",_backpacks,false];
    */   
    
    if(!_update) then {
        private["_inventory"];
        clearWeaponCargoGlobal  _originsBuilding;
        clearMagazineCargoGlobal  _originsBuilding;
        clearBackpackCargoGlobal _originsBuilding;
        _inventory = [
            getWeaponCargo _originsBuilding,
            getMagazineCargo _originsBuilding,
            getBackpackCargo _originsBuilding
        ];
        _originsBuilding setVariable["lastInventory",_inventory];
        } else {
            clearWeaponCargoGlobal  _originsBuilding;
            clearMagazineCargoGlobal  _originsBuilding;
            clearBackpackCargoGlobal _originsBuilding;
            _weapons =     _originsBuilding getVariable["WeaponCargo",[]];
            _magazines = _originsBuilding getVariable["MagazineCargo",[]];
            _backpacks = _originsBuilding getVariable["BackpackCargo",[]];
        if (count _weapons > 0) then {
            _objWpnTypes = _weapons select 0;
            _objWpnQty = _weapons select 1;
            _counter = 0;
            {
                _originsBuilding addWeaponCargoGlobal [_x,(_objWpnQty select _counter)];
                _counter = _counter + 1;
            } count _objWpnTypes;
        };
    
        if (count _magazines > 0) then {
            _objWpnTypes = _magazines select 0;
            _objWpnQty = _magazines select 1;
            _counter = 0;
            {
                if (_x != "CSGAS") then {
                    _originsBuilding addMagazineCargoGlobal [_x,(_objWpnQty select _counter)];
                    _counter = _counter + 1;
                };
            } count _objWpnTypes;
        };
    
        if (count _backpacks > 0) then {
            _objWpnTypes = _backpacks select 0;
            _objWpnQty = _backpacks select 1;
            _counter = 0;
            {
                _originsBuilding addBackpackCargoGlobal [_x,(_objWpnQty select _counter)];
                _counter = _counter + 1;
            } count _objWpnTypes;
        };
    };
    
    _originsBuilding setVariable ["CanBeUpdated",_update, true];
    
     
  12. FallingSheep

    FallingSheep OpenDayZ Lord!

    Joined:
    Mar 17, 2013
    Messages:
    1,980
    Likes Received:
    576
    that should be everything neede to get houses working

    there is no SQL changes needed

    im currently messing with server_LockUnlockOrigins.sqf for gear saving using the below code

    but it wont let you lock house after unlocking...gear save tho :)
    Code:
    /*
    //save gear using the same method as safes
            [_originsBuilding,"gear"] call server_updateObject;
            _weapons = getWeaponCargo _originsBuilding;
            _magazines = getMagazineCargo _originsBuilding;
            _backpacks = getBackpackCargo _originsBuilding;
            if (Z_singleCurrency) then {
                _coins = _originsBuilding getVariable [Z_MoneyVariable,0];
            } else {
                _coins = 0;
            }
            _holder = _originsBuilding createVehicle [0,0,0];
            _holder setDir _dir;
            _holder setVariable ["memDir",_dir,true];
            _holder setVectorDirAndUp _vector;
            _holder setPosATL _pos;
            _holder setVariable ["CharacterID",_charID,true];
            _holder setVariable ["ObjectID",_objectID,true];
            _holder setVariable ["ObjectUID",_objectUID,true];
            _holder setVariable ["OEMPos",_pos,true];
            if (DZE_permanentPlot) then {_holder setVariable ["ownerPUID",_ownerID,true];};
            if (Z_singleCurrency) then {_holder setVariable [Z_MoneyVariable,_coins,true];};
            deleteVehicle _originsBuilding;
           
            // Local setVariable gear onto new locked safe for easy access on next unlock
            // Do not send big arrays over network! Only server needs these
            _holder setVariable ["WeaponCargo",_weapons,false];
            _holder setVariable ["MagazineCargo",_magazines,false];
            _holder setVariable ["BackpackCargo",_backpacks,false];
    */   
    
     

Share This Page