Jump to content

[Release] Restrict Building - ** Updated for 1.0.6.2 **


BigEgg

Recommended Posts

Restrict Building is part of Epoch 1.0.7.1 now.

 

While there may be some extra features built in to 1.0.6.1 that restrict building, I needed more options.

 

What this does:

  1. Allows server owners to restrict entire zones of the map (for example - no building within 1,000 meters of Balota).
  2. Allows server owners to restrict building near certain buildings, and allows them to define the distance and name of each building they are restricting.

 

Step 1:

In your init.sqf find:

// EPOCH CONFIG VARIABLES END //

Directly under it, add:

// Restrict building near specific buildings
BlacklistedBuildings = [
//  ["What text will say", "Class name of building you want to block", Distance around that building to block (radius in meters)]
	["Fire Station", "Land_a_stationhouse", 250]
];

// Restrict building near map areas
RestrictedBuildingZones = [
//  ["What text will say", [Choords of place to block], Distance around that area to block (radius in meters)]
    ["Balota Airfield", [5158.72, 2518.75, 0], 600]
];

 

Step 2:

In your custom compiles.sqf add (NOTE: CHANGE THE FILE PATH TO FIT YOUR NEEDS):

dze_buildChecks = compile preprocessFileLineNumbers "FILE\PATH\HERE\dze_buildChecks.sqf";

into the if (!isDedicated) code block. Example:

if (!isDedicated) then {
	dze_buildChecks = compile preprocessFileLineNumbers "FILE\PATH\HERE\dze_buildChecks.sqf";
};

 

Step 3:

Create an SQF file, in the path you have designated above, and name it dze_buildChecks.sqf.

 

Step 4:

Paste the following code into dze_buildChecks.sqf and save the file.

  Reveal hidden contents

 

Done!

 

Be sure to configure the settings in your init.sqf to your liking.

Link to comment
Share on other sites

  On 3/24/2017 at 7:23 AM, Hooty said:

Nice I was close. I had

MaxBuildHeight = 30   in my config

but not

if (LimitBuildHeight) then {
	MaxBuildHeight = 30; // Maximum build height in meters
};

 

But all i was trying to do was add the height. 

Expand  

This does nothing but check to see if you want to block the height - you will still need to add the code above, or else those two variables have no effect at all.

Link to comment
Share on other sites

  On 3/24/2017 at 7:33 AM, BigEgg said:

This does nothing but check to see if you want to block the height - you will still need to add the code above, or else those two variables have no effect at all.

Expand  

I had this already.

  Reveal hidden contents

 @oldmatechoc was helping me with it as well last night.  

 

Link to comment
Share on other sites

  On 3/24/2017 at 7:39 AM, Hooty said:

I had this already.

  Reveal hidden contents

 @oldmatechoc was helping me with it as well last night.  

 

Expand  

If you already have that in your dze_buildChecks.sqf, add this at the bottom:

if (_cancel) exitWith {
	dayz_actionInProgress = false;
	_reason call dayz_rollingMessages;
	[false, _isPole];
};

Above:

//When calling this function in another script use a silent exitWith, unless you have something special to say. i.e. if (!(_canBuild select 0)) exitWith{};
[_canBuild, _isPole];

 

Link to comment
Share on other sites

I'm gonna start banging my head in the desk now lol smh...  I like your restrict zones as well so i just added the whole thing you know how balota is on my server xD. Plus it would come in hand with the other risky traders I've added.

 

Plus when you code its nice and clean.

Link to comment
Share on other sites

Currently the maximum build height checks where the player is standing, so players are able to build items 10 meters above the set height.   Would it be possible to have it check the height where the item is being built instead of the player position? 

Link to comment
Share on other sites

  On 3/24/2017 at 10:17 PM, Jim90 said:

Currently the maximum build height checks where the player is standing, so players are able to build items 10 meters above the set height.   Would it be possible to have it check the height where the item is being built instead of the player position? 

Expand  

I have a fix in mind for this - I will post an update for it which should work (not home atm). Check back later.

Link to comment
Share on other sites

  On 3/24/2017 at 10:17 PM, Jim90 said:

Currently the maximum build height checks where the player is standing, so players are able to build items 10 meters above the set height.   Would it be possible to have it check the height where the item is being built instead of the player position? 

Expand  

You will need to copy modular_build.sqf over to your mission folder and change the path in your compiles.

 

In modular_build.sqf find:

if(abs(_objHDiff) > DZE_buildMaxHeightDistance) exitWith {
	_isOk = false;
	_cancel = true;
	_reason = format[localize "STR_EPOCH_BUILD_FAIL_HEIGHT",DZE_buildMaxHeightDistance];
	detach _object;
	deleteVehicle _object;
	if (_VectorWorkAround) then {
		detach _object2;
		deleteVehicle _object2;
	};
	detach _objectHelper;
	deleteVehicle _objectHelper;
};

Under it add:

