Jump to content

[Outdated] [release] 1.0.6 - Deploy Anything 2.8.2 - Now with Epoch building! | Customizable: DB saving | Plot | Vehicles/Buildings | Packing


mudzereli

Recommended Posts

0 = north

90 = east

180 = south

270 = west

360 = north

doesn't work

/*
    DayZ Base Building
    Made for DayZ Epoch please ask permission to use/edit/distrubute email [email protected].
*/
private ["_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;

// disallow building if too many objects are found within 30m
if((count ((getPosATL player) nearObjects ["All",30])) >= DZE_BuildingLimit) exitWith {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);

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_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 = "";

//### BEGIN MODIFIED CODE: player_deploy
//_needNear =     getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "neednearby");
private["_index"];
_index = _this call getDeployableIndex;
_needNear = _index call getDeployableNeedNearBy;
//### END MODIFIED CODE: player_deploy

{
    switch(_x) do{
        case "fire":
        {
            _distance = 3;
            _isNear = {inflamed _x} count (getPosATL player nearObjects _distance);
            if(_isNear == 0) then {
                _abort = true;
                _reason = "fire";
            };
        };
        case "workshop":
        {
            _distance = 3;
            _isNear = count (nearestObjects [player, ["Wooden_shed_DZ","WoodShack_DZ","WorkBench_DZ"], _distance]);
            if(_isNear == 0) then {
                _abort = true;
                _reason = "workshop";
            };
        };
        case "fueltank":
        {
            _distance = 30;
            _isNear = count (nearestObjects [player, 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;
};

//### BEGIN MODIFIED CODE: player_deploy
//_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");
_classname      = _index call getDeployableClass;
_classnametmp   = _classname;
_require        = [];
_text           = _index call getDeployableDisplay;
_ghost          = "";
//### END MODIFIED CODE: player_deploy

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

_requireplot = 1;
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "requireplot")) then {
    _requireplot = getNumber(configFile >> "CfgVehicles" >> _classname >> "requireplot");
};
//### BEGIN MODIFIED CODE: player_deploy
if(_index call getDeployableRequirePlot) then {_requireplot = 1;} else {_requireplot = 0;};
//### END MODIFIED CODE: player_deploy

_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];
};
//### BEGIN MODIFIED CODE: player_deploy
_offset = _index call getDeployableDistanceOffset;
//### END MODIFIED CODE: player_deploy

_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"]; };

private["_exitWith"];
if(_IsNearPlot == 0) then {

    // Allow building of plot
    if(_requireplot == 0 || _isLandFireDZ) then {
        _canBuildOnPlot = true;
    } else {
        _exitWith = (localize "STR_EPOCH_PLAYER_135");
    };

} 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 {
            _exitWith = "You can't build a plot within your plot!";
        };

    } else {
        // disallow building plot
        if(!_isPole) then {
            _friendlies     = player getVariable ["friendlyTo",[]];
            // check if friendly to owner
            if(_ownerID in _friendlies) then {
                _canBuildOnPlot = true;
            } else {
                _exitWith = "You can't build on someone else's plot!";
            };
        };
    };
};

