Jump to content

[RELEASE][CRAFT HOUSES BASED ON SURVIVED TIME]


Recommended Posts

 

/////////Allow players by right click on Etool to:

*Build Small Houses: (Survive 2 days + 4 WoodWalls + 1 FloorCelling)

*Build Medium Houses: (Survive 5 days + 2 CinderWalls + 1 FloorCelling)

*Build Large Houses: (Survive 8 days + 4 CinderWalls + 1 FloorCelling)

*Build Hero Hospital Tent : (Survive 2 days// PlayerHumanity+5000  // 2 WoodWalls + 1 FloorCelling)

//////////INCLUDED:

*Only 1 house per plot area restriction.

*Info Menu about requiere items and days survived in plot pole cursor target.

*Heal script for Hero Hospital Tent.

*Houses recognized as Maintein Class.

*Remove option only for owners (not tested on friends but it should work).

*Keep Same position after restart.

PICS:

 

/////////INSTALL:

*First at all you need a custom fn_selfActions.sqf, variables.sqf ,compiles.sqf

*And DZE_ click actions mod:

Spoiler

pick any

old

new

Spoiler

 

 

 

1- your custom fn_selfActions.sqf :

A:

Spoiler

Find:


if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {

bellow it add:


if (s_player_plotmenu < 0) then {
	s_player_plotmenu = player addAction ["<t color='#ff5200'>PLOT-INFO</t>", "custom\scripts\house\plotmenu.sqf", [], 5, false];
	};

 

B:

Spoiler

AGAIN FIND THE SAME:


if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {

BUT NOW ABOVE IT PLACE:


////////////////hospital hero///
if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "GUE_WarfareBFieldhHospital")) then {
if (s_player_hospitalhero < 0) then {
	s_player_hospitalhero = player addAction ["<t color='#ff5200'>Heal-in-Tent</t>", "custom\scripts\house\hospitalhero.sqf", [], 5, false];
	};
	} else {
	player removeAction s_player_hospitalhero;
    s_player_hospitalhero = -1;
	};
	///////////////////////////////////////////

 

***So step A & B must look like this:

Spoiler

////////////////hospital hero///
if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "GUE_WarfareBFieldhHospital")) then {
if (s_player_hospitalhero < 0) then {
    s_player_hospitalhero = player addAction ["<t color='#ff5200'>Heal-in-Tent</t>", "custom\scripts\house\hospitalhero.sqf", [], 5, false];
    };
    } else {
    player removeAction s_player_hospitalhero;
    s_player_hospitalhero = -1;
    };
    ///////////////////////////////////////////

    if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {
    if (s_player_plotmenu < 0) then {
    s_player_plotmenu = player addAction ["<t color='#ff5200'>PLOT-INFO</t>", "custom\scripts\house\plotmenu.sqf", [], 5, false];
    };

 

C:

Spoiler

Find lines in red and add lines in blue.

} else {
            player removeAction s_player_maintain_area;
            s_player_maintain_area = -1;
            player removeAction s_player_maintain_area_preview;
            s_player_maintain_area_preview = -1;

           player removeAction s_player_plotmenu;
           s_player_plotmenu = -1;

     };

D:

Spoiler

