Overpochins base building

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

  1. FallingSheep

    FallingSheep OpenDayZ Lord!

    Joined:
    Mar 17, 2013
    Messages:
    1,990
    Likes Received:
    581
    im looking at the same issue for another guy, seems he has same issue since update, ill post anything i find here
     
    TBs Thug likes this.
  2. l1nkrx7

    l1nkrx7 New Member

    Joined:
    May 10, 2018
    Messages:
    7
    Likes Received:
    2
    i have this working on 1062 if anyone still interested.

    only thing not working yet is gear saving but i am working on it
     
  3. TBs Thug

    TBs Thug Member

    Joined:
    Apr 14, 2014
    Messages:
    34
    Likes Received:
    2
    I would love to get my working. I dont care about the storage because you can set at less 6 safe in each houses which is more then the org 500 storage
     
  4. l1nkrx7

    l1nkrx7 New Member

    Joined:
    May 10, 2018
    Messages:
    7
    Likes Received:
    2
    fn_selfActions.sqf

    Code:
    if(DZE_Origins_Building_System) then {
        if(isnil "s_player_build_origins_house") then {s_player_build_origins_house = -1;};
        if(isnil "s_player_build_origins_garage") then {s_player_build_origins_garage = -1;};
        if(isnil "s_player_build_origins_stronghold") then {s_player_build_origins_stronghold = -1;};
        if(isnil "s_player_origins_unlock") then {s_player_origins_unlock = -1;};
        if(isnil "s_player_origins_stronghold_doors") then {s_player_origins_stronghold_doors = -1;};
        _cursorTarget = cursorTarget;
        if (!isNull _cursorTarget) then {
            _typeOfCursorTarget = (typeOf _cursorTarget);
            if(_typeOfCursorTarget == DZE_Origins_Container ) then {
                if((player distance _cursorTarget) < DZE_Origins_Build_Distance) then {
                    private["_humanity","_playerUID","_hasLevel1","_hasLevel2","_hasLevel3","_hasSG","_hasLG","_hasKING","_hasSH","_canBuildHouse","_houselevel","_humanityNeed","_actionText","_classname","_neededMaterials","_canBuildSH","_canBuildGarage"];
                    _humanity = player getVariable["humanity",0];
                    _playerUID = dayz_playerUID;
                    _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);
    
                    {
                        _houselevel = _x select 0;
                        _humanityNeed = _x select 1;
                        _actionText = _x select 2;
                        _classname = _x select 3;
                        _neededMaterials = _x select 4;
                        _canBuildHouse = false;
                        _canBuildGarage = false;
                        _canBuildSH = false;
    
                        if((_humanityNeed > 0 && _humanity >= _humanityNeed) || (_humanityNeed < 0 && _humanity <= _humanityNeed)) then {
                            if(_houselevel in ["H1","B1"] && !_hasLevel1) then {
                                _canBuildHouse = true;
                            };
                            if(_houselevel in ["H2","B2"] && !_hasLevel2) then {
                                _canBuildHouse = true;
                            };
                            if(_houselevel in ["H3","B3"] && !_hasLevel3) then {
                                _canBuildHouse = true;
                            };
                            if(_houselevel in ["SGH","SGB"] && _hasLevel1 && !_hasSG) then {
                                _canBuildGarage = true;
                            };
                            if(_houselevel in ["LGH","LGB"] && _hasLevel3 && !_hasLG) then {
                                _canBuildGarage = true;
                            };
                            if(_houselevel in ["KINGH","KINGB"] && _hasLevel3 && _hasLG && !_hasKING) then {
                                _canBuildGarage = true;
                            };
                            if(_houselevel in ["SHH","SHB"] && _hasLevel1 && _hasLevel2 && _hasLevel3 && !_hasSH) then {
                                _canBuildSH = true;
                            };
                        };
    
                        if(_canBuildHouse) then {
                            if(s_player_build_origins_house < 0) then {
                                s_player_build_origins_house = player addAction ["Build " + _actionText, "origins\player_build.sqf", [_cursorTarget, _houselevel, _classname, _neededMaterials, _actionText]];
                            };
                        };
                        if(_canBuildGarage) then {
                            if(s_player_build_origins_garage < 0) then {
                                s_player_build_origins_garage = player addAction ["Build " + _actionText, "origins\player_build.sqf", [_cursorTarget, _houselevel, _classname, _neededMaterials, _actionText]];
                            };
                        };
                        if(_canBuildSH) then {
                            if(s_player_build_origins_stronghold < 0) then {
                                s_player_build_origins_stronghold = player addAction ["Build " + _actionText, "origins\player_build.sqf", [_cursorTarget, _houselevel, _classname, _neededMaterials, _actionText]];
                            };
                        };
    
                    } forEach DZE_Origins_Build_HousesGarages;
                } else {
                    [1] call origins_removeActions;
                };
            };
    
            if(_typeOfCursorTarget in DZE_Origins_Buildings && (player distance _cursorTarget) < DZE_Origins_LockUnlock_Distance) then {
                private["_ownerUID","_ownerName","_playerUID","_state","_openClose"];
                _playerUID = dayz_playerUID;
                _ownerUID = _cursorTarget getVariable ["OwnerUID","0"];
                _ownerName = _cursorTarget getVariable ["OwnerName","0"];
                _ownerID = 0;
                _friendlies = [];
                _canOPEN = false;
                _plotcheck = [player, false] call FNC_find_plots;
                _distance = DZE_PlotPole select 0;
    
                _IsNearPlot = _plotcheck select 1;
                _nearestPole = _plotcheck select 2;
    
                if (_IsNearPlot == 0) then {
                    _canOPEN = false;
                } else {
                    _ownerID = _nearestPole getVariable["CharacterID","0"];
                    if (dayz_characterID == _ownerID) then {
                        _canOPEN = true;
                    } else {
                        if (DZE_permanentPlot) then {
                            _buildcheck = [player, _nearestPole] call FNC_check_access;
                            _isowner = _buildcheck select 0;
                            _isfriendly = ((_buildcheck select 1) or (_buildcheck select 3));
                            if (_isowner || _isfriendly) then {
                                _canOPEN = true;
                            } else {
                                _canOPEN = false;
                            };
                        } else {
                            _friendlies    = player getVariable ["friendlyTo",[]];
                            if (_ownerID in _friendlies) then {
                                _canOPEN = true;
                            } else {
                                _canOPEN = false;
                            };
                        };
                    };
                };
                if (!(_canOPEN)&& !(_typeOfCursorTarget in DZE_Origins_Stronghold)) exitWith {
                    //cutText [format["You dont have permission to access this building!"], "PLAIN DOWN",5];
                    cutText [format["This house was built by %1", _ownerName], "PLAIN DOWN",5];
                };
    
    
    
    
                _state = (_cursorTarget getVariable ["CanBeUpdated",false]);
                if(_typeOfCursorTarget in DZE_Origins_Stronghold && _state) then {
                    private["_strongholdDoorsOpen"];
                    _strongholdDoorsOpen = (_cursorTarget getVariable ["DoorsOpen",false]);
                    if(_strongholdDoorsOpen) then {
                        if(s_player_origins_stronghold_doors < 0) then {
                            s_player_origins_stronghold_doors = player addAction [ "Close Doors","origins\origins_strongholdDoors.sqf",[_cursorTarget,0]];
                        };
                    } else {
                        if(s_player_origins_stronghold_doors < 0)then {
                            s_player_origins_stronghold_doors = player addAction [ "Open Doors","origins\origins_strongholdDoors.sqf",[_cursorTarget,1]];
                        };
                    };
                } else {
                    [3] call origins_removeActions;
                };
    
                if(s_player_origins_unlock < 0) then {
                    _matched = false;
                    {
                        if(_typeOfCursorTarget == (_x select 0)) then {
                            if(_state) then {
                                _openClose = format["Lock %1", _X select 1];
                            } else {
                                _openClose = format["Unlock %1", _X select 1];
                            };
                            _matched = true;
                        };
                        if (_matched) exitWith {
                            s_player_origins_unlock = player addAction [_openClose, "origins\player_lockUnlock.sqf", [_cursorTarget,_typeOfCursorTarget,_state]];
                        };
                    } count DZE_Origins_NameLookup;
                };
            } else {
                [2] call origins_removeActions;
            };
        } else {
            [0] call origins_removeActions;
        };
    };
    player_build.sqf
    https://pastebin.com/HDF1WDeZ

    these changes should allow you to build and open close origin houses
     
  5. TBs Thug

    TBs Thug Member

    Joined:
    Apr 14, 2014
    Messages:
    34
    Likes Received:
    2
    Thank you. Couple questions, where in the fn_selfActions.sqf did you put the fn_selfActions part?
    Is this all that you used to get it to work or did you use some of what Fallingsheep posted? Just want to make sure we are on the same page.
     
  6. TBs Thug

    TBs Thug Member

    Joined:
    Apr 14, 2014
    Messages:
    34
    Likes Received:
    2
    See above post
     
  7. l1nkrx7

    l1nkrx7 New Member

    Joined:
    May 10, 2018
    Messages:
    7
    Likes Received:
    2
    i just used what he had but changed these files just put it where he said to put it
     
    TBs Thug likes this.
  8. l1nkrx7

    l1nkrx7 New Member

    Joined:
    May 10, 2018
    Messages:
    7
    Likes Received:
    2
    if it doesnt work ill link to a zip file
     
    TBs Thug likes this.
  9. TBs Thug

    TBs Thug Member

    Joined:
    Apr 14, 2014
    Messages:
    34
    Likes Received:
    2
  10. TBs Thug

    TBs Thug Member

    Joined:
    Apr 14, 2014
    Messages:
    34
    Likes Received:
    2
    What are you using to build the houses?
     
  11. l1nkrx7

    l1nkrx7 New Member

    Joined:
    May 10, 2018
    Messages:
    7
    Likes Received:
    2
    wooden crate but can be anything
     
  12. l1nkrx7

    l1nkrx7 New Member

    Joined:
    May 10, 2018
    Messages:
    7
    Likes Received:
    2
    you would have it set in origins\config.sqf

    DZE_Origins_Container = "WoodCrate_DZ";
     
  13. TBs Thug

    TBs Thug Member

    Joined:
    Apr 14, 2014
    Messages:
    34
    Likes Received:
    2
    If its not a problem, can you send me a zip file you offered? I can get the level 1 to stay, but when I set the next box it only gives me the option to build a level 1 and it will let me. Made a video, just click the link.
     
    Last edited: May 18, 2018
  14. l1nkrx7

    l1nkrx7 New Member

    Joined:
    May 10, 2018
    Messages:
    7
    Likes Received:
    2
    i messaged you i am able to build all way up to stronghold each build you get new house to build
     
  15. TBs Thug

    TBs Thug Member

    Joined:
    Apr 14, 2014
    Messages:
    34
    Likes Received:
    2
    [SOLVED]
    Just to let everyone know, I was able to get the houses to stay after restart. Thank you l1nkrx7 could have not done it without you.
     
    FallingSheep likes this.

Share This Page