// _message
if(!_canBuildOnPlot) exitWith {  DZE_ActionInProgress = false; cutText [format[_exitWith,_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;
//### BEGIN MODIFIED CODE player_deploy
    _hastoolweapon = (_index call getDeployableKitClass) in ((weapons player) + (magazines player));
    if(!_hastoolweapon) then { _hasrequireditem = false; _missing = (_index call getDeployableKitDisplay); };
//### END MODIFIED CODE: player_deploy

//### BEGIN MODIFIED CODE player_deploy
//_hasbuilditem = _this in magazines player;
//if (!_hasbuilditem) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_player_31"),_text,"build"] , "PLAIN DOWN"]; };
_hasbuilditem = [player,_index] call getHasDeployableParts;
if (!_hasbuilditem) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_player_31"),str (_index call getDeployableParts),"build"] , "PLAIN DOWN"]; };
//### END MODIFIED CODE: player_deploy

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

/*REMOVED TO HOPEFULLY FIX UNRIDEABLE ISSUE
    _location = [0,0,0];
*/
//ADDED TO HOPEFULLY FIX UNRIDEABLE ISSUE
	_dir = getdir player;
	_dir = _dir + 180;
	_location = getPos player;
	_location = [(_location select 0)+8*sin(_dir),(_location select 1)+8*cos(_dir),0]; //maybe adjust the height? [x,y,z(0)]
//ADDED TO HOPEFULLY FIX UNRIDEABLE ISSUE	
	
    _isOk = true;

    // get inital players position
    _location1 = getPosATL player;
	/*REMOVED TO HOPEFULLY FIX UNRIDEABLE ISSUE
    _dir = getDir player;
	*/

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

    _object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
    //### BEGIN MODIFIED CODE player_deploy
    _object setVariable["ObjectUID","1",true];

    _object attachTo [player,_offset];
    
	/*REMOVED TO HOPEFULLY FIX UNRIDEABLE ISSUE
    _dir = 0;
	*/
    _object setDir _dir;
    //### END MODIFIED CODE: player_deploy

    _position = getPosATL _object;

    cutText [(localize "str_epoch_player_45"), "PLAIN DOWN"];

    _objHDiff = 0;

    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;
            //###BEGIN MODIFIED CODE: player deploy
            //_dir = 0;
            _dir = _dir + 30;
            //###END MODIFIED CODE: player deploy
        };
        if (DZE_6) then {
            _rotate = true;
            DZE_6 = false;
            //###BEGIN MODIFIED CODE: player deploy
            //_dir = 180;
            _dir = _dir - 30;
            //###END MODIFIED CODE: player deploy
        };

        if(_rotate) then {
            _object setDir _dir;
            _object setPosATL _position;
            //diag_log format["DEBUG Rotate BUILDING POS: %1", _position];
        };

        if(_zheightchanged) then {
            detach _object;

            _position = getPosATL _object;

            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;
            };

            //###BEGIN MODIFIED CODE: player deploy
            //_object setDir (getDir _object);
            //###END MODIFIED CODE: player deploy

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

            _object setPosATL _position;

            //diag_log format["DEBUG Change BUILDING POS: %1", _position];

            _object attachTo [player];

            //### BEGIN MODIFIED CODE player_deploy
            _object setDir _dir;
            //### END MODIFIED CODE: player_deploy

        };

        sleep 0.5;

        _location2 = getPosATL player;

        if(DZE_5) exitWith {
            _isOk = false;
            detach _object;
            _dir = getDir _object;
            _position = getPosATL _object;
            //diag_log format["DEBUG BUILDING POS: %1", _position];
            _object setPos[0,0,0];
            hideObject _object;
            deleteVehicle _object;
        };

        if(_location1 distance _location2 > 5) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = "You've moved to far away from where you started building (within 5 meters)";
            detach _object;
            _object setPos[0,0,0];
            hideObject _object;
            deleteVehicle _object;
        };

        if(abs(_objHDiff) > 5) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = "Cannot move up || down more than 5 meters";
            detach _object;
            _object setPos[0,0,0];
            hideObject _object;
            deleteVehicle _object;
        };

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

        if (DZE_cancelBuilding) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = "Cancelled building.";
            detach _object;
            _object setPos[0,0,0];
            hideObject _object;
            deleteVehicle _object;
        };
    };

    //### END MODIFIED CODE: road building
    //No building on roads unless toggled
    //if (!DZE_BuildOnRoads) then {
    if (!(_index call getDeployableBuildOnRoad)) then {
    //### END MODIFIED CODE: road building
        if (isOnRoad [_position select 0, _position select 1, 0]) 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"];

        //### BEGIN MODIFIED CODE: player deploy
       // if (!(_index call getDeployableSimulation)) then {
       //     _tmpbuilt enableSimulation false;
       // };
        _tmpbuilt setVariable ["ObjectUID", "1", true];
        //### END MODIFIED CODE: player deploy

        _tmpbuilt setdir _dir;

        // Get position based on object
        _location = _position;

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

        _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 {

            //###BEGIN MODIFIED CODE
            //_num_removed = ([player,_item] call BIS_fnc_invRemove);
            //if(_num_removed == 1) then {
            if([player,_index] call getHasDeployableParts) then {
                [player,_index] call removeDeployableParts;
            //###BEGIN MODIFIED CODE

                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],_classname];
                    publicVariableServer "PVDZE_obj_Publish";

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


                } else {
                    //_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
                    //### BEGIN MODIFIED CODE: player deploy
                    // fire?
                    //if(_tmpbuilt isKindOf "Land_Fire_DZ") then {
                    //    _tmpbuilt spawn player_fireMonitor;
                    //} else {
                    //    PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location],_classname];
                    //    publicVariableServer "PVDZE_obj_Publish";
                    //};
                    if (_index call getPermanent) then {
                        _tmpbuilt call fnc_set_temp_deployable_id;
                        if(_index call getDeployableSimulation) then {
                            PVDZE_veh_Publish = [_tmpbuilt,[_dir,_position],(_index call getDeployableClass),true,call fnc_perm_deployable_id];
                            publicVariableServer "PVDZE_veh_Publish";
                        } else {
                            PVDZE_obj_Publish = [call fnc_perm_deployable_id,_tmpbuilt,[_dir,_position],(_index call getDeployableClass)];
                            publicVariableServer "PVDZE_obj_Publish";
                        };
                    } else {
                        _tmpbuilt call fnc_set_temp_deployable_id;
                    };
                    if(_index call getClearCargo) then {
                        clearWeaponCargoGlobal _tmpbuilt;
                        clearMagazineCargoGlobal _tmpbuilt;
                    };
                    if(_index call getDeployableClearAmmo) then {
                        _tmpbuilt setVehicleAmmo 0;
                    };
                    player reveal _tmpbuilt;
                    DZE_DEPLOYING_SUCCESSFUL = true;
                    //### END MODIFIED CODE: player deploy
                };
            } else {
                _tmpbuilt setPos[0,0,0];
                hideObject _tmpbuilt;
                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";
            };

            _tmpbuilt setPos[0,0,0];
            hideObject _tmpbuilt;
            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;

 