FIND: in

} else {
//Engineering

section:


{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];

Above it add:


player removeAction s_player_hospitalhero;
    s_player_hospitalhero = -1;
    player removeAction s_player_plotmenu;
    s_player_plotmenu = -1;

 

E:

Spoiler

Find


_isModular = _cursorTarget isKindOf "ModularItems";

Replace by


_isModular = (_cursorTarget isKindOf "ModularItems") or ((typeOf _cursorTarget) in DZE_SurvivedHouseRemove);

 

*Done with selfActions.sqf

2- Now in your Custom variables.sqf

A:

Spoiler

FIND:

dayz_allowedObjects = ["TentStorage","TentStorageDomed","TentStorageDomed2", "VaultStorageLocked", "Hedgehog_DZ", "Sandbag1_DZ","BagFenceRound_DZ","TrapBear","Fort_RazorWire","WoodGate_DZ","Land_HBarrier1_DZ","Land_HBarrier3_DZ","Land_HBarrier5_DZ","Fence_corrugated_DZ","M240Nest_DZ","CanvasHut_DZ","ParkBench_DZ","MetalGate_DZ","OutHouse_DZ","Wooden_shed_DZ","WoodShack_DZ","StorageShed_DZ","Plastic_Pole_EP1_DZ","Generator_DZ","StickFence_DZ","LightPole_DZ","FuelPump_DZ","DesertCamoNet_DZ","ForestCamoNet_DZ","DesertLargeCamoNet_DZ","ForestLargeCamoNet_DZ","SandNest_DZ","DeerStand_DZ","MetalPanel_DZ","WorkBench_DZ","WoodFloor_DZ","WoodLargeWall_DZ","WoodLargeWallDoor_DZ","WoodLargeWallWin_DZ","WoodSmallWall_DZ","WoodSmallWallWin_DZ","WoodSmallWallDoor_DZ","LockboxStorageLocked","WoodFloorHalf_DZ","WoodFloorQuarter_DZ","WoodStairs_DZ","WoodStairsSans_DZ","WoodStairsRails_DZ","WoodSmallWallThird_DZ","WoodLadder_DZ","Land_DZE_GarageWoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_WoodDoor","Land_DZE_GarageWoodDoorLocked","Land_DZE_LargeWoodDoorLocked","Land_DZE_WoodDoorLocked","CinderWallHalf_DZ","CinderWall_DZ","CinderWallDoorway_DZ","CinderWallDoor_DZ","CinderWallDoorLocked_DZ","CinderWallSmallDoorway_DZ","CinderWallDoorSmall_DZ","CinderWallDoorSmallLocked_DZ","MetalFloor_DZ","WoodRamp_DZ","GunRack_DZ","FireBarrel_DZ","WoodCrate_DZ","Scaffolding_DZ"];

 

REPLACE BY:

dayz_allowedObjects = ["GUE_WarfareBFieldhHospital","MAP_bouda2_vnitrek","MAP_deutshe_mini","MAP_Mil_Mil_Guardhouse","TentStorage","TentStorageDomed","TentStorageDomed2", "VaultStorageLocked", "Hedgehog_DZ", "Sandbag1_DZ","BagFenceRound_DZ","TrapBear","Fort_RazorWire","WoodGate_DZ","Land_HBarrier1_DZ","Land_HBarrier3_DZ","Land_HBarrier5_DZ","Fence_corrugated_DZ","M240Nest_DZ","CanvasHut_DZ","ParkBench_DZ","MetalGate_DZ","OutHouse_DZ","Wooden_shed_DZ","WoodShack_DZ","StorageShed_DZ","Plastic_Pole_EP1_DZ","Generator_DZ","StickFence_DZ","LightPole_DZ","FuelPump_DZ","DesertCamoNet_DZ","ForestCamoNet_DZ","DesertLargeCamoNet_DZ","ForestLargeCamoNet_DZ","SandNest_DZ","DeerStand_DZ","MetalPanel_DZ","WorkBench_DZ","WoodFloor_DZ","WoodLargeWall_DZ","WoodLargeWallDoor_DZ","WoodLargeWallWin_DZ","WoodSmallWall_DZ","WoodSmallWallWin_DZ","WoodSmallWallDoor_DZ","LockboxStorageLocked","WoodFloorHalf_DZ","WoodFloorQuarter_DZ","WoodStairs_DZ","WoodStairsSans_DZ","WoodStairsRails_DZ","WoodSmallWallThird_DZ","WoodLadder_DZ","Land_DZE_GarageWoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_WoodDoor","Land_DZE_GarageWoodDoorLocked","Land_DZE_LargeWoodDoorLocked","Land_DZE_WoodDoorLocked","CinderWallHalf_DZ","CinderWall_DZ","CinderWallDoorway_DZ","CinderWallDoor_DZ","CinderWallDoorLocked_DZ","CinderWallSmallDoorway_DZ","CinderWallDoorSmall_DZ","CinderWallDoorSmallLocked_DZ","MetalFloor_DZ","WoodRamp_DZ","GunRack_DZ","FireBarrel_DZ","WoodCrate_DZ","Scaffolding_DZ"];

AND ADD BELLOW:

DZE_SurvivedHouseRemove = ["GUE_WarfareBFieldhHospital","MAP_bouda2_vnitrek","MAP_deutshe_mini","MAP_Mil_Mil_Guardhouse"];

 

 

B:

Spoiler

FIND:

DZE_maintainClasses = ["ModularItems","DZE_Housebase","LightPole_DZ","BuiltItems","Plastic_Pole_EP1_DZ","Fence_corrugated_DZ","CanvasHut_DZ","ParkBench_DZ","MetalGate_DZ","StickFence_DZ","DesertCamoNet_DZ","ForestCamoNet_DZ","DesertLargeCamoNet_DZ","ForestLargeCamoNet_DZ","DeerStand_DZ","Scaffolding_DZ","FireBarrel_DZ"];

REPLACE BY:

DZE_maintainClasses = ["GUE_WarfareBFieldhHospital","MAP_bouda2_vnitrek","MAP_deutshe_mini","MAP_Mil_Mil_Guardhouse","ModularItems","DZE_Housebase","LightPole_DZ","BuiltItems","Plastic_Pole_EP1_DZ","Fence_corrugated_DZ","CanvasHut_DZ","ParkBench_DZ","MetalGate_DZ","StickFence_DZ","DesertCamoNet_DZ","ForestCamoNet_DZ","DesertLargeCamoNet_DZ","ForestLargeCamoNet_DZ","DeerStand_DZ","Scaffolding_DZ","FireBarrel_DZ"];

 

 

C:

Spoiler

FIND


dayz_resetSelfActions = {

Add Bellow


    s_player_plotmenu = -1;
    s_player_hospitalhero = -1;

 

3-Now in your Custom compiles.sqf

A:

Spoiler

Find:


player_removeObject =			compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\remove.sqf";

Replace with


player_removeObject =            compile preprocessFileLineNumbers "custom\scripts\house\remove.sqf";

 

 4- Extra_Rc.hpp if u use group management.

Spoiler

OPEN YOUR Extra_Rc.hpp and paste lines in blue if ure using group management

class ExtraRc {
  class ItemRadio {
     class GroupManagement {
        text = "Group Management";
        script = "execVM 'dzgm\loadGroupManagement.sqf'";
     };
  };

class ItemEtool {
     class shouse {
        text = "Small Houses";
        script = "execVM 'custom\scripts\house\smallhouse.sqf'";
     };    
     class mhouse {
        text = "Medium Houses";
        script = "execVM 'custom\scripts\house\mediumhouse.sqf'";
     };
     class lhouse {
        text = "Large Houses";
        script = "execVM 'custom\scripts\house\largehouse.sqf'";
     };
     class hhouse {
        text = "Hero House";
        script = "execVM 'custom\scripts\house\herohouse.sqf'";
     };
    };

};

 

 4- extra_rc.hpp if u DONT! use group management.

Spoiler

class ExtraRc {

class ItemEtool {
     class shouse {
        text = "Small Houses";
        script = "execVM 'custom\scripts\house\smallhouse.sqf'";
     };    
     class mhouse {
        text = "Medium Houses";
        script = "execVM 'custom\scripts\house\mediumhouse.sqf'";
     };
     class lhouse {
        text = "Large Houses";
        script = "execVM 'custom\scripts\house\largehouse.sqf'";
     };
     class hhouse {
        text = "Hero House";
        script = "execVM 'custom\scripts\house\herohouse.sqf'";
     };
    };

};

IF DONT HAVE Extra_rc.hpp  AND URE USING DEPLOY ANYTHING (Tnks @Cherdenko)

open your config.sqf in addons folder and add the lines in blue

Spoiler


//  DZE_CLICK_ACTIONS
//      This is where you register your right-click actions
//  FORMAT -- (no comma after last array entry)
//      [_classname,_text,_execute,_condition],
//  PARAMETERS
//  _classname  : the name of the class to click on
//                  (example = "ItemBloodbag")
//  _text       : the text for the option that is displayed when right clicking on the item
//                  (example = "Self Transfuse")
//  _execute    : compiled code to execute when the option is selected
//                  (example = "execVM 'my\scripts\self_transfuse.sqf';")
//  _condition  : compiled code evaluated to determine whether or not the option is displayed
//                  (example = {true})
//  EXAMPLE -- see below for some simple examples
DZE_CLICK_ACTIONS = [
    ["ItemGPS","Scan Nearby","if(isNil 'DZE_CLICK_ACTIONS_GPS_RANGE') then {DZE_CLICK_ACTIONS_GPS_RANGE = 1500;};DZE_CLICK_ACTIONS_ZOMBIE_COUNT = count ((position player) nearEntities ['zZombie_Base',DZE_CLICK_ACTIONS_GPS_RANGE]); DZE_CLICK_ACTIONS_MAN_COUNT = count ((position player) nearEntities ['CAManBase',DZE_CLICK_ACTIONS_GPS_RANGE]);cutText[format['Within %1 Meters: %2 AI/players, %3 zombies, %4 vehicles',DZE_CLICK_ACTIONS_GPS_RANGE,DZE_CLICK_ACTIONS_MAN_COUNT - DZE_CLICK_ACTIONS_ZOMBIE_COUNT,count ((position player) nearEntities ['zZombie_Base',DZE_CLICK_ACTIONS_GPS_RANGE]),count ((position player) nearEntities ['allVehicles',DZE_CLICK_ACTIONS_GPS_RANGE]) - DZE_CLICK_ACTIONS_MAN_COUNT],'PLAIN DOWN'];","true"],
    ["ItemGPS","Range Up"   ,"if(isNil 'DZE_CLICK_ACTIONS_GPS_RANGE') then {DZE_CLICK_ACTIONS_GPS_RANGE = 1500;};DZE_CLICK_ACTIONS_GPS_RANGE = (DZE_CLICK_ACTIONS_GPS_RANGE + 100) min 2500; cutText[format['GPS RANGE: %1',DZE_CLICK_ACTIONS_GPS_RANGE],'PLAIN DOWN'];","true"],
    ["ItemGPS","Range Down" ,"if(isNil 'DZE_CLICK_ACTIONS_GPS_RANGE') then {DZE_CLICK_ACTIONS_GPS_RANGE = 1500;};DZE_CLICK_ACTIONS_GPS_RANGE = (DZE_CLICK_ACTIONS_GPS_RANGE - 100) max 1000;  cutText[format['GPS RANGE: %1',DZE_CLICK_ACTIONS_GPS_RANGE],'PLAIN DOWN'];","true"],
    ["ItemGPS","Toggle Map Marker","execVM 'overwrites\click_actions\examples\marker.sqf';","true"],
    ["ItemMap","Toggle Map Marker","execVM 'overwrites\click_actions\examples\marker.sqf';","true"], // <- Dont forget to add a comma here or else it won´t work
  /////////// Here starts the segment for the houses
    ["ItemEtool","Small House","execVM 'custom\scripts\house\smallhouse.sqf';","true"],
    ["ItemEtool","Medium Houses","execVM 'custom\scripts\house\mediumhouse.sqf';","true"],
    ["ItemEtool","Large Houses","execVM 'custom\scripts\house\largehouse.sqf';","true"],
    ["ItemEtool","Hero House","execVM 'custom\scripts\house\herohouse.sqf';","true"] // also be sure that there´s no comma after this line, else script will be broken

];

**** download all sqf from here: http://www.mediafire.com/download/orbkco94qn9s4vp/crafthuouses.zip    (FIXED)

 

////////IF U DOWNLOAD THE FILE YOU DONT NEED NOTHING MORE, JUST PLACE  "custom" download folder into  "Mpmissions\your instance\" ////////////////////////////

 

 

***IF DOWNLOAD LINK IS DEAD THEN:

5-Create the sqf´s and folders.

A: FOLDERS

Spoiler

*First into your "Mpmissions\your instance\"   create a folder called  "custom" create inside "scripts" folder and into it "house"

so path must me  "Mpmissions/your instance/ custom/ scripts/house/"

 

SQFS (drop all sqf into "Mpmissions/your instance/ custom/ scripts/house/" )

 

Spoiler

smallhouse.sqf

Spoiler

private ["_playerPos","_nearhouse","_Playersurvived","_inventory","_hasitem1","_Playersurvived","_removed","_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","_objHupDiff","_needNear","_vehicle","_inVehicle","_requireplot","_objHDiff","_isLandFireDZ","_isTankTrap"];
 
//VARIABLES
_inventory = items player;
_hasitem1 = [["ItemWoodWall",4], "ItemWoodFloor"] call player_checkItems;
_Playersurvived = dayz_Survived;

if (_Playersurvived < 2) exitWith {
[format["<t align='center' size='0.75' color='#FFCC00'>>not yet! you have %1 days survived. and needs almost 2 days</t>",_Playersurvived],0,0,2,2] spawn BIS_fnc_dynamicText;
};

if (_Playersurvived > 2) then {
[format["<t align='center' size='0.75' color='#FFCC00'>>You learn build Small Houses.%1</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;  

 


////////////////////////FIND NEAREST HOUSES AND PREVENT ANOTHER BUILD
_playerPos = getPosATL player;
_nearhouse = count nearestObjects [_playerPos, ["MAP_deutshe_mini","MAP_Mil_Mil_Guardhouse","MAP_bouda2_vnitrek"], 45] > 0;
 
if (_nearhouse) exitWith {
    [format["<t align='center' size='0.75' color='#ff5200'>%1 You cannot build another house in this plot area.</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;
        };

/////////////////////////////////////////////     

//CHECK ITEMS ///

if (!_hasitem1) exitWith {cutText
[format["Needs 4xItemWoodWall and 1xFloorCelling4/4"], "PLAIN DOWN"];};
//////////////////////////


//Proceed if check succes
if (_hasitem1) then {

 

 

// objet class
 
_classname = "MAP_bouda2_vnitrek";
 
//objet class
 
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_checkNearbyRadius]);
 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);
 
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;
_distance = 3;
_reason = "";
 
 
if(_abort) exitWith {
cutText [format[(localize "str_epoch_player_135"),_reason,_distance], "PLAIN DOWN"];
DZE_ActionInProgress = false;
};
 

_classnametmp = _classname;
_require =  getArray (configFile >> "ItemHemp" >> _this >> "ItemActions" >> "Build" >> "require");
_text =  getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
 
_lockable = 0;
 
_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,7,2];
};
 
_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];
};
} foreach _findNearestPoles;
 
