Jump to content

[1.4.1] Snap Building PRO


Recommended Posts

Still not getting the Snap: ON option i think it is becuase snap_build is in the worng place in my compiles?  I have it placed under //Actions  at the very bottem like

 

player_antiWall =        compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_antiWall.sqf";
player_deathBoard =  compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\list_playerDeathsAlt.sqf";
snap_build =               compile preprocessFileLineNumbers "scripts\snap_pro\snap_build.sqf";
 
EDIT
I fixed it don't worry i just went slowly through and redid my custom compiles
Link to comment
Share on other sites

  • 3 weeks later...

Hoping someone can help with this one, I've been battling it for days.

 

I have SBP installed as part of the Plot For Life latest version. I also have Build Vectors and Precise Base Building (as recommended by Build Vectors).

 

Everything sort of seems to be working normally, except, when you press F to snap an item, it flips around and no longer lines up properly. In some cases, even if you get it facing the right way, and the ghost image lines up, as soon as you hit SPACE to build, it goes out of line. I've done a little video below to show what I mean...

 

 

http://www.twitch.tv/kroenentv/b/608667844

Link to comment
Share on other sites

Can you remove precise building and test again? By default SBP works by simply moving 2 green points together, it is as simple as that... nothing complex, which means there's a chance something else is messing with it.

Link to comment
Share on other sites

  • 3 weeks later...

Hi , First i would like to say thanks you for that script , really helpful and i recommand it to everyone , but something do not work with the description because i did everything ... Well the first time i connected to my server after installed it , i was able to use the menu but never worked anymore ... key still usable but the menu do not pop..

I really want it so i would like some help to understand what is not working

 

 

 

its ok i made it work ,

Link to comment
Share on other sites

  • 1 month later...

First, Thank you vm for you work! really appreciate everything you do for the community :)

 

I have a bug with the snap pro version I used on my private server, (part of P4L install on your Git). When we snap a few metal floors together or cinder walls they do not keep their alignment after the server restart. You can see they all moved a few inches and have gaps between them. Anybody knows what can be the cause of this?

Link to comment
Share on other sites

  • 2 weeks later...

ok, I've wipe out the old server, wipe out the database. started fresh with a basic new server install and I still have the same annoying bug. Items do not keep their snap after restart, they all move just a tad. I don't have any errors in RPT. 

 

I also tried with plot management installed and I was getting the same bug. 

 

Is this a known bug or I'm missing something here?

 

Edit: Fixed with this 

Link to comment
Share on other sites

  • 4 weeks later...

You gotta understand that objects have different scale/size. This script simply aligns 2 points together, there's no advanced calculation or any other magic happening here. Author of these 3D models simply told us that dayz epoch was not meant to have snap building and there will never be a fix, so there's that.

Link to comment
Share on other sites

I was mainly talking about the walls how they dont snap to the exact corners, when i watched your video it looked like yours were aligned to the corners better unless u moved them manually ? I dont know

Not really, it's been always like this, it just depends how you snap it. On your screenshots you are snapping walls together, in video my chaps were snapping walls on floor points instead, which gave illusion of perfect corners.

There was a post many pages ago (one of first pages i think) showing your issue and how to solve it (large post, some screenshots and blueprints). There's also video on first page showing how to adjust snap points if this bugs you and you are feeling like changing it.

Link to comment
Share on other sites

Post #264 yeh i have seen that but no actual code has been posted to fix it?

it's not the code you want, it's the config file.

https://github.com/raymix/SnapPro/blob/master/custom/snap_pro/snappoints.hpp#L243

 

You want lines  #246 and #247. Values are in meters... basically current points are created 2m and 75cm from center of the wall to left and right (along X axis that is). Don't freak out when you see one-liners, it just means most objects are inheriting settings from other classes - less lines, faster load times thingy...

Array format is [x,y,z]:

negative X = left

positive X = right

negative y = down

positive y = up

negative Z = backwards (towards camera)

positive Z = forward (away from camera).

 

All these values depend on where author of this model has set pivot point ([0,0,0]). For epoch buildings pivot is usually in bottom centre of the object.

 

If you feel like this is an issue, refer back to post #264 and I guess you can go 2 ways - work it out using math or simply trial and error by adjusting values and seeing where it goes. Ofc you can also add extra points by just creating new array besides or add snap points to literary any object in the game (video tutorial post #2) by using classnames.

Link to comment
Share on other sites

Hi everyone,

 

i've got a problem with snap pro. When I'm snapping a wall to another wall i works perfect but if i spin the wall with either q or e the wall gets crooked. I think there should be an angle of 45 degrees but sometimes it is more or less then it. At least any wall is after I've pressed e or q two times not rectangular.  I've got not errors in any files. Anyone has the same problem? I hope there is a solution for this.

 

Best regards,

 