Did I do it incorrectly? It makes absolutely no difference what I set that number to.

Link to comment
Share on other sites

hmm... the code is looking good. But maybe we can be a more aggressive on vehicles so the allways point in the same direction as the player?

 

search for: 

_tmpbuilt setdir _dir;

replace it with:

if (_tmpbuilt isKindOf "AllVehicles") then { 
			_dir = getdir player;
			_tmpbuilt setdir _dir;
		} else {
			_tmpbuilt setdir _dir;
		};
 

this should set all vehicle types in the same direction as the player is heading :)

Link to comment
Share on other sites

Still testing these changes schwede, its a quiet server so it'll take awhile to fully test.. in the mean time.. I noticed that deployables are able to be sold to traders.. is there a way to attach a variable to them or something that would prevent them from being sellable? Seems very exploitable if say a toolbox and a vrotor gets you a mozzie which you can sell and make double your money back.

Link to comment
Share on other sites

ok, long time not messed around with traders ^^ (this will be only for config traders, NOT for hive traders)

 

hope this will work :)

 

first we need to put everything from the traders to our mission:

 

go to your dayz_code.pbo\actions and copy the following files into your mission:

trade_any_bicycle.sqf
trade_any_vehicle.sqf
trade_backpacks.sqf
trade_weapons.sqf
trade_items.sqf