_IsNearPlot = count (_findNearestPole);
 
// If item is plot pole and another one exists within 45m
if(_isPole and _IsNearPlot > 0) exitWith {  DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_44") , "PLAIN DOWN"]; };
 
if(_IsNearPlot == 0) then {
 
// Allow building of plot
_canBuildOnPlot = false;
 
} else {
// Since there are plots nearby we check for ownership and then for friend status
 
// check nearby plots ownership and 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
_canBuildOnPlot = false;
};
};
 
// _message
if(!_canBuildOnPlot) exitWith {  DZE_ActionInProgress = false; cutText [format["Thers a plot in here or needs a plot"], "PLAIN DOWN",3]; };
 
_missing = "";
 
_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;
 
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;
};
if (DZE_6) then {
_rotate = true;
DZE_6 = false;
_dir = 45;
};
 
if (DZE_F and _canDo) then {    
            if (helperDetach) then {
                _objectHelperDir = getDir _objectHelper;
                _objectHelper attachTo [player];
                _objectHelper setDir _objectHelperDir-(getDir player);
                helperDetach = false;
            } else {
                _objectHelperDir = getDir _objectHelper;
                detach _objectHelper;
                [_objectHelper]    call FNC_GetSetPos;
                _objectHelper setVelocity [0,0,0]; //fix sliding glitch
                helperDetach = true;
            };
            DZE_F = false;
        };
 
if(_rotate) then {
            if (helperDetach) then {
                _objectHelperDir = getDir _objectHelper;
                _objectHelper setDir _objectHelperDir+_dir;
                [_objectHelper]    call FNC_GetSetPos;
            } else {
                detach _objectHelper;
                _objectHelperDir = getDir _objectHelper;
                _objectHelper setDir _objectHelperDir+_dir;
                [_objectHelper]    call FNC_GetSetPos;
                _objectHelperDir = getDir _objectHelper;
                _objectHelper attachTo [player];
                _objectHelper setDir _objectHelperDir-(getDir player);        
            };

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

        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;
            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;
        };
    };
 
//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"];
 
_tmpbuilt setdir _dir;
 
// Get position based on object
_location = _position;
 
if((_isAllowedUnderGround == 0) and ((_location select 2) < 0)) then {
_location set [2,0];
};
 
_tmpbuilt setPosATL _location;
 
 
cutText [format[(localize "str_epoch_player_138"),_text], "PLAIN DOWN"];
 
_limit = 1;
 
if (DZE_StaticConstructionCount > 0) then {
_limit = DZE_StaticConstructionCount;
}
else {
if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
_limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
};
};
 
player playActionNow "Medic";
[player,"repair",0,false,10] call dayz_zombieSpeak;
[player,10,true,(getPosATL player)] spawn player_alertZombies;
sleep 3;
_removed = [["CinderBlocks",2], "PartWoodLumber"] call player_removeItems;
cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
 
if (_isPole) then {
[] spawn player_plotPreview;
};
 
_tmpbuilt setVariable ["OEMPos",_location,true];
 
_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
 
_charID = dayz_characterID;
_activatingPlayer = player;
 
PVDZE_veh_Publish = [_tmpbuilt,[_dir,_location],_classname,true,_charid,_activatingPlayer];
publicVariableServer  "PVDZE_veh_Publish";
 
// MESSAGE HERE///////////////
[format["<t align='center' size='0.50' color='#FFCC00'>>Nice! A Small House Survivor!<</t>",_Playersurvived],0,0,2,2] spawn BIS_fnc_dynamicText;  
//cutText [format["Nice House Survivor!"], "PLAIN DOWN",3];
 
////////////////////////////////////////////
 
player reveal _tmpbuilt;
DZE_ActionInProgress = false;
 
} else {
cutText [format[(localize "str_epoch_player_47"),_text,_reason], "PLAIN DOWN"];
DZE_ActionInProgress = false;
};
 
DZE_ActionInProgress = false;

};
};

 

mediumhouse.sqf

Spoiler

private ["_playerPos","_nearhouse","_Playersurvived","_inventory","_hasitem1","_Playersurvived","_removed","_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","_objHupDiff","_needNear","_vehicle","_inVehicle","_requireplot","_objHDiff","_isLandFireDZ","_isTankTrap"];
 
//VARIABLES
_inventory = items player;
_hasitem1 = [["cinder_wall_kit",2], "ItemWoodFloor"] call player_checkItems;
_Playersurvived = dayz_Survived;

if (_Playersurvived < 5) exitWith {
[format["<t align='center' size='0.75' color='#FFCC00'>>not yet! you have %1 days survived. and needs almost 5 days</t>",_Playersurvived],0,0,2,2] spawn BIS_fnc_dynamicText;
};

if (_Playersurvived > 5) then {
[format["<t align='center' size='0.75' color='#FFCC00'>>You learn build Medium Houses.%1</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;  


////////////////////////FIND NEAREST HOUSES AND PREVENT ANOTHER BUILD

_playerPos = getPosATL player;
_nearhouse = count nearestObjects [_playerPos, ["MAP_deutshe_mini","MAP_Mil_Mil_Guardhouse","MAP_bouda2_vnitrek"], 45] > 0;
 
if (_nearhouse) exitWith {
    [format["<t align='center' size='0.75' color='#ff5200'>%1 You cannot build another house in this plot area.</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;
        };
///////////////////////////////////////////////////////////////

//CHECK ITEMS ///

if (!_hasitem1) exitWith {cutText
[format["Needs 2xCinder_walls and 1xFloorCelling4/4"], "PLAIN DOWN"];};
//////////////////////////


//Proceed if check succes
if (_hasitem1) then {

 

 

// objet class
 
_classname = "MAP_Mil_Mil_Guardhouse";
 
//objet class
 
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_checkNearbyRadius]);
 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);
 
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;
_distance = 3;
_reason = "";
 
 
if(_abort) exitWith {
cutText [format[(localize "str_epoch_player_135"),_reason,_distance], "PLAIN DOWN"];
DZE_ActionInProgress = false;
};
 

_classnametmp = _classname;
_require =  getArray (configFile >> "ItemHemp" >> _this >> "ItemActions" >> "Build" >> "require");
_text =  getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
 
_lockable = 0;
 
_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,10,2];
};
 
_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];
};
} foreach _findNearestPoles;
 