GudrunGisela

Link to comment
Share on other sites

Sounds like you are using modified version of this script. When it comes to arma, you get errors when something does not work at all. When something works, but produces wrong variables, that's problem with script's logic.

There is solution to everything, but you'll have to be more specific than "no errors in any files". Please specify what files, scripts and modifications you have related to this issue. What script you installed when this happened (if you are new to this, always install 1 script at a time!).

SBP rotations are hardcoded in player_build.sqf, so that's where you start.

Link to comment
Share on other sites

hi raymix,

 

first of all thanks for your attention. I have installed snap build pro/ build vectors and precise base building all in one. I have installed precise base building as last. The crooked walls i had already before installing this. So either my fault is located in the installation of snap pro or building vectors.

 

By the way this is my player_build.sqf:

 

/*
    DayZ Base Building
    Made for DayZ Epoch please ask permission to use/edit/distrubute email [email protected].
*/
private ["_helperColor","_objectHelper","_objectHelperDir","_objectHelperPos","_canDo", "_pos", "_cnt",
"_location","_dir","_classname","_item","_hasrequireditem","_missing","_hastoolweapon","_cancel","_reason","_started","_finished","_animState","_isMedic","_dis","_sfx","_hasbuilditem","_tmpbuilt","_onLadder","_isWater","_require","_text","_offset","_IsNearPlot","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_canBuildOnPlot","_friendlies","_nearestPole","_ownerID","_findNearestPoles","_findNearestPole","_distance","_classnametmp","_ghost","_isPole","_needText","_lockable","_zheightchanged","_rotate","_combination_1","_combination_2","_combination_3","_combination_4","_combination","_combination_1_Display","_combinationDisplay","_zheightdirection","_abort","_isNear","_need","_needNear","_vehicle","_inVehicle","_requireplot","_objHDiff","_isLandFireDZ","_isTankTrap"];

if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_40") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;

//snap vars -- temporary fix for errors so variables.sqf can be skipped
if (isNil "snapProVariables") then {
    if (isNil "DZE_snapExtraRange") then {
        DZE_snapExtraRange = 0;
    };
    if (isNil "DZE_checkNearbyRadius") then {
        DZE_checkNearbyRadius = 30;
    };
    s_player_toggleSnap = -1;
    s_player_toggleSnapSelect = -1;
    s_player_toggleSnapSelectPoint=[];
    snapActions = -1;
    snapGizmos = [];
    snapGizmosNearby = [];
    snapProVariables = true; // will skip this statement from now on.
};
// snap vars

// disallow building if too many objects are found within (30m by default) add DZE_checkNearbyRadius = 30; to your init.sqf to change
_pos = [player] call FNC_GetPos;
_cnt = count (_pos nearObjects ["All",DZE_PlotPole select 0]);
 if (_cnt >= DZE_BuildingLimit) exitWith { //end script if too many objects nearby
     DZE_ActionInProgress = false;
     cutText [(localize "str_epoch_player_41"), "PLAIN DOWN"];
 };

_onLadder =        (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_isWater =         dayz_isSwimming;
_cancel = false;
_reason = "";
_canBuildOnPlot = false;

_vehicle = vehicle player;
_inVehicle = (_vehicle != player);

helperDetach = false;
_canDo = (!r_drag_sqf and !r_player_unconscious);

_vector = [];
fnc_SetPitchBankYaw = {
    private ["_object","_rotations","_aroundX","_aroundY","_aroundZ","_dirX","_dirY","_dirZ","_upX","_upY","_upZ","_dir","_up","_dirXTemp",
    "_upXTemp"];
    _object = _this select 0;
    _rotations = _this select 1;
    _aroundX = _rotations select 0;
    _aroundY = _rotations select 1;
    _aroundZ = (360 - (_rotations select 2)) - 360;
    _dirX = 0;
    _dirY = 1;
    _dirZ = 0;
    _upX = 0;
    _upY = 0;
    _upZ = 1;
    if (_aroundX != 0) then {
        _dirY = cos _aroundX;
        _dirZ = sin _aroundX;
        _upY = -sin _aroundX;
        _upZ = cos _aroundX;
    };
    if (_aroundY != 0) then {
        _dirX = _dirZ * sin _aroundY;
        _dirZ = _dirZ * cos _aroundY;
        _upX = _upZ * sin _aroundY;
        _upZ = _upZ * cos _aroundY;
    };
    if (_aroundZ != 0) then {
        _dirXTemp = _dirX;
        _dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ);
        _dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ);        
        _upXTemp = _upX;
        _upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ);
        _upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ);         
    };
    _dir = [_dirX,_dirY,_dirZ];
    _up = [_upX,_upY,_upZ];
    _object setVectorDirAndUp [_dir,_up];
    DZE_BuildVector = [_dir,_up];
};