if (LimitBuildHeight && (((abs(_objHDiff)) + ((getPosATL (vehicle player)) select 2)) > MaxBuildHeight)) exitWith {
	_isOk = false;
	_cancel = true;
	_reason = format["Building is restricted above %1 meters.", MaxBuildHeight];
	detach _object;
	deleteVehicle _object;
	if (_VectorWorkAround) then {
		detach _object2;
		deleteVehicle _object2;
	};
	detach _objectHelper;
	deleteVehicle _objectHelper;
};

 

That should work (haven't tested - will update the post when I have).

Link to comment
Share on other sites

  On 3/25/2017 at 12:09 AM, Jim90 said:

Update looks to work perfectly.  As you raise the item past 30m it stops the build and gives the warning message.  Also tested building below 30m still works and starting a build above 30m will not work. Thanks for the great work @BigEgg

Expand  

Good to hear - will update the post :)

Link to comment
Share on other sites

I don't seem to have a if (isDedicated) then {

Am I putting this in the right spot? Not working on my server. I have placed 2 plot poles and on right near stary.

 

 

  Reveal hidden contents

\n

Link to comment
Share on other sites

@Jestertriks in your compiles  the one you paste you have the dze_buildchecks twice.

coment the old

this line

  Reveal hidden contents

 

 

or just remove the one you put, and change the path for the default line.

	dze_buildChecks = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dze_buildChecks.sqf";

and change the path

dze_buildChecks = compile preprocessFileLineNumbers "Mods\compile\dze_buildChecks.sqf";

or made a new compiles.sqf into your client side folder

and paste

compiles.sqf (mpmissions\your instance\mods\compile\)

if (!isDedicated) then {
dze_buildChecks = compile preprocessFileLineNumbers "Mods\compile\dze_buildChecks.sqf";
};

and in your init.sqf

find:

progressLoadingScreen 0.15;

below add:

call compile preprocessFileLineNumbers "Mods\compile\compiles.sqf";


 

Link to comment
Share on other sites

  On 3/24/2017 at 10:53 PM, BigEgg said:

You will need to copy modular_build.sqf over to your mission folder and change the path in your compiles.

 

In modular_build.sqf find:

if(abs(_objHDiff) > DZE_buildMaxHeightDistance) exitWith {
	_isOk = false;
	_cancel = true;
	_reason = format[localize "STR_EPOCH_BUILD_FAIL_HEIGHT",DZE_buildMaxHeightDistance];
	detach _object;
	deleteVehicle _object;
	if (_VectorWorkAround) then {
		detach _object2;
		deleteVehicle _object2;
	};
	detach _objectHelper;
	deleteVehicle _objectHelper;
};

Under it add:

if (LimitBuildHeight && (((abs(_objHDiff)) + ((getPosATL (vehicle player)) select 2)) > MaxBuildHeight)) exitWith {
	_isOk = false;
	_cancel = true;
	_reason = format["Building is restricted above %1 meters.", MaxBuildHeight];
	detach _object;
	deleteVehicle _object;
	if (_VectorWorkAround) then {
		detach _object2;
		deleteVehicle _object2;
	};
	detach _objectHelper;
	deleteVehicle _objectHelper;
};

 

That should work (haven't tested - will update the post when I have).

Expand  

I can Also Confirm this works. Thank you for all your amazing help!

Link to comment
Share on other sites

In order to stop building around the airfields I made multiple points which overlap along the length of each runway.  Was wondering if this could cause any problems or if there is a better way to do it?  Below is my init.sqf config covering stock Chernarus 11 trader positions, airfields, 9 buildings, 2 plotpoles and 30m build height.  I have this on my server now and it all looks to all be working good.

  Reveal hidden contents

 

Link to comment
Share on other sites

  On 3/27/2017 at 8:44 PM, Jim90 said:

In order to stop building around the airfields I made multiple points which overlap along the length of each runway.  Was wondering if this could cause any problems or if there is a better way to do it?  Below is my init.sqf config covering stock Chernarus 11 trader positions, airfields, 9 buildings, 2 plotpoles and 30m build height.  I have this on my server now and it all looks to all be working good.

  Reveal hidden contents

 

Expand  

Not an issue at all, I do the same thing :) 

Link to comment
Share on other sites

  • 2 weeks later...
  On 4/10/2017 at 4:17 PM, juandayz said:

i guess you can use the

DZE_SafeZoneNoBuildDistance = 150;

DZE_SafeZoneNoBuildItems []; located in configvariables.sqf to made it.

 

Expand  

DZE_SafeZoneNoBuildItems = ["fuel_pump_kit","fuelpump_dz","VaultStorageLocked","LockboxStorageLocked","Plastic_Pole_EP1_DZ"]; // Array of object class names not allowed to build
 

DZE_SafeZoneNoBuildDistance = 1250; // Distance from safe zones listed above to disallow building near.
 

 

Already have this added-- does not block the fuel pumps

The block works for safes and plots-- just not the fuel pumps

Link to comment
Share on other sites

You arent using the correct class names of the pumps .  If you have infistar, place what you want to block then look at it and press I and the clsssname will be displayed in the chat. 

From memory its something like land_pump _a or something similar. 

Link to comment
Share on other sites

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