now go into dayz_code.pbo\compiles and copy the following file into your mission:

player_traderMenuConfig.sqf

ok now we edit some files to get this done:

 

first lets start with the deploying part:

 

player_deploy.sqf

 

search for

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

add right after

_tmpbuilt setVariable ["Schw_notforsale",1,true];

safe the file and done

---------------------------------------------------------------------------

 

next file is your compiles.sqf

 

search for

call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuConfig.sqf";

redirect the path to where ever you have placed your player_traderMenuConfig.sqf

 

safe and done

---------------------------------------------------------------------------

 

 

next file is your player_traderMenuConfig.sqf

 

search for

_File = "\z\addons\dayz_code\actions\" + _afile + ".sqf";

and redirect the path you have put the trade_any_vehicle.sqf, trade_weapons.sqf, etc

 

safe and done

---------------------------------------------------------------------------

 

ok now comes the part where we disable the trading for deployed vehicles

 

in your trade_any_vehicle.sqf and trade_any_bike.sqf

 

search for

_obj = (_objects select 0);

and add right after

if ((_obj getVariable ["Schw_notforsale",0]) == 1) exitWith { cutText ["Deployed vehicles can't be sold","PLAIN DOWN"]; DZE_ActionInProgress = false;};

this should cancel the trade from any deployed vehicle.

 

NOT TESTED!

Link to comment
Share on other sites

  • 2 weeks later...
SchwEde seems yout changes have fixed the problem with bike not moving or at least i havent had any complains since

would love to hear from other ppl that have tried your changes thou...

 

the script has a plot check forbiding players to build inside plot poles, unfortunately is still possible to glitch the walls with bike or other deployable if the owner of the plot pole has walls just close enough to the plot radius. is it possible to add little more range to the plot radius check without actually changing plot radius ?

Link to comment
Share on other sites

Hey guys, as you know I've been missing for a long time.

 

First off this is NOT a message to say I'm coming back. :)

 

I'm not really into DayZ/Arma scripting too much anymore, but I was strolling by the forum and it seems SchwEde has come up with a fix for the longstanding "bike won't move" problem. 

 

I pushed a commit to github  that adds this fix to the main code. 

 

Thanks SchwEde and the rest of the community for the love and support of my scripts!

Link to comment
Share on other sites

  • 3 weeks later...

Maybe someone can help me with. I don't want to use the gems, but every time I comment them out, the script breaks. Here is my edited code.

 

config.sqf

/* see github for instructions for more details on how these values work:

https://github.com/mudzereli/DayZEpochDeployableBike*/
/* [ **CLASS_TO_CLICK** , **TYPE_OF_CLASS_TO_CLICK** , **DEPLOY_DISTANCE** , **DEPLOY_DIRECTION_OFFSET** , **PACK_DISTANCE** , **DAMAGE_LIMIT** , **ALLOW_PACKING_OTHERS** , **CLEAR_CARGO** , **SAVE_TO_DATABASE** , [ **CLASS_TO_DEPLOY** , **CLASS_TO_DEPLOY2** ] ] */
DZE_DEPLOYABLES_CONFIG = [
// deploy a non-permanent bike from a toolbox right in front of the player that can be re-packed by the owner as long as it's under 10% damage
["ItemToolbox","CfgWeapons",2,270,5,0.1,false,false,false,["MMT_Civ"]],
// deploy fortifications from etool 3 meters in front of player that are permanent until server restart
["ItemEtool","CfgWeapons",3,0,5,-1,false,true,false,["Land_fort_rampart","Fort_StoneWall_EP1"]],
// deploy a permanent helicopter from ruby 5 meters in front of player that can be re-packed by anyone as long as it's under 10% damage
//["ItemRuby","CfgMagazines",5,270,7,0.1,true,true,true,["AH6X_DZ","UH1Y_DZ"]],
// deploy some vehicles in front of the player that have an empty inventory (commented out)
//["ItemCitrine","CfgMagazines",5,270,7,false,false,false,true,["UralCivil","MTVR","LocalBasicWeaponsBox"]],
// deploy some vehicles in front of the player that have all the default items in their inventory still (commented out)
//["ItemSapphire","CfgMagazines",5,270,7,false,false,false,false,["UralCivil","MTVR","LocalBasicWeaponsBox"]],
// deploy military housing in front of the player that is permanent but can't be re-packed by anyone
//["ItemEmerald","CfgMagazines",10,0,10,-1,false,false,true,["Barrack2","Land_fortified_nest_small_EP1"]],
// deploy some housing items from parts piles in front of the player that are permanent but can be re-packed by anyone
["PartGeneric","CfgMagazines",2,0,5,1,true,true,true,["Desk","FoldChair","FoldTable","SmallTable","Barrel1","Garbage_can"]],
// deploy some housing items from wood piles in front of the player that are permanent but can be re-packed by anyone
["PartWoodPile","CfgMagazines",2,90,5,1,true,true,true,["Land_Rack_EP1","Land_Table_EP1","Land_Shelf_EP1","WoodChair","Park_bench2","Park_bench1"]],
// deploy concrete barricades from cinderblocks 2m in front of the player, that are permanent and can only be re-packed by the person who placed them
//["CinderBlocks","CfgMagazines",2,0,5,1,false,true,true,["Land_CncBlock","Land_CncBlock_Stripes"]]
];