DZE_Q = false;
DZE_Z = false;

DZE_Q_alt = false;
DZE_Z_alt = false;

DZE_Q_ctrl = false;
DZE_Z_ctrl = false;

DZE_5 = false;
DZE_4 = false;
DZE_6 = false;
DZE_F = false;

DZE_cancelBuilding = false;

call gear_ui_init;
closeDialog 1;

if (_isWater) exitWith {DZE_ActionInProgress = false; cutText [localize "str_player_26", "PLAIN DOWN"];};
if (_inVehicle) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_42"), "PLAIN DOWN"];};
if (_onLadder) exitWith {DZE_ActionInProgress = false; cutText [localize "str_player_21", "PLAIN DOWN"];};
if (player getVariable["combattimeout", 0] >= time) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_43"), "PLAIN DOWN"];};

_item =    _this;

// Need Near Requirements
_abort = false;
_reason = "";

_needNear =     getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "neednearby");

{
    switch(_x) do{
        case "fire":
        {
            _distance = 3;
            _isNear = {inflamed _x} count (_pos nearObjects _distance);
            if(_isNear == 0) then {
                _abort = true;
                _reason = "fire";
            };
        };
        case "workshop":
        {
            _distance = 3;
            _isNear = count (nearestObjects [_pos, ["Wooden_shed_DZ","WoodShack_DZ","WorkBench_DZ"], _distance]);
            if(_isNear == 0) then {
                _abort = true;
                _reason = "workshop";
            };
        };
        case "fueltank":
        {
            _distance = 30;
            _isNear = count (nearestObjects [_pos, dayz_fuelsources, _distance]);
            if(_isNear == 0) then {
                _abort = true;
                _reason = "fuel tank";
            };
        };
    };
} forEach _needNear;


if(_abort) exitWith {
    cutText [format[(localize "str_epoch_player_135"),_reason,_distance], "PLAIN DOWN"];
    DZE_ActionInProgress = false;
};

_classname =     getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "create");
_classnametmp = _classname;
_require =  getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> "Build" >> "require");
_text =         getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");

_lockable = 0;
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "lockable")) then {
    _lockable = getNumber(configFile >> "CfgVehicles" >> _classname >> "lockable");
};

_requireplot = DZE_requireplot;
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "requireplot")) then {
    _requireplot = getNumber(configFile >> "CfgVehicles" >> _classname >> "requireplot");
};

_isAllowedUnderGround = 1;
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "nounderground")) then {
    _isAllowedUnderGround = getNumber(configFile >> "CfgVehicles" >> _classname >> "nounderground");
};

_offset =     getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
if((count _offset) <= 0) then {
    _offset = [0,1.5,0];
};

_isPole = (_classname == "Plastic_Pole_EP1_DZ");
_isLandFireDZ = (_classname == "Land_Fire_DZ");