_IsNearPlot = count (_findNearestPole);
 
// If item is plot pole and another one exists within 45m
if(_isPole and _IsNearPlot > 0) exitWith {  DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_44") , "PLAIN DOWN"]; };
 
if(_IsNearPlot == 0) then {
 
// Allow building of plot
_canBuildOnPlot = false;
 
} else {
// Since there are plots nearby we check for ownership and then for friend status
 
// check nearby plots ownership and 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
_canBuildOnPlot = false;
};
};
 
// _message
if(!_canBuildOnPlot) exitWith {  DZE_ActionInProgress = false; cutText [format["Thers a plot in here or needs a plot"], "PLAIN DOWN",3]; };
 
_missing = "";
 
_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;
 
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;
};
if (DZE_6) then {
_rotate = true;
DZE_6 = false;
_dir = 45;
};
 
if (DZE_F and _canDo) then {    
            if (helperDetach) then {
                _objectHelperDir = getDir _objectHelper;
                _objectHelper attachTo [player];
                _objectHelper setDir _objectHelperDir-(getDir player);
                helperDetach = false;
            } else {
                _objectHelperDir = getDir _objectHelper;
                detach _objectHelper;
                [_objectHelper]    call FNC_GetSetPos;
                _objectHelper setVelocity [0,0,0]; //fix sliding glitch
                helperDetach = true;
            };
            DZE_F = false;
        };
 
if(_rotate) then {
            if (helperDetach) then {
                _objectHelperDir = getDir _objectHelper;
                _objectHelper setDir _objectHelperDir+_dir;
                [_objectHelper]    call FNC_GetSetPos;
            } else {
                detach _objectHelper;
                _objectHelperDir = getDir _objectHelper;
                _objectHelper setDir _objectHelperDir+_dir;
                [_objectHelper]    call FNC_GetSetPos;
                _objectHelperDir = getDir _objectHelper;
                _objectHelper attachTo [player];
                _objectHelper setDir _objectHelperDir-(getDir player);        
            };

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

        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;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };
 
if(_location1 distance _location2 > 15) 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 > 15) 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;
        };
    };
 
//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"];
 
_tmpbuilt setdir _dir;
 
// Get position based on object
_location = _position;
 
if((_isAllowedUnderGround == 0) and ((_location select 2) < 0)) then {
_location set [2,0];
};
 
_tmpbuilt setPosATL _location;
 
 
cutText [format[(localize "str_epoch_player_138"),_text], "PLAIN DOWN"];
 
_limit = 1;
 
if (DZE_StaticConstructionCount > 0) then {
_limit = DZE_StaticConstructionCount;
}
else {
if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
_limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
};
};
 
player playActionNow "Medic";
[player,"repair",0,false,10] call dayz_zombieSpeak;
[player,10,true,(getPosATL player)] spawn player_alertZombies;
sleep 3;
_removed = [["CinderBlocks",2], "PartWoodLumber"] call player_removeItems;
cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
 
if (_isPole) then {
[] spawn player_plotPreview;
};
 
_tmpbuilt setVariable ["OEMPos",_location,true];
 
_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
 
_charID = dayz_characterID;
_activatingPlayer = player;
 
PVDZE_veh_Publish = [_tmpbuilt,[_dir,_location],_classname,true,_charid,_activatingPlayer];
publicVariableServer  "PVDZE_veh_Publish";
 
// MESSAGE HERE///////////////
[format["<t align='center' size='0.50' color='#FFCC00'>>Nice! A Medium House Survivor!<</t>",_Playersurvived],0,0,2,2] spawn BIS_fnc_dynamicText;  
//cutText [format["Nice House Survivor!"], "PLAIN DOWN",3];
 
////////////////////////////////////////////
 
player reveal _tmpbuilt;
DZE_ActionInProgress = false;
 
} else {
cutText [format[(localize "str_epoch_player_47"),_text,_reason], "PLAIN DOWN"];
DZE_ActionInProgress = false;
};
 
DZE_ActionInProgress = false;

};
};

largehouse.sqf

Spoiler

private ["_playerPos","_nearhouse","_Playersurvived","_inventory","_hasitem1","_Playersurvived","_removed","_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","_objHupDiff","_needNear","_vehicle","_inVehicle","_requireplot","_objHDiff","_isLandFireDZ","_isTankTrap"];
 
//VARIABLES
_inventory = items player;
_hasitem1 = [["cinder_wall_kit",4], "ItemWoodFloor"] call player_checkItems;
_Playersurvived = dayz_Survived;

if (_Playersurvived < 8) exitWith {
[format["<t align='center' size='0.75' color='#FFCC00'>>not yet! you have %1 days survived. and needs almost 8 days</t>",_Playersurvived],0,0,2,2] spawn BIS_fnc_dynamicText;
};

if (_Playersurvived > 8) then {
[format["<t align='center' size='0.75' color='#FFCC00'>>You learn build Large Houses.%1</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;  


////////////////////////FIND NEAREST HOUSES AND PREVENT ANOTHER BUILD
_playerPos = getPosATL player;
_nearhouse = count nearestObjects [_playerPos, ["MAP_deutshe_mini","MAP_Mil_Mil_Guardhouse","MAP_bouda2_vnitrek"], 45] > 0;
 
if (_nearhouse) exitWith {
    [format["<t align='center' size='0.75' color='#ff5200'>%1 You cannot build another house in this plot area.</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;
        };
//////////////////////////////////////////////////////////////////////
//CHECK ITEMS ///

if (!_hasitem1) exitWith {cutText
[format["Needs 4xCinder_wall and 1xFloorCelling4/4"], "PLAIN DOWN"];};
//////////////////////////


//Proceed if check succes
if (_hasitem1) then {

 

 

// objet class
 
_classname = "MAP_deutshe_mini";
 
//objet class
 
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_checkNearbyRadius]);
 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);
 
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;
_distance = 3;
_reason = "";
 
 
if(_abort) exitWith {
cutText [format[(localize "str_epoch_player_135"),_reason,_distance], "PLAIN DOWN"];
DZE_ActionInProgress = false;
};
 

_classnametmp = _classname;
_require =  getArray (configFile >> "ItemHemp" >> _this >> "ItemActions" >> "Build" >> "require");
_text =  getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
 
_lockable = 0;
 
_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,8,2];
};
 
_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];
};
} foreach _findNearestPoles;
 
_IsNearPlot = count (_findNearestPole);
 
// If item is plot pole and another one exists within 45m
if(_isPole and _IsNearPlot > 0) exitWith {  DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_44") , "PLAIN DOWN"]; };
 
if(_IsNearPlot == 0) then {
 
// Allow building of plot
_canBuildOnPlot = false;
 
} else {
// Since there are plots nearby we check for ownership and then for friend status
 
// check nearby plots ownership and 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
_canBuildOnPlot = false;
};
};
 
// _message
if(!_canBuildOnPlot) exitWith {  DZE_ActionInProgress = false; cutText [format["Thers a plot in here or needs a plot"], "PLAIN DOWN",3]; };
 
_missing = "";
 
_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;
 
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;
};
if (DZE_6) then {
_rotate = true;
DZE_6 = false;
_dir = 45;
};
 