DZE_DEPLOYABLE_ADMINS = ["38130182","76561197962680159"];

 

I'm still using the original code, I do apologize, but I really don't want the extras with the gps and rangfinders. The other issue we have is when players attempt to "take" their own deployed bike, they get a Battleye kicked PublicVariable Restriction #0. Any help would be greatly appreciated! Thanks so much.

Link to comment
Share on other sites

is there a way to get this working together with infistars _CSA

i guess infistars CSA is blocking the addaction because its not loaded into a allowed variable (s_player_...) 
 

 

bike\init.sqf line 105

if ((_forEachIndex call getActionId) < 0) then {
[_forEachIndex,player addaction["<t color='#33b5e5'>" + format["Pack %1",(_forEachIndex call getDeployableDisplay)] + "</t>","addons\bike\pack.sqf",[_forEachIndex,_cursorTarget],0,false,true,"", ""]] call setActionId;
};

someone knows a way how to fix this so the Pack Obj scrollmenu will be shown for the players.

 

regard dew

Link to comment
Share on other sites

is there a way to get this working together with infistars _CSA

i guess infistars CSA is blocking the addaction because its not loaded into a allowed variable (s_player_...) 

 

 

bike\init.sqf line 105

if ((_forEachIndex call getActionId) < 0) then {
[_forEachIndex,player addaction["<t color='#33b5e5'>" + format["Pack %1",(_forEachIndex call getDeployableDisplay)] + "</t>","addons\bike\pack.sqf",[_forEachIndex,_cursorTarget],0,false,true,"", ""]] call setActionId;
};

someone knows a way how to fix this so the Pack Obj scrollmenu will be shown for the players.

 

regard dew

did you use the scroll wheel installation or the right click installation? I've never had to filter this with infiSTAR and I use the right click set up.

Link to comment
Share on other sites

rightclick. i m using the 2.8.1 from github https://github.com/mudzereli/DayZEpochDeployableBike#configuration

its working without CSA without any problems the menu shows up and all is good but i cannot firuge out how to put this addaction function behinde a s_player variable. i guess this is why the AH is removing the scrollmenu option to pack the object. 

 

Link to comment
Share on other sites

rightclick. i m using the 2.8.1 from github https://github.com/mudzereli/DayZEpochDeployableBike#configuration

its working without CSA without any problems the menu shows up and all is good but i cannot firuge out how to put this addaction function behinde a s_player variable. i guess this is why the AH is removing the scrollmenu option to pack the object. 

 