_distance = DZE_PlotPole select 0;
_needText = localize "str_epoch_player_246";

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 {  DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_44") , "PLAIN DOWN"]; };

if(_IsNearPlot == 0) then {

    // Allow building of plot
    if(_requireplot == 0 || _isLandFireDZ) then {
        _canBuildOnPlot = true;
    };

} else {
    // Since there are plots nearby we check for ownership && then for friend status

    // check nearby plots ownership && then for friend status
    _nearestPole = _findNearestPole select 0;

    // Find owner
    _ownerID = _nearestPole getVariable ["CharacterID","0"];

    // diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];

    // check if friendly to owner
    if(dayz_characterID == _ownerID) then {  //Keep ownership
        // owner can build anything within his plot except other plots
        if(!_isPole) then {
            _canBuildOnPlot = true;
        };

    } else {
        // disallow building plot
        if(!_isPole) then {
            _friendlies = _nearestPole getVariable ["plotfriends",[]];
            _fuid  = [];
            {
            _friendUID = _x select 0;
            _fuid  =  _fuid  + [_friendUID];
            } forEach _friendlies;
            _builder  = getPlayerUID player;
            // check if friendly to owner
            if(_builder in _fuid) then {
            _canBuildOnPlot = true;
            };
        };
    };
};

// _message
if(!_canBuildOnPlot) exitWith {  DZE_ActionInProgress = false; cutText [format[(localize "STR_EPOCH_PLAYER_135"),_needText,_distance] , "PLAIN DOWN"]; };

_missing = "";
_hasrequireditem = true;
{
    _hastoolweapon = _x in weapons player;
    if(!_hastoolweapon) exitWith { _hasrequireditem = false; _missing = getText (configFile >> "cfgWeapons" >> _x >> "displayName"); };
} count _require;

_hasbuilditem = _this in magazines player;
if (!_hasbuilditem) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_player_31"),_text,"build"] , "PLAIN DOWN"]; };

if (!_hasrequireditem) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_epoch_player_137"),_missing] , "PLAIN DOWN"]; };
if (_hasrequireditem) then {

    _location = [0,0,0];
    _isOk = true;

    // get inital players position
    _location1 = [player] call FNC_GetPos;
    _dir = getDir player;

    // if ghost preview available use that instead
    if (_ghost != "") then {
        _classname = _ghost;
    };

    _object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
    //Build gizmo
    _objectHelper = "Sign_sphere10cm_EP1" createVehicle _location;
    _helperColor = "#(argb,8,8,3)color(0,0,0,0,ca)";
    _objectHelper setobjecttexture [0,_helperColor];
    _objectHelper attachTo [player,_offset];
    _object attachTo [_objectHelper,[0,0,0]];
    _position = [_objectHelper] call FNC_GetPos;
    
    _objHDiff = 0;

    if (isClass (missionConfigFile >> "SnapBuilding" >> _classname)) then {    
        ["","","",["Init",_object,_classname,_objectHelper]] spawn snap_build;
    };
    
    DZE_updateVec = false;
    DZE_memDir = getDir _objectHelper;
    DZE_memForBack = 0;
    DZE_memLeftRight = 0;
    if !(_classname in DZE_noRotate) then{
        s_player_setVectorsReset = player addaction ["Reset","custom\snap_pro\player_vectorChange.sqf","reset"];
        s_player_setVectorsForward = player addaction ["Pitch Forward","custom\snap_pro\player_vectorChange.sqf","forward"];
        s_player_setVectorsBack = player addaction ["Pitch Back","custom\snap_pro\player_vectorChange.sqf","back"];
        s_player_setVectorsLeft = player addaction ["Bank Left","custom\snap_pro\player_vectorChange.sqf","left"];
        s_player_setVectorsRight = player addaction ["Bank Right","custom\snap_pro\player_vectorChange.sqf","right"];
        s_player_setVectors1 = player addaction ["Increment by 1 degree","custom\snap_pro\player_vectorChange.sqf","1"];
        s_player_setVectors5 = player addaction ["Increment by 5 degrees","custom\snap_pro\player_vectorChange.sqf","5"];
        s_player_setVectors45 = player addaction ["Increment by 45 degrees","custom\snap_pro\player_vectorChange.sqf","45"];
        s_player_setVectors90 = player addaction ["Increment by 90 degrees","custom\snap_pro\player_vectorChange.sqf","90"];
    };
    
    while {_isOk} do {

        _zheightchanged = false;
        _zheightdirection = "";
        _rotate = false;

        if (DZE_Q) then {
            DZE_Q = false;
            _zheightdirection = "up";
            _zheightchanged = true;
        };
        if (DZE_Z) then {
            DZE_Z = false;
            _zheightdirection = "down";
            _zheightchanged = true;
        };
        if (DZE_Q_alt) then {
            DZE_Q_alt = false;
            _zheightdirection = "up_alt";
            _zheightchanged = true;
        };
        if (DZE_Z_alt) then {
            DZE_Z_alt = false;
            _zheightdirection = "down_alt";
            _zheightchanged = true;
        };
        if (DZE_Q_ctrl) then {
            DZE_Q_ctrl = false;
            _zheightdirection = "up_ctrl";
            _zheightchanged = true;
        };
        if (DZE_Z_ctrl) then {
            DZE_Z_ctrl = false;
            _zheightdirection = "down_ctrl";
            _zheightchanged = true;
        };
        if (DZE_4) then {
            _rotate = true;
            DZE_4 = false;
            _dir = -45;
            DZE_memDir = DZE_memDir - 45;
        };
        if (DZE_6) then {
            _rotate = true;
            DZE_6 = false;
            _dir = 45;
            DZE_memDir = DZE_memDir + 45;
        };
        
        if(DZE_updateVec) then{
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
            DZE_updateVec = false;
        };
        
        if (DZE_F and _canDo) then {    
            if (helperDetach) then {
                _objectHelper attachTo [player];
                DZE_memDir = DZE_memDir-(getDir player);
                helperDetach = false;
                [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
            } else {
                _objectHelperDir = getDir _objectHelper;
                detach _objectHelper;
                DZE_memDir = getDir _objectHelper;
                [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
                [_objectHelper]    call FNC_GetSetPos;
                _objectHelper setVelocity [0,0,0]; //fix sliding glitch
                helperDetach = true;
            };
            DZE_F = false;
        };
        
        if(_rotate) then {
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
        };

        if(_zheightchanged) then {
            if (!helperDetach) then {
                detach _objectHelper;
                _objectHelperDir = getDir _objectHelper;
            };

            _position = [_objectHelper] call FNC_GetPos;

            if(_zheightdirection == "up") then {
                _position set [2,((_position select 2)+0.1)];
                _objHDiff = _objHDiff + 0.1;
            };
            if(_zheightdirection == "down") then {
                _position set [2,((_position select 2)-0.1)];
                _objHDiff = _objHDiff - 0.1;
            };

            if(_zheightdirection == "up_alt") then {
                _position set [2,((_position select 2)+1)];
                _objHDiff = _objHDiff + 1;
            };
            if(_zheightdirection == "down_alt") then {
                _position set [2,((_position select 2)-1)];
                _objHDiff = _objHDiff - 1;
            };

            if(_zheightdirection == "up_ctrl") then {
                _position set [2,((_position select 2)+0.01)];
                _objHDiff = _objHDiff + 0.01;
            };
            if(_zheightdirection == "down_ctrl") then {
                _position set [2,((_position select 2)-0.01)];
                _objHDiff = _objHDiff - 0.01;
            };

            if((_isAllowedUnderGround == 0) && ((_position select 2) < 0)) then {
                _position set [2,0];
            };

            if (surfaceIsWater _position) then {
                _objectHelper setPosASL _position;
            } else {
                _objectHelper setPosATL _position;
            };

            if (!helperDetach) then {
            _objectHelper attachTo [player];
            _objectHelper setDir _objectHelperDir-(getDir player);
            };
            
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
        };

        sleep 0.5;

        _location2 = [player] call FNC_GetPos;
        _objectHelperPos = [_objectHelper] call FNC_GetPos;

        if(DZE_5) exitWith {
            _isOk = false;
            _position = [_object] call FNC_GetPos;
            detach _object;
            _dir = getDir _object;
            _vector = [(vectorDir _object),(vectorUp _object)];    
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if(_location1 distance _location2 > 10) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = "You've moved to far away from where you started building (within 10 meters)";
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };
        
        if(_location1 distance _objectHelperPos > 10) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = "Object is placed to far away from where you started building (within 10 meters)";
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if(abs(_objHDiff) > 10) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = "Cannot move up or down more than 10 meters";
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if (player getVariable["combattimeout", 0] >= time) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = (localize "str_epoch_player_43");
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if (DZE_cancelBuilding) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = "Cancelled building.";
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };
    };

    if !(_classname in DZE_noRotate) then{
        player removeAction s_player_setVectorsReset;
        player removeAction s_player_setVectorsForward;
        player removeAction s_player_setVectorsBack;
        player removeAction s_player_setVectorsLeft;
        player removeAction s_player_setVectorsRight;
        player removeAction s_player_setVectors1;
        player removeAction s_player_setVectors5;
        player removeAction s_player_setVectors45;
        player removeAction s_player_setVectors90;
    };    
    
    //No building on roads unless toggled
    if (!DZE_BuildOnRoads) then {
        if (isOnRoad _position) then { _cancel = true; _reason = "Cannot build on a road."; };
    };

    // No building in trader zones
    if(!canbuild) then { _cancel = true; _reason = "Cannot build in a city."; };

    if(!_cancel) then {

        _classname = _classnametmp;

        // Start Build
        _tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
        // ### [CPC] Indestructible Base Fix    
        _tmpbuilt addEventHandler ["HandleDamage", {false}];
        _tmpbuilt enableSimulation false;
        // ### [CPC] Indestructible Base Fix

        _tmpbuilt setdir _dir;

        _tmpbuilt setVectorDirAndUp _vector;
        
        // Get position based on object
        _location = _position;

        if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then {
            _location set [2,0];
        };

        _buildOffset = [0,0,0];
        _vUp = _vector select 1;
        switch (_classname) do {
            case "MetalFloor_DZ": { _buildOffset = [(_vUp select 0) * .148, (_vUp select 1) * .148,0]; };
        };
        
        _location = [
            (_location select 0) - (_buildOffset select 0),
            (_location select 1) - (_buildOffset select 1),
            (_location select 2) - (_buildOffset select 2)
        ];
        
        if (surfaceIsWater _location) then {
            _tmpbuilt setPosASL _location;
            _location = ASLtoATL _location;
        } else {
            _tmpbuilt setPosATL _location;
        };

        cutText [format[(localize "str_epoch_player_138"),_text], "PLAIN DOWN"];

        _limit = 3;

        if (DZE_StaticConstructionCount > 0) then {
            _limit = DZE_StaticConstructionCount;
        }
        else {
            if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
                _limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
            };
        };

        _isOk = true;
        _proceed = false;
        _counter = 0;

        while {_isOk} do {

            [10,10] call dayz_HungerThirst;
            player playActionNow "Medic";

            _dis=20;
            _sfx = "repair";
            [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
            [player,_dis,true,(getPosATL player)] spawn player_alertZombies;

            r_interrupt = false;
            r_doLoop = true;
            _started = false;
            _finished = false;

            while {r_doLoop} do {
                _animState = animationState player;
                _isMedic = ["medic",_animState] call fnc_inString;
                if (_isMedic) then {
                    _started = true;
                };
                if (_started && !_isMedic) then {
                    r_doLoop = false;
                    _finished = true;
                };
                if (r_interrupt || (player getVariable["combattimeout", 0] >= time)) then {
                    r_doLoop = false;
                };
                if (DZE_cancelBuilding) exitWith {
                    r_doLoop = false;
                };
                sleep 0.1;
            };
            r_doLoop = false;


            if(!_finished) exitWith {
                _isOk = false;
                _proceed = false;
            };

            if(_finished) then {
                _counter = _counter + 1;
            };

            cutText [format[(localize "str_epoch_player_139"),_text, _counter,_limit], "PLAIN DOWN"];

            if(_counter == _limit) exitWith {
                _isOk = false;
                _proceed = true;
            };

        };

        if (_proceed) then {

            _num_removed = ([player,_item] call BIS_fnc_invRemove);
            if(_num_removed == 1) then {

                cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];

                if (_isPole) then {
                    [] spawn player_plotPreview;
                };

                _tmpbuilt setVariable ["OEMPos",_location,true];

                if(_lockable > 1) then {

                    _combinationDisplay = "";

                    switch (_lockable) do {

                        case 2: { // 2 lockbox
                            _combination_1 = (floor(random 3)) + 100; // 100=red,101=green,102=blue
                            _combination_2 = floor(random 10);
                            _combination_3 = floor(random 10);
                            _combination = format["%1%2%3",_combination_1,_combination_2,_combination_3];
                            dayz_combination = _combination;
                            if (_combination_1 == 100) then {
                                _combination_1_Display = "Red";
                            };
                            if (_combination_1 == 101) then {
                                _combination_1_Display = "Green";
                            };
                            if (_combination_1 == 102) then {
                                _combination_1_Display = "Blue";
                            };
                            _combinationDisplay = format["%1%2%3",_combination_1_Display,_combination_2,_combination_3];
                        };

                        case 3: { // 3 combolock
                            _combination_1 = floor(random 10);
                            _combination_2 = floor(random 10);
                            _combination_3 = floor(random 10);
                            _combination = format["%1%2%3",_combination_1,_combination_2,_combination_3];
                            dayz_combination = _combination;
                            _combinationDisplay = _combination;
                        };

                        case 4: { // 4 safe
                            _combination_1 = floor(random 10);
                            _combination_2 = floor(random 10);
                            _combination_3 = floor(random 10);
                            _combination_4 = floor(random 10);
                            _combination = format["%1%2%3%4",_combination_1,_combination_2,_combination_3,_combination_4];
                            dayz_combination = _combination;
                            _combinationDisplay = _combination;
                        };
                    };

                    _tmpbuilt setVariable ["CharacterID",_combination,true];


                    PVDZE_obj_Publish = [_combination,_tmpbuilt,[_dir,_location,_vector],_classname];
                    publicVariableServer "PVDZE_obj_Publish";

                    cutText [format[(localize "str_epoch_player_140"),_combinationDisplay,_text], "PLAIN DOWN", 5];


                } else {
                    _tmpbuilt setVariable ["CharacterID",dayz_characterID,true];

                    // fire?
                    if(_tmpbuilt isKindOf "Land_Fire_DZ") then {
                        _tmpbuilt spawn player_fireMonitor;
                    } else {
                        PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,_vector],_classname];
                        publicVariableServer "PVDZE_obj_Publish";
                    };
                };
            } else {
                deleteVehicle _tmpbuilt;
                cutText [(localize "str_epoch_player_46") , "PLAIN DOWN"];
            };

        } else {
            r_interrupt = false;
            if (vehicle player == player) then {
                [objNull, player, rSwitchMove,""] call RE;
                player playActionNow "stop";
            };

            deleteVehicle _tmpbuilt;

            cutText [(localize "str_epoch_player_46") , "PLAIN DOWN"];
        };

    } else {
        cutText [format[(localize "str_epoch_player_47"),_text,_reason], "PLAIN DOWN"];
    };
};