if (DZE_F and _canDo) then {    
            if (helperDetach) then {
                _objectHelperDir = getDir _objectHelper;
                _objectHelper attachTo [player];
                _objectHelper setDir _objectHelperDir-(getDir player);
                helperDetach = false;
            } else {
                _objectHelperDir = getDir _objectHelper;
                detach _objectHelper;
                [_objectHelper]    call FNC_GetSetPos;
                _objectHelper setVelocity [0,0,0]; //fix sliding glitch
                helperDetach = true;
            };
            DZE_F = false;
        };
 
if(_rotate) then {
            if (helperDetach) then {
                _objectHelperDir = getDir _objectHelper;
                _objectHelper setDir _objectHelperDir+_dir;
                [_objectHelper]    call FNC_GetSetPos;
            } else {
                detach _objectHelper;
                _objectHelperDir = getDir _objectHelper;
                _objectHelper setDir _objectHelperDir+_dir;
                [_objectHelper]    call FNC_GetSetPos;
                _objectHelperDir = getDir _objectHelper;
                _objectHelper attachTo [player];
                _objectHelper setDir _objectHelperDir-(getDir player);        
            };

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

        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;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };
 
if(_location1 distance _location2 > 15) 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 > 15) 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;
        };
    };
 
//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"];
 
_tmpbuilt setdir _dir;
 
// Get position based on object
_location = _position;
 
if((_isAllowedUnderGround == 0) and ((_location select 2) < 0)) then {
_location set [2,0];
};
 
_tmpbuilt setPosATL _location;
 
 
cutText [format[(localize "str_epoch_player_138"),_text], "PLAIN DOWN"];
 
_limit = 1;
 
if (DZE_StaticConstructionCount > 0) then {
_limit = DZE_StaticConstructionCount;
}
else {
if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
_limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
};
};
 
player playActionNow "Medic";
[player,"repair",0,false,10] call dayz_zombieSpeak;
[player,10,true,(getPosATL player)] spawn player_alertZombies;
sleep 3;
_removed = [["CinderBlocks",2], "PartWoodLumber"] call player_removeItems;
cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
 
if (_isPole) then {
[] spawn player_plotPreview;
};
 
_tmpbuilt setVariable ["OEMPos",_location,true];
 
_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
 
_charID = dayz_characterID;
_activatingPlayer = player;
 
PVDZE_veh_Publish = [_tmpbuilt,[_dir,_location],_classname,true,_charid,_activatingPlayer];
publicVariableServer  "PVDZE_veh_Publish";
 
// MESSAGE HERE///////////////
[format["<t align='center' size='0.50' color='#FFCC00'>>Nice! A Large House Survivor!<</t>",_Playersurvived],0,0,2,2] spawn BIS_fnc_dynamicText;  
//cutText [format["Nice House Survivor!"], "PLAIN DOWN",3];
 
////////////////////////////////////////////
 
player reveal _tmpbuilt;
DZE_ActionInProgress = false;
 
} else {
cutText [format[(localize "str_epoch_player_47"),_text,_reason], "PLAIN DOWN"];
DZE_ActionInProgress = false;
};
 
DZE_ActionInProgress = false;

};
};

herohouse.sqf

Spoiler

private ["_playerPos","_nearhouse","_Playersurvived","_inventory","_hasitem1","_Playersurvived","_removed","_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","_objHupDiff","_needNear","_vehicle","_inVehicle","_requireplot","_objHDiff","_isLandFireDZ","_isTankTrap"];
 
//VARIABLES
_inventory = items player;
_hasitem1 = [["cinder_wall_kit",2], "ItemWoodFloor"] call player_checkItems;
_Playersurvived = dayz_Survived;
PlayerHumanity = (player getVariable"humanity");

if (_Playersurvived < 2) exitWith {
[format["<t align='center' size='0.75' color='#FFCC00'>>not yet! you have %1 days survived. and needs almost 2 days Hero</t>",_Playersurvived],0,0,2,2] spawn BIS_fnc_dynamicText;

};

if (PlayerHumanity < 5000) exitWith {
cutText [format["Need be a hero"], "PLAIN DOWN"];};

if (_Playersurvived > 2) then {
[format["<t align='center' size='0.75' color='#FFCC00'>>You learn build Hero hospital tents.%1</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;  

 


PlayerHumanity = (player getVariable"humanity");
if (PlayerHumanity > 5000) then {

////////////////////////FIND NEAREST HOUSES AND PREVENT ANOTHER BUILD

_playerPos = getPosATL player;
_nearhouse = count nearestObjects [_playerPos, ["GUE_WarfareBFieldhHospital"], 45] > 0;
 
if (_nearhouse) exitWith {
    [format["<t align='center' size='0.75' color='#ff5200'>%1 You cannot build another hospital tents in this plot area.</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;
        };
///////////////////////////////////////////////////////////////


//CHECK ITEMS ///

if (!_hasitem1) exitWith {cutText
[format["Needs 2xCinder_wall and 1xFloorCelling4/4"], "PLAIN DOWN"];};
//////////////////////////


//Proceed if check succes
if (_hasitem1) then {

 

 

// objet class
 
_classname = "GUE_WarfareBFieldhHospital";
 
//objet class
 
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_checkNearbyRadius]);
 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);
 
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;
_distance = 3;
_reason = "";
 
 
if(_abort) exitWith {
cutText [format[(localize "str_epoch_player_135"),_reason,_distance], "PLAIN DOWN"];
DZE_ActionInProgress = false;
};
 

_classnametmp = _classname;
_require =  getArray (configFile >> "ItemHemp" >> _this >> "ItemActions" >> "Build" >> "require");
_text =  getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
 
_lockable = 0;
 
_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,10,2];
};
 
_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];
};
} foreach _findNearestPoles;
 
_IsNearPlot = count (_findNearestPole);
 
// If item is plot pole and another one exists within 45m
if(_isPole and _IsNearPlot > 0) exitWith {  DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_44") , "PLAIN DOWN"]; };
 
if(_IsNearPlot == 0) then {
 
// Allow building of plot
_canBuildOnPlot = false;
 
} else {
// Since there are plots nearby we check for ownership and then for friend status
 
// check nearby plots ownership and 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
_canBuildOnPlot = false;
};
};
 
// _message
if(!_canBuildOnPlot) exitWith {  DZE_ActionInProgress = false; cutText [format["Thers a plot in here or needs a plot"], "PLAIN DOWN",3]; };
 
_missing = "";
 
_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;
 
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;
};
if (DZE_6) then {
_rotate = true;
DZE_6 = false;
_dir = 45;
};
 
if (DZE_F and _canDo) then {    
            if (helperDetach) then {
                _objectHelperDir = getDir _objectHelper;
                _objectHelper attachTo [player];
                _objectHelper setDir _objectHelperDir-(getDir player);
                helperDetach = false;
            } else {
                _objectHelperDir = getDir _objectHelper;
                detach _objectHelper;
                [_objectHelper]    call FNC_GetSetPos;
                _objectHelper setVelocity [0,0,0]; //fix sliding glitch
                helperDetach = true;
            };
            DZE_F = false;
        };
 
if(_rotate) then {
            if (helperDetach) then {
                _objectHelperDir = getDir _objectHelper;
                _objectHelper setDir _objectHelperDir+_dir;
                [_objectHelper]    call FNC_GetSetPos;
            } else {
                detach _objectHelper;
                _objectHelperDir = getDir _objectHelper;
                _objectHelper setDir _objectHelperDir+_dir;
                [_objectHelper]    call FNC_GetSetPos;
                _objectHelperDir = getDir _objectHelper;
                _objectHelper attachTo [player];
                _objectHelper setDir _objectHelperDir-(getDir player);        
            };

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

        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;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };
 
if(_location1 distance _location2 > 15) 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 > 15) 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;
        };
    };
 
//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"];
 
_tmpbuilt setdir _dir;
 
// Get position based on object
_location = _position;
 
if((_isAllowedUnderGround == 0) and ((_location select 2) < 0)) then {
_location set [2,0];
};
 
_tmpbuilt setPosATL _location;
 
 
cutText [format[(localize "str_epoch_player_138"),_text], "PLAIN DOWN"];
 