thats just really weird that it's blocking it because mine isn't and never has.

Link to comment
Share on other sites

I'm having trouble with this script breaking the JAEM v1.6 script I'm currently using. It seems like the Deploy Anything script blocks the custom variables.sqf file JAEM uses

 

dayz_allowedObjects = dayz_allowedObjects + ["HeliHRescue"];

 

The issue I get is the Helipad is disappearing as soon as it is placed

 

19:46:14 Error in expression


};>
19:46:14 Error position: <};>
19:46:14 Error Missing {
19:46:14 File mpmissions\__cur_mp.chernarus\custom\JAEM\variables.sqf, line 3
19:46:14 Error in expression
};>
19:46:14 Error position: <};>
19:46:14 Error Missing {
19:46:14 File mpmissions\__cur_mp.chernarus\custom\JAEM\variables.sqf, line 3

 

and

 

19:05:49 Error in expression <

if (isServer) then {

if (parseNumber _id > 0) then {

_key = format["CHILD:30>
19:05:49 Error position: <_id > 0) then {

_key = format["CHILD:30>
19:05:49 Error Undefined variable in expression: _id
19:05:49 File z\addons\dayz_server\compile\server_deleteObj.sqf, line 11

 

are the errors I get, I've tried to add "HeliHRescue" to the dayz_allowedObjects list in the original variables file and removed the call compile for JAEMs variables.sqf

 

I am probably missing something simple but It's late here, any help would be appreciated

Link to comment
Share on other sites

i doubt its this script doing anything with JAEM

most likely ur problem its with JAEM

 

the first error im sure its acctually on your JAEM\variables.sqf, you eitheir have a `,` or a `;` where u shouldn't have, or just one too many `{`

 

the other error gets complicated, i would go through the installation (JAEM instalation) steps again pay attention to the changes on server_monitor.sqf or server_functions.sqf (which ever it needs changing, cant remember.)

Link to comment
Share on other sites

I have everything working fine except deployment of static weapons. i can safely deploy M2staticMG but when I enter the vehicle to fire my screen turns black and I can only fire one round. At that point i can only alt f4 out of the game. When i log back in i can repack the M2 with no issues. I can spawn a M2 via infiStar and have zero issues entering, firing, exiting the vehicle. I only noticed a few additions to battleye in the install/intro. Can someone help point me in the right direction so i can get this deployment script working at 100%. Thank you

 

Added EVD to test and had no issues entering and safely firing the M2, but couldn't get pack to work with the selfactions.

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

I came up with an idea to use this to deploy static guns using the gunbags (ie: M2StaticMG_US_Bag_EP1) so I added this line:

["M2StaticMG_US_Bag_EP1",[0,2,0],1,-1,false,false,false,true,false,false,false,["M2StaticMG_US_EP1"],[],["M2StaticMG_US_Bag_EP1"],"true"],

The idea was that you right click on the M2StaticMG_US_Bag_EP1 and  deploy the M2StaticMG_US_EP1, and the M2StaticMG_US_Bag_EP1 gets removed. Apparently the object to remove has to be in your inventory. Is there a way to make it so it can remove the backpack being worn under this condition?

Link to comment
Share on other sites

I came up with an idea to use this to deploy static guns using the gunbags (ie: M2StaticMG_US_Bag_EP1) so I added this line:

["M2StaticMG_US_Bag_EP1",[0,2,0],1,-1,false,false,false,true,false,false,false,["M2StaticMG_US_EP1"],[],["M2StaticMG_US_Bag_EP1"],"true"],

The idea was that you right click on the M2StaticMG_US_Bag_EP1 and  deploy the M2StaticMG_US_EP1, and the M2StaticMG_US_Bag_EP1 gets removed. Apparently the object to remove has to be in your inventory. Is there a way to make it so it can remove the backpack being worn under this condition?

 

BUMP

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...