DZE_ActionInProgress = false;

 

And this is my dayz_spaceInterrupt.sqf:

 

private ["_dikCode","_handled","_primaryWeapon","_secondaryWeapon","_nearbyObjects","_nill","_shift","_ctrl","_alt","_dropPrimary","_dropSecondary","_iItem","_removed","_iPos","_radius","_item"];
_dikCode =     _this select 1;

_handled = false;

if (_dikCode in[0x02,0x03,0x04,0x58,0x57,0x44,0x43,0x42,0x41,0x40,0x3F,0x3E,0x3D,0x3C,0x3B,0x0B,0x0A,0x09,0x08,0x07,0x06,0x05]) then {
    _handled = true;
};

if ((_dikCode == 0x3E || _dikCode == 0x0F || _dikCode == 0xD3)) then {
    if(diag_tickTime - dayz_lastCheckBit > 10) then {
        dayz_lastCheckBit = diag_tickTime;
        call dayz_forceSave;
    };
    call dayz_EjectPlayer;
};

// esc
if (_dikCode == 0x01) then {
    DZE_cancelBuilding = true;
    call dayz_EjectPlayer;
};
// Disable ESC after death
if (_dikCode == 0x01 && r_player_dead) then {
    _handled = true;
};

// surrender
if (_dikCode in actionKeys "Surrender") then {
    
    _vehicle = vehicle player;
    _inVehicle = (_vehicle != player);
    _onLadder =    (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
    _canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder && !_inVehicle);
    
    if (_canDo && !DZE_Surrender && !(player isKindOf  "PZombie_VB")) then {
        DZE_Surrender = true;
        _dropPrimary = false;
        _dropSecondary = false;

        _primaryWeapon = primaryWeapon player;
        if (_primaryWeapon != "") then {_dropPrimary = true;};
        _secondaryWeapon = "";
        {
            if ((getNumber (configFile >> "CfgWeapons" >> _x >> "Type")) == 2) exitWith {
                    _secondaryWeapon = _x;
            };
        } count (weapons player);
        if (_secondaryWeapon != "") then {_dropSecondary = true;};

        if (_dropPrimary || _dropSecondary) then {
            player playActionNow "PutDown";
            _iPos = getPosATL player;
            _radius = 1;
            _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
            _item setposATL _iPos;
            if (_dropPrimary) then {
                _iItem = _primaryWeapon;
                _removed = ([player,_iItem,1] call BIS_fnc_invRemove);
                if (_removed == 1) then {
                    _item addWeaponCargoGlobal [_iItem,1];
                };
            };
            if (_dropSecondary) then {
                _iItem = _secondaryWeapon;
                _removed = ([player,_iItem,1] call BIS_fnc_invRemove);
                if (_removed == 1) then {
                    _item addWeaponCargoGlobal [_iItem,1];
                };
            };
            player reveal _item;
        };

        // set publicvariable that allows other player to access gear
        player setVariable ["DZE_Surrendered", true, true];
        // surrender animation
        player playMove "AmovPercMstpSsurWnonDnon";
    };
    _handled = true;
};