_limit = 1;
 
if (DZE_StaticConstructionCount > 0) then {
_limit = DZE_StaticConstructionCount;
}
else {
if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
_limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
};
};
 
player playActionNow "Medic";
[player,"repair",0,false,10] call dayz_zombieSpeak;
[player,10,true,(getPosATL player)] spawn player_alertZombies;
sleep 3;
_removed = [["CinderBlocks",2], "PartWoodLumber"] call player_removeItems;
cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
 
if (_isPole) then {
[] spawn player_plotPreview;
};
 
_tmpbuilt setVariable ["OEMPos",_location,true];
 
_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
 
_charID = dayz_characterID;
_activatingPlayer = player;
 
PVDZE_veh_Publish = [_tmpbuilt,[_dir,_location],_classname,true,_charid,_activatingPlayer];
publicVariableServer  "PVDZE_veh_Publish";
 
// MESSAGE HERE///////////////
[format["<t align='center' size='0.50' color='#FFCC00'>>Nice one Hero!<</t>",_Playersurvived],0,0,2,2] spawn BIS_fnc_dynamicText;  
//cutText [format["Nice House Survivor!"], "PLAIN DOWN",3];
 
////////////////////////////////////////////
 
player reveal _tmpbuilt;
DZE_ActionInProgress = false;
 
} else {
cutText [format[(localize "str_epoch_player_47"),_text,_reason], "PLAIN DOWN"];
DZE_ActionInProgress = false;
};
 
DZE_ActionInProgress = false;

};
};
};

hospitalhero.sqf

Spoiler

disableSerialization;
                                dayz_sourceBleeding = objNull;
                                r_player_blood = r_player_bloodTotal;
                                r_player_inpain = false;
                                r_player_infected = false;
                                r_player_injured = false;
                                dayz_hunger = 0;
                                dayz_thirst = 0;
                                dayz_temperatur = 37;
                                r_fracture_legs = false;
                                r_fracture_arms = false;
                                r_player_dead = false;
                                r_player_unconscious = false;
                                r_player_loaded = false;
                                r_player_cardiac = false;
                                r_player_lowblood = false;
                                r_player_timeout = 0;
                                r_handlercount = 0;
                                r_interrupt = false;
                                r_doLoop = false;
                                r_drag_sqf = false;
                                r_self = false;
                                r_action = false;
                                r_action_unload = false;
                                r_player_handler = false;
                                r_player_handler1 = false;
                                disableUserInput false;
                                'dynamicBlur' ppEffectAdjust [0];
                                'dynamicBlur' ppEffectCommit 5;
                                _selection = 'legs';
                                _damage = 0;
                                player setHit[_selection,_damage];
                                player setVariable['messing',[dayz_hunger,dayz_thirst],true];
                                player setVariable['NORRN_unconscious',false,true];
                                player setVariable['USEC_infected',false,true];
                                player setVariable['USEC_injured',false,true];
                                player setVariable['USEC_inPain',false,true];
                                player setVariable['USEC_isCardiac',false,true];
                                player setVariable['USEC_lowBlood',false,true];
                                player setVariable['USEC_BloodQty',12000,true];
                                player setVariable['unconsciousTime',0,true];
                                player setVariable['hit_legs',0,true];
                                player setVariable['hit_hands',0,true];
                                player setVariable['medForceUpdate',true,true];
                                _display = uiNameSpace getVariable 'DAYZ_GUI_display';
                                _control = _display displayCtrl 1303;
                                _control ctrlShow false;
                                _display = uiNameSpace getVariable 'DAYZ_GUI_display';
                                _control = _display displayCtrl 1203;
                                _control ctrlShow false;
                                player setdamage 0;
                                0 fadeSound 1;
                                resetCamShake;

remove.sqf

Spoiler

/*
delete object from db with extra waiting by [VB]AWOL
parameters: _obj
*/
private ["_activatingPlayer","_obj","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_isOk","_proceed","_counter","_limit","_objType","_sfx","_dis","_itemOut","_countOut","_selectedRemoveOutput","_friendlies","_nearestPole","_ownerID","_refundpart","_isWreck","_findNearestPoles","_findNearestPole","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_radius","_isWreckBuilding","_nameVehicle","_isModular","_is_Removable","_isallowedremove"];

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

player removeAction s_player_deleteBuild;
s_player_deleteBuild = 1;

_obj = _this select 3;

_activatingPlayer = player;

_objOwnerID = _obj getVariable["CharacterID","0"];
_isOwnerOfObj = (_objOwnerID == dayz_characterID);

if (_obj in DZE_DoorsLocked) exitWith { DZE_ActionInProgress = false; cutText [(localize "STR_EPOCH_ACTIONS_20"), "PLAIN DOWN"];};
if(_obj getVariable ["GeneratorRunning", false]) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_89"), "PLAIN DOWN"];};

_objectID     = _obj getVariable ["ObjectID","0"];
_objectUID    = _obj getVariable ["ObjectUID","0"];

_isOk = true;
_proceed = false;
_objType = typeOf _obj;
_isallowedremove = false;

// Chance to break tools
_isDestructable = _obj isKindOf "BuiltItems";
_isWreck = _objType in DZE_isWreck;
_isRemovable = _objType in DZE_isRemovable;
_isWreckBuilding = _objType in DZE_isWreckBuilding;
_isMine = _objType in ["Land_iron_vein_wreck","Land_silver_vein_wreck","Land_gold_vein_wreck"];
_isModular = _obj isKindOf "ModularItems";
_is_Removable = _objType in DZE_SurvivedHouseRemove;

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

_findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], 30];
_findNearestPole = [];
{if (alive _x) then {_findNearestPole set [(count _findNearestPole),_x];};} count _findNearestPoles;

_IsNearPlot = count (_findNearestPole);

if(_IsNearPlot >= 1) then {

    _nearestPole = _findNearestPole select 0;

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

    // check if friendly to owner
    if(dayz_characterID != _ownerID) then {

        _friendlies        = player getVariable ["friendlyTo",[]];
        // check if friendly to owner
        if(!(_ownerID in _friendlies)) then {
            _limit = round(_limit*2);
        };
    };
};

_nameVehicle = getText(configFile >> "CfgVehicles" >> _objType >> "displayName");
if (!_isallowedremove && _is_Removable) exitWith {DZE_ActionInProgress = false; cutText [format["You are not allowed to remove this object (%1)",_nameVehicle], "PLAIN DOWN"]; }; //maybe change the text to your liking

cutText [format[(localize "str_epoch_player_162"),_nameVehicle], "PLAIN DOWN"];

if (_isModular) then {
     //allow previous cutText to show, then show this if modular.
     cutText [(localize "STR_EPOCH_ACTIONS_21"), "PLAIN DOWN"];
};

// Alert zombies once.
[player,50,true,(getPosATL player)] spawn player_alertZombies;

_brokenTool = false;

// Start de-construction loop
_counter = 0;
while {_isOk} do {

    // if object no longer exits this should return true.
    if(isNull(_obj)) exitWith {
        _isOk = false;
        _proceed = false;
    };
    [1,1] call dayz_HungerThirst;
    player playActionNow "Medic";
    _dis=20;
    [player,_dis,true,(getPosATL player)] spawn player_alertZombies;

    r_interrupt = false;
    _animState = animationState player;
    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;
            _sfx = "repair";
            [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
        };
        if (r_interrupt) then {
            r_doLoop = false;
        };

        sleep 0.1;

    };

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

    if(_finished) then {
        _counter = _counter + 1;
        // 10% chance to break a required tool each pass
        if((_isDestructable || _isRemovable) && !_isOwnerOfObj) then {
            if((random 10) <= 1) then {
                _brokenTool = true;
            };
        };
    };
    if(_brokenTool) exitWith {
        _isOk = false;
        _proceed = false;
    };

    cutText [format[(localize "str_epoch_player_163"), _nameVehicle, _counter,_limit], "PLAIN DOWN"];

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

};

 

if(_brokenTool) then {
    if(_isWreck) then {
        _removeTool = "ItemToolbox";
    } else {
        _removeTool = ["ItemCrowbar","ItemToolbox"] call BIS_fnc_selectRandom;
    };
    if(([player,_removeTool,1] call BIS_fnc_invRemove) > 0) then {
        cutText [format[(localize "str_epoch_player_164"),getText(configFile >> "CfgWeapons" >> _removeTool >> "displayName"),_nameVehicle], "PLAIN DOWN"];
    };
};

// Remove only if player waited
if (_proceed) then {

    // Double check that object is not null
    if(!isNull(_obj)) then {

        _ipos = getPosATL _obj;

        deleteVehicle _obj;

        if(!_isWreck) then {
            PVDZE_obj_Delete = [_objectID,_objectUID,_activatingPlayer];
            publicVariableServer "PVDZE_obj_Delete";
        };

        cutText [format[(localize "str_epoch_player_165"),_nameVehicle], "PLAIN DOWN"];

        _preventRefund = false;

        _selectedRemoveOutput = [];
        if(_isWreck) then {
            // Find one random part to give back
            _refundpart = ["PartEngine","PartGeneric","PartFueltank","PartWheel","PartGlass","ItemJerrycan"] call BIS_fnc_selectRandom;
            _selectedRemoveOutput set [count _selectedRemoveOutput,[_refundpart,1]];
        } else {
            if(_isWreckBuilding) then {
                _selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput");
            } else {
                _selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput");
                _preventRefund = (_objectID == "0" && _objectUID == "0");

            };
        };

        if((count _selectedRemoveOutput) <= 0) then {
            cutText [(localize "str_epoch_player_90"), "PLAIN DOWN"];
        };

        if (_ipos select 2 < 0) then {
            _ipos set [2,0];
        };

        _radius = 1;

        if (_isMine) then {
            if((random 10) <= 4) then {
                _gems = ["ItemTopaz","ItemObsidian","ItemSapphire","ItemAmethyst","ItemEmerald","ItemCitrine","ItemRuby"];
                _gem = _gems select (floor(random (count _gems)));
                _selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]];
            };
        };

        // give refund items
        if((count _selectedRemoveOutput) > 0 && !_preventRefund) then {
            _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
            {
                _itemOut = _x select 0;
                _countOut = _x select 1;
                if (typeName _countOut == "ARRAY") then {
                    _countOut = round((random (_countOut select 1)) + (_countOut select 0));
                };
                _item addMagazineCargoGlobal [_itemOut,_countOut];
            } count _selectedRemoveOutput;

            _item setposATL _iPos;

            player reveal _item;

            player action ["Gear", _item];
        };
    } else {
        cutText [(localize "str_epoch_player_91"), "PLAIN DOWN"];
    };

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

 

plotmenu.sqf

Spoiler

//