if (_dikCode in actionKeys "MoveForward") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};};
if (_dikCode in actionKeys "MoveLeft") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};};
if (_dikCode in actionKeys "MoveRight") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};};
if (_dikCode in actionKeys "MoveBack") exitWith {r_interrupt = true; if (DZE_Surrender) then {call dze_surrender_off};};

//Prevent exploit of drag body
if ((_dikCode in actionKeys "Prone") && r_drag_sqf) exitWith { force_dropBody = true; };
if ((_dikCode in actionKeys "Crouch") && r_drag_sqf) exitWith { force_dropBody = true; };

_shift =     _this select 2;
_ctrl =     _this select 3;
_alt =        _this select 4;

//diag_log format["Keypress: %1", _this];
if ((_dikCode in actionKeys "Gear") && (vehicle player != player) && !_shift && !_ctrl && !_alt && !dialog) then {
            createGearDialog [player, "RscDisplayGear"];
            _handled = true;
};

if (_dikCode in (actionKeys "GetOver")) then {
    
    if (player isKindOf  "PZombie_VB") then {
        _handled = true;
        DZE_PZATTACK = true;
    } else {
        _nearbyObjects = nearestObjects[getPosATL player, dayz_disallowedVault, 8];
        if (count _nearbyObjects > 0) then {
            if((diag_tickTime - dayz_lastCheckBit > 4)) then {
                [objNull, player, rSwitchMove,"GetOver"] call RE;
                player playActionNow "GetOver";
                dayz_lastCheckBit = diag_tickTime;
            } else {
                _handled = true;
            };
        };
    };
};
//if (_dikCode == 57) then {_handled = true}; // space
//if (_dikCode in actionKeys 'MoveForward' || _dikCode in actionKeys 'MoveBack') then {r_interrupt = true};
if (_dikCode == 210) then {
        _nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};

if (_dikCode in actionKeys "ForceCommandingMode") then {_handled = true};
if (_dikCode in actionKeys "PushToTalk" && (diag_tickTime - dayz_lastCheckBit > 10)) then {
    dayz_lastCheckBit = diag_tickTime;
    [player,50,true,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "VoiceOverNet" && (diag_tickTime - dayz_lastCheckBit > 10)) then {
    dayz_lastCheckBit = diag_tickTime;
    [player,50,true,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "PushToTalkDirect" && (diag_tickTime - dayz_lastCheckBit > 10)) then {
    dayz_lastCheckBit = diag_tickTime;
    [player,15,false,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "Chat" && (diag_tickTime - dayz_lastCheckBit > 10)) then {
    dayz_lastCheckBit = diag_tickTime;
    [player,15,false,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "User20" && (diag_tickTime - dayz_lastCheckBit > 5)) then {
    dayz_lastCheckBit = diag_tickTime;
    _nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};

// numpad 8 0x48 now pgup 0xC9 1
if ((_dikCode == 0xC9 && (!_alt || !_ctrl)) || (_dikCode in actionKeys "User15")) then {
    DZE_Q = true;
};
// numpad 2 0x50 now pgdn 0xD1
if ((_dikCode == 0xD1 && (!_alt || !_ctrl)) || (_dikCode in actionKeys "User16")) then {
    DZE_Z = true;
};


// numpad 8 0x48 now pgup 0xC9 0.1
if ((_dikCode == 0xC9 && (_alt && !_ctrl)) || (_dikCode in actionKeys "User13")) then {
    DZE_Q_alt = true;
};
// numpad 2 0x50 now pgdn 0xD1
if ((_dikCode == 0xD1 && (_alt && !_ctrl)) || (_dikCode in actionKeys "User14")) then {
    DZE_Z_alt = true;
};


// numpad 8 0x48 now pgup 0xC9 0.01
if ((_dikCode == 0xC9 && (!_alt && _ctrl)) || (_dikCode in actionKeys "User7")) then {
    DZE_Q_ctrl = true;
};
// numpad 2 0x50 now pgdn 0xD1
if ((_dikCode == 0xD1 && (!_alt && _ctrl)) || (_dikCode in actionKeys "User8")) then {
    DZE_Z_ctrl = true;
};




// numpad 4 0x4B now Q 0x10
if (_dikCode == 0x10 || (_dikCode in actionKeys "User17")) then {
    DZE_4 = true;
};        
// numpad 6 0x4D now E 0x12
if (_dikCode == 0x12 || (_dikCode in actionKeys "User18")) then {
    DZE_6 = true;
};
// numpad 5 0x4C now space 0x39
if (_dikCode == 0x39 || (_dikCode in actionKeys "User19")) then {
    DZE_5 = true;
};

// F key
if ((_dikCode == 0x21 and (!_alt and !_ctrl)) or (_dikCode in actionKeys "User6")) then {
    DZE_F = true;
};

if (_dikCode == 0xDB) then {
    if (tagName) then {tagName = false;titleText ["Group name tags OFF","PLAIN DOWN"];titleFadeOut 4;} else {tagName = true;titleText ["Group name tags ON","PLAIN DOWN"];titleFadeOut 4;};
    _handled = true;
};

if (_dikCode in actionKeys "TacticalView") then {_handled = true;};

if (_dikCode == 0x17) then {
    if (dialog) then {closeDialog 0;groupManagementActive = false;} else {execVM "dzgm\loadGroupManagement.sqf";};
    _handled = true;
};

_handled

 

The problem occurs if I press e or q or if I use the vector building options like bank right etc.

 

Best regards,

 

GudrunGisela

Link to comment
Share on other sites

  • 2 weeks later...
I have problem with Snap Building PRO with Vector Building, I'm not sure I write in good thread but I try.
 
This small sign sphere 10cm should be only one the object what you build, but when you click Snap Build ON this small signs are on the every wall/doors/object and it makes really low fps number. It happened after I install Vector Building with Snap because snap_build.sqf is other than normal:
 
Here is snap_build.sqf with Vector:
 
 
And here is snap_build.sqf without Vector Building:
 
 

 

Link to comment
Share on other sites

 

I have problem with Snap Building PRO with Vector Building, I'm not sure I write in good thread but I try.
 
This small sign sphere 10cm should be only one the object what you build, but when you click Snap Build ON this small signs are on the every wall/doors/object and it makes really low fps number. It happened after I install Vector Building with Snap because snap_build.sqf is other than normal:
 
Here is snap_build.sqf with Vector:
 
 
And here is snap_build.sqf without Vector Building:
 
 

 

you need to adjust your snap range, it's mentioned in installation guide on github. Either that or a better CPU :P

just reduce detection range, it will spawn less spheres, but can cause some issues in the long run.

 

And guys, I do not provide support for vectors here, that script is made by different author, just uses SBP for snapping feature.

Link to comment
Share on other sites

  • 3 weeks later...

could anyone please help me get this required mod working?

 

I have got it working on several of my past servers, however I am trying to diffmerge it with this player_build.sqf

with no luck 

 

this is my player_build.sqf

http://pastebin.com/AyPa3juE

 

I am assuming player_build.sqf is where my problem lies, since I see nothing different in dayz_spaceInterrupt.sqf

 

my goal is to get this and vector working as they are must have these days.

Link to comment
Share on other sites

  • 5 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×
×
  • Create New...