"BUILD INFO" hintC parseText format ["
<t size='1.5' shadow='1'align='left' color='#009FCF'>CONSTRUCTION BASED ON SURVIVED DAYS MENU</t><br/>
<t size='.7' shadow='1'align='left' color='#ff5200'></t><br/>
<t size='1.1' shadow='1'align='left' color='#ff5200'>Survive 2 days and Build Small Houses</t><br/>
<t size='.7' shadow='1'align='left' color='#ff5200'></t><br/>
<t size='1.1' shadow='1'align='left' color='#ff5200'>>Small House: Right Click on Etool + 4 WoodWalls + 1 FloorCelling +2 days survived</t><br/>
<t size='.7' shadow='1'align='left' color='#ff5200'></t><br/>
<t size='1.1' shadow='1'align='left' color='#ff5200'>>Medium House: Right Click on Etool + 2 CinderWalls + 1 FloorCelling +5 days survived</t><br/>
<t size='.7' shadow='1'align='left' color='#ff5200'></t><br/>
<t size='1.1' shadow='1'align='left' color='#ff5200'>>Large House: Right Click on Etool + 4 CinderWalls + 1 FloorCelling +8 days survived</t><br/>
<t size='.7' shadow='1'align='left' color='#ff5200'></t><br/>
<t size='1.1' shadow='1'align='left' color='#ff5200'>>Hero House: Right Click on Etool + 2 CinderWalls + 1 FloorCelling +2 days survived</t><br/>
"];

private ["_countsurvived"];
_countsurvived = dayz_Survived;

[format["<t size='0.75' color='#FFCC00'>>%2 You Have 1% days survived</t>",_countsurvived,(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;

 

 

Link to comment
Share on other sites

so i discovered some bugs on your mod:

First of all the items were no being removed from my inventory, after i placed  down the houses. second of all, what if we changed the range of the Plotpole? Does it sstill check 30 meters?

3rd: For me no buildings/ houses can be removed.

4th i can´t place down the large house...

I hope i could help you improve the script...(gonna post a vid of it later duh)

Edit: Maybe a little Promo? :D

 

One last edit:

If you are using deploy anything edit your overwrites Config so it looks like this:

Spoiler

//  DZE_CLICK_ACTIONS
//      This is where you register your right-click actions
//  FORMAT -- (no comma after last array entry)
//      [_classname,_text,_execute,_condition],
//  PARAMETERS
//  _classname  : the name of the class to click on 
//                  (example = "ItemBloodbag")
//  _text       : the text for the option that is displayed when right clicking on the item 
//                  (example = "Self Transfuse")
//  _execute    : compiled code to execute when the option is selected 
//                  (example = "execVM 'my\scripts\self_transfuse.sqf';")
//  _condition  : compiled code evaluated to determine whether or not the option is displayed
//                  (example = {true})
//  EXAMPLE -- see below for some simple examples
DZE_CLICK_ACTIONS = [
    ["ItemGPS","Scan Nearby","if(isNil 'DZE_CLICK_ACTIONS_GPS_RANGE') then {DZE_CLICK_ACTIONS_GPS_RANGE = 1500;};DZE_CLICK_ACTIONS_ZOMBIE_COUNT = count ((position player) nearEntities ['zZombie_Base',DZE_CLICK_ACTIONS_GPS_RANGE]); DZE_CLICK_ACTIONS_MAN_COUNT = count ((position player) nearEntities ['CAManBase',DZE_CLICK_ACTIONS_GPS_RANGE]);cutText[format['Within %1 Meters: %2 AI/players, %3 zombies, %4 vehicles',DZE_CLICK_ACTIONS_GPS_RANGE,DZE_CLICK_ACTIONS_MAN_COUNT - DZE_CLICK_ACTIONS_ZOMBIE_COUNT,count ((position player) nearEntities ['zZombie_Base',DZE_CLICK_ACTIONS_GPS_RANGE]),count ((position player) nearEntities ['allVehicles',DZE_CLICK_ACTIONS_GPS_RANGE]) - DZE_CLICK_ACTIONS_MAN_COUNT],'PLAIN DOWN'];","true"],
    ["ItemGPS","Range Up"   ,"if(isNil 'DZE_CLICK_ACTIONS_GPS_RANGE') then {DZE_CLICK_ACTIONS_GPS_RANGE = 1500;};DZE_CLICK_ACTIONS_GPS_RANGE = (DZE_CLICK_ACTIONS_GPS_RANGE + 100) min 2500; cutText[format['GPS RANGE: %1',DZE_CLICK_ACTIONS_GPS_RANGE],'PLAIN DOWN'];","true"],
    ["ItemGPS","Range Down" ,"if(isNil 'DZE_CLICK_ACTIONS_GPS_RANGE') then {DZE_CLICK_ACTIONS_GPS_RANGE = 1500;};DZE_CLICK_ACTIONS_GPS_RANGE = (DZE_CLICK_ACTIONS_GPS_RANGE - 100) max 1000;  cutText[format['GPS RANGE: %1',DZE_CLICK_ACTIONS_GPS_RANGE],'PLAIN DOWN'];","true"],
    ["ItemGPS","Toggle Map Marker","execVM 'overwrites\click_actions\examples\marker.sqf';","true"],
    ["ItemMap","Toggle Map Marker","execVM 'overwrites\click_actions\examples\marker.sqf';","true"], // <- Dont forget to add a comma here or else it won´t work
  /////////// Here starts the segment for the houses
	["ItemEtool","Small House","execVM 'custom\scripts\house\smallhouse.sqf';","true"],
	["ItemEtool","Medium Houses","execVM 'custom\scripts\house\mediumhouse.sqf';","true"],
	["ItemEtool","Large Houses","execVM 'custom\scripts\house\largehouse.sqf';","true"],
	["ItemEtool","Hero House","execVM 'custom\scripts\house\herohouse.sqf';","true"] // also be sure that there´s no comma after this line, else script will be broken
];

 

 

Link to comment
Share on other sites

Hey! @Cherdenko tnks for your TEST!!!  well see...  First thing u note: about high position of building., i added "page up" and "pange down" from player_build.sqf to take control about where you u place the houses....  if u think its higher...  find in smallhouses.sqf mediumhouses.sqf and largehouse.sqf   this line:

_offset = [0,8,2];  //number two is for up down

 

For remove it::  you need a crowbar and get into the house.. also u need be a plot owner.

And you cant build anothers houses if u already have one cuz thers a restriction amount of houses per plot area.

i put the msg in a wrong site,, see:

Spoiler


if (_Playersurvived > 5) then {
[format["<t align='center' size='0.75' color='#FFCC00'>>You learn build Medium Houses.%1</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;  


////////////////////////FIND NEAREST HOUSES AND PREVENT ANOTHER BUILD

_playerPos = getPosATL player;
_nearhouse = count nearestObjects [_playerPos, ["MAP_deutshe_mini","MAP_Mil_Mil_Guardhouse","MAP_bouda2_vnitrek"], 45] > 0;
 
if (_nearhouse) exitWith {
    [format["<t align='center' size='0.75' color='#ff5200'>%1 You cannot build another house in this plot area.</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;
        };
///////////////////////////////////////////////////////////////

must be:

Spoiler

////////////////////////FIND NEAREST HOUSES AND PREVENT ANOTHER BUILD

_playerPos = getPosATL player;
_nearhouse = count nearestObjects [_playerPos, ["MAP_deutshe_mini","MAP_Mil_Mil_Guardhouse","MAP_bouda2_vnitrek"], 45] > 0;
 
if (_nearhouse) exitWith {
    [format["<t align='center' size='0.75' color='#ff5200'>%1 You cannot build another house in this plot area.</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;
        };
///////////////////////////////////////////////////////////////


if (_Playersurvived > 5) then {
[format["<t align='center' size='0.75' color='#FFCC00'>>You learn build Medium Houses.%1</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;  

 

For remove items,,, your right!  my bad... its fixed.. let me update it in download file..  TNKS SO MUCH!!

 

tnks!!!!!!

Link to comment
Share on other sites

mmm  i can build large houses.... maybe u cant cuz survived restrictions?

Coment all this lines in largehouses.sqf  and try build. ( u cant build another house if thers any other kind of house in plot area) any other kind of house = small,medium or large.

//if (_Playersurvived > 8) then {
//[format["<t align='center' size='0.75' color='#FFCC00'>>You learn build Large Houses.%1</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText; 

//_Playersurvived = dayz_Survived;

//if (_Playersurvived < 8) exitWith {
//[format["<t align='center' size='0.75' color='#FFCC00'>>not yet! you have %1 days survived. and needs almost 8 days</t>",_Playersurvived],0,0,2,2] spawn BIS_fnc_dynamicText;
//};

 

for hero heal restriction... try add it in hospitalhero.sqf

at very top above

disableSerialization;

add:

private ["_LastUsedTime","_Time"];

_LastUsedTime = 900;
_Time = time - lastuse;	


if(_Time < _LastUsedTime) exitWith { 
    cutText [format["wait %1 seconds",(round(_Time - _LastUsedTime))], "PLAIN DOWN"]; 
};

at very bottom add:

 lastuse = time;

 

 

Link to comment
Share on other sites

And also a Variable to remove cashMoney would be great...

So if you build the house you need an additional x/y coins to build the house.

And i double checked in my db: i am 10 days alife now...

Also its not even calling the script i think :/

(By the way, thx again :))

Link to comment
Share on other sites

For coins cost...

 

_costs = 200;

if !([ player,_costs] call SC_fnc_removeCoins) then {
		titleText [format["Needs %1 %2 .",_costs,CurrencyName] , "PLAIN DOWN", 1];
	} else {
	titleText [format["Pay %1 por %2 %3",_costs,CurrencyName] , "PLAIN DOWN", 1];

 

Link to comment
Share on other sites

if u wanna get more realism with costs ...Buy architectural plan in WholeSaler  doing this:

into your selfactions

find:

if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "GUE_WarfareBFieldhHospital")) then {

place above:

if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "RU_Citizen4")) then {

if (s_player_cost < 0) then {
    s_player_cost = player addAction ["<t color='#ff5200'>BUY ARCHITECTURAL PLAN
</t>", "custom\scripts\house\costs.sqf", [], 5, false];
    };
    } else {
    player removeAction s_player_cost;
    s_player_cost = -1;
    };

**now find:

  player removeAction s_player_hospitalhero;
    s_player_hospitalhero = -1;

place above:

 player removeAction s_player_cost;
    s_player_cost = -1;

*NOW CREATE A NEW SQF CALLED "costs.sqf" drop into custom\scripts\house\

costs.sqf

Spoiler

private ["_costs"];

_costs = 50000;

if !([ player,_costs] call SC_fnc_removeCoins) then {
        titleText [format["Needs %1 %2 .",_costs,CurrencyName] , "PLAIN DOWN", 1];
    } else {
    titleText [format["Pay %1 %2 for architectural plan",_costs,CurrencyName] , "PLAIN DOWN", 1];
    
    player addMagazine "ItemBook2";
    
    };

now in each house.sqf  (large,medium,small)

example with smallhouse.sqf add lines in red

Spoiler

private ["_hasbonus","_playerPos","_nearhouse","_Playersurvived","_inventory","_hasitem1","_Playersurvived","_removed","_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","_objHupDiff","_needNear","_vehicle","_inVehicle","_requireplot","_objHDiff","_isLandFireDZ","_isTankTrap"];
 

Spoiler

//VARIABLES
_inventory = items player;
_hasitem1 = [["ItemWoodWall",4], "ItemWoodFloor"] call player_checkItems;
_Playersurvived = dayz_Survived;

_hasbonus = "ItemBook2" in magazines player;

Spoiler

//CHECK ITEMS ///


if !(_hasbonus) exitWith {cutText [format["needs an architectural plan.Go with WholeSaler"], "PLAIN DOWN"];};

if (!_hasitem1) exitWith {cutText
[format["Needs 4xItemWoodWall and 1xFloorCelling4/4"], "PLAIN DOWN"];};

Then go to your server, use scrollmenu in your wholesaler and pick "Buy architectural plan"

Link to comment
Share on other sites

so the big house now works flawless, but i think it´s removing the coins too soon in the script.

Because if you don´t have all the crafting stuff you need, but have the coins in the inventory it will remove the coins, but still show you that there are some parts missing... is it possible to make the remove coins thing at the end of the script?

But after all: Still awesome work @juandayz :D

Link to comment
Share on other sites

try lines in red:

example for mediumhouse.sqf  (not tested)

Spoiler

if (!_hasitem1) exitWith {cutText
[format["Needs 2xCinder_walls and 1xFloorCelling4/4"], "PLAIN DOWN"];};
//////////////////////////

_costs = 200;// add into private section too.

if !([ player,_costs] call SC_fnc_removeCoins) exitWith {
        titleText [format["Needs %1 %2 .",_costs,CurrencyName] , "PLAIN DOWN", 1];};

 

near of the end

Spoiler

sleep 3;

    if ([ player,_costs] call SC_fnc_removeCoins) then {
    titleText [format["Pay %1  %2 for build ths house ",_costs,CurrencyName] , "PLAIN DOWN", 1];};

_removed = [["cinder_wall_kit",2], "ItemWoodFloor"] call player_removeItems;

 

 

Link to comment
Share on other sites

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
  • Discord

×
×
  • Create New...