Jump to content

Base Destruction Dome (Admin Script)


Axe Cop

Recommended Posts

Hello guys, I just want to share my new script for simple base destruction (removal of abandoned bases) for server admins. :)

First a video demonstration of my script (it's just a backup on my test server, I did not actually destroy that beautiful base of one of my regular players haha):

 

With this script you can destroy and remove any epoch base building parts and vehicles (toggleable) inside a definable dome within seconds.

The script in this version works with 3 simple steps (actions):

  • Set the center of the dome (where you stand)
  • Set the radius of the dome (distance between you and the center point)
  • Hit the destroy option and everything inside the dome will be obliterated :P

For security reasons there is a limit for the maximum radius of the dome, so you cannot destroy the whole map (by accident or whatever lol), this can be changed within the script (default 100m).

There is a toggleable option to also destroy all vehicles in the destruction area, keep in mind even if you disable that there might be collateral damage to vehicles and players from the explosion of base building parts!

Players, safes, lockboxes and other buildings are not affected by the script, you can change the items in the script if you want.

 

There is a preview option (Show Dome), so you can actually see the dome in the game and what will be inside of your selection. For simplicity the dome will only be rendered with a circle on the ground and a small ceiling on the top to see the height and size. The dome will be rendered with the translucent wooden walls from epoch and automatically deleted after 30 secounds. To mark the center of the dome a plot pole will be used, in case you are wondering where that comes from. :D

 

Ok here is the complete script:

private ["_option","_location","_object","_objects","_objectClasses","_i","_dir","_objectID","_objectUID"];

// global vars
//if (isNil "BD_center") then { BD_center = [0,0,0]; };
if (isNil "BD_radius") then { BD_radius = 10; };

_option = _this select 0;
switch (_option) do {
	case "center": {
		BD_center = getPos player;
		cutText [format["center set to %1", BD_center], "PLAIN DOWN"];
	};
	case "radius": {
		if (isNil "BD_center") then {
			cutText ["center not set", "PLAIN DOWN"];
		} else {
			BD_radius = player distance BD_center;
			cutText [format["radius set to %1 m", BD_radius], "PLAIN DOWN"];
		};
	};
	case "dome": {
		if (isNil "BD_center") then {
			cutText ["center not set", "PLAIN DOWN"];
		} else {
			_objects = [];
			// center
			_object = createVehicle ["Plastic_Pole_EP1_DZ", BD_center, [], 0, "CAN_COLLIDE"];
			_objects set [0, _object];
			// circle
			for "_i" from 0 to 360 step (270 / BD_radius) do {
				_location = [(BD_center select 0) + ((cos _i) * BD_radius), (BD_center select 1) + ((sin _i) * BD_radius), BD_center select 2];
				_object = createVehicle ["WoodLargeWall_Preview_DZ", _location, [], 0, "CAN_COLLIDE"];
				_dir = ((BD_center select 0) - (_location select 0)) atan2 ((BD_center select 1) - (_location select 1)); 
				_object setDir _dir;
				_objects set [count _objects, _object];
			};
			// top
			_location = [BD_center select 0, BD_center select 1, (BD_center select 2) + BD_radius];
			_object = createVehicle ["WoodFloor_Preview_DZ", _location, [], 0, "CAN_COLLIDE"];
			_objects set [count _objects, _object];
			sleep 30;
			{
				deleteVehicle _x;
			} forEach _objects;
		};
	};
	case "destroy": {
		if (isNil "BD_center") then {
			cutText ["center not set", "PLAIN DOWN"];
		} else {
			if (BD_radius > 100) then {
				cutText [format["area is to large for base destruction (radius %1 > 100)", BD_radius], "PLAIN DOWN"];
			} else {
				_objectClasses = ["TentStorage","TentStorageDomed","TentStorageDomed2","Hedgehog_DZ","Sandbag1_DZ","TrapBear","Fort_RazorWire","WoodGate_DZ","Land_HBarrier1_DZ","Land_HBarrier3_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","WoodFloorHalf_DZ","WoodFloorQuarter_DZ","WoodStairs_DZ","WoodStairsSans_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"];
				if (BD_vehicles) then {
					_objectClasses = _objectClasses + ["LandVehicle","Helicopter","Plane","Ship"];
				};
				_objects = nearestObjects [BD_center, _objectClasses, BD_radius];
				_i = 0;
				{
					if (alive _x) then {
						_x setDamage 1;
						deleteVehicle _x;
						//_objectID = _x getVariable ["ObjectID", "0"];
						//_objectUID = _x getVariable ["ObjectUID", "0"];
						//PVDZE_obj_Delete = [_objectID, _objectUID, player];
						//publicVariableServer "PVDZE_obj_Delete";
						_i = _i + 1;
					};
				} forEach _objects;
				cutText [format["%1 of %2 objects destroyed and deleted", _i, count _objects], "PLAIN DOWN"];
			};
		};
	};
};

And the menu I am using to set the options and activate it:

if (isNil "BD_vehicles") then {BD_vehicles = true;};
BaseDestructionMenu = 
[
	["Base Destruction",true],
		["Set Center", [2], "", -5, [["expression", '["center"] execVM "admintools\tools\basedestruction.sqf"']], "1", "1"],
		["Set Radius", [3], "", -5, [["expression", '["radius"] execVM "admintools\tools\basedestruction.sqf"']], "1", "1"],
		["Show Dome", [4], "", -5, [["expression", '["dome"] execVM "admintools\tools\basedestruction.sqf"']], "1", "1"],
		[format["Include Vehicles (%1)",BD_vehicles], [5], "", -5, [["expression", "BD_vehicles = !BD_vehicles;"]], "1", "1"],
		["DESTROY ALL INSIDE DOME", [6], "", -5, [["expression", '["destroy"] execVM "admintools\tools\basedestruction.sqf"']], "1", "1"],
		["", [-1], "", -5, [["expression", ""]], "1", "0"],
			["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];

Change the path to match your folder structure.

 

In case you don't know how do display the menu, just embed it in your admin tools like this:

["Base Destruction", [0], "#USER:BaseDestructionMenu", -5, [["expression", ""]], "1", "1"], 

or do something like this to just open it without any other admin menus:

showCommandingMenu "#USER:BaseDestructionMenu";

Make sure to have proper access restriction, so only admins can use that menu and not every player on your server!! :D

Also you might need to add exceptions to your BattlEye filters for setdamage.txt and deletevehicle.txt.

 

Please write all questions or ideas in this thread, this was just a simple script I needed to get rid of old bases on my server. If there is a better way to do that please let me know and I will improve the script.

Edited by Axe Cop
Link to comment
Share on other sites

 

Off topic, what is that other menu you have there? For example, I noticed the option to make a key?

Just some other small scripts I've made for my server :P

 

 

im having problems with my menu on admins tools, when i install it - all tool options disappear.

I'm guessing you used my last line (showCommandingMenu "#USER:BaseDestructionMenu" ;), that will of course override the other menu.

If you want to add it to your admin menu use an entry like this:

["Base Destruction", [0], "#USER:BaseDestructionMenu", -5, [["expression", ""]], "1", "1"],

instead if opening the menu itself (should be like any other menus you have in your admin tools) =).

 

ps - what or where is this line for:

if (isNil "BD_vehicles") then {BD_vehicles = true;};

Just setting the default value for vehicle removal to "true", nothing special! Because it is displayed in the menu, so it has do be defined outside of the script..  :D

Link to comment
Share on other sites

This is a great idea and great tool for admins, i'm guessing the safes if wanted to delete them also would go here?

 

_objectClasses =

Yeah I left them out on purpose, but it should work if you delete safes and lockboxes the same way.. also as you might see I commented out an alternate way of deleting stuff with "PVDZE_obj_Delete" as it seems to work this way as well.

Anyway as far as I know the deleted objects get deleted from the database, but destroyed vehicles have to re removed by hand (or SQL event), just wondering if epoch deletes that by itself.

 

And in case someone is wondering I took the list ob object classes from the file "dayz_code\init\variables.sqf": dayz_allowedObjects (without vault and lockbox), so if you want it all it should work if you just set it like this:

_objectClasses = dayz_allowedObjects;

:D

Link to comment
Share on other sites

I custom coded alot of sh*t into mine, but some of the things you have coded are beyond amazing, I'm very excited to see what you release next ;)

Thanks haha, and you will see soon enough what I will release next! :D

 

Edit: here my new script, Areal Maintenance for Player Bases:  http://dayzepoch.com/forum/index.php?/topic/3603-release-areal-maintenance-for-player-bases-script/

Edited by Axe Cop
Link to comment
Share on other sites

Hello Axe Cop

 

we don't have the blue phoenix admin tools, we use blur gamings one.

Can you maybe tell me how to install this script without the blue phoenix admin tools?

It's a really nice script cuz right now we are deleting the objects 1 by 1 :P

 

Thanks

Hey, I already did that in the first post, just call "showCommandingMenu "#USER:BaseDestructionMenu";" and you open the menu without any other admin tools needed (just check if the user is an admin first ^^).

Maybe the menu can be integrated into your admin tools, but I can't help you with that because I have never seen the code of that, sorry.

Link to comment
Share on other sites

okay sorry i am confused :S
in which file do i place

showCommandingMenu "#USER:BaseDestructionMenu";

and does the #USER means my playerID
so it will become
 

showCommandingMenu "#myID:BaseDestructionMenu";

This is the first time i'm installing something like this, never seen it before :p

 

Thanks

Link to comment
Share on other sites

Sorry for the confusion haha, no the command is actually used with the "#USER", don't change that with your UID! :D, see the ArmA wiki here: https://community.bistudio.com/wiki/showCommandingMenu

If you run that command it will show the commanding menu (hence the name :p) with the base destruction options on the left side of the screen, so YOU have to choose when to open that, if you want I could give you a snipped to add to your fn_selfActions.sqf to open the menu..

Link to comment
Share on other sites

if you can give me the instructions for the fn_selfActions.sqf that would be great! :)

I am trying to get this working with blurgaming anti hack aswell, executing a custom script. but i'm not that good :P if it works ill post it here aswell or pm it to you if you want?

Ok I've just seen this "free version of Blur's anti hack": http://dayzepoch.com/forum/index.php?/topic/3642-free-anti-hack-for-epoch-1025/?p=22790, is that what you are using or similar?

If so it seems pretty easy to extend the menu, but to keep it simple every menu entry is a line like this:

adminadd = adminadd + ["     Spectate Target",adminspec,"0","0","0","1",[]];

the important part is "adminspec", that is the function which is called when you activate the menu, so try adding something like this to your menu:

adminadd = adminadd + ["Base Destruction Menu",{showCommandingMenu "#USER:BaseDestructionMenu";},"0","0","0","1",[]];

The "BaseDestructionMenu" has to be defined before calling that command of course, so just copy the part somewhere before that line. I hope you know how to do that, I can't tell you how scriping works in 5 minutes.. :D

 

Another way is to build the complete base destruction menu like that, not just opening the command menu, but using the blur gaming admin menu. the simple solution is using the commanding menu from arma for now.

Link to comment
Share on other sites

Very useful script. Had to ban some players yesterday and used it to get rid of their base. I also added an extra option to select and demolish single objects, in case somebody decides to grief by blocking off areas with indestructible objects.

 

Add this to the base destruction menu:

		["Select Single Object", [7], "", -5, [["expression", '["selectSingle"] execVM "Addons\admintools\tools\basedestruction.sqf"']], "1", "1"],
		["Destroy Single Object", [8], "", -5, [["expression", '["destroySingle"] execVM "Addons\admintools\tools\basedestruction.sqf"']], "1", "1"],

And this to the base destruction script:

	case "selectSingle": {
		_objectClasses = ["TentStorage","TentStorageDomed","TentStorageDomed2","Hedgehog_DZ","Sandbag1_DZ","TrapBear","Fort_RazorWire","WoodGate_DZ","Land_HBarrier1_DZ","Land_HBarrier3_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","WoodFloorHalf_DZ","WoodFloorQuarter_DZ","WoodStairs_DZ","WoodStairsSans_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"];
		if (BD_vehicles) then {
			_objectClasses = _objectClasses + ["LandVehicle","Helicopter","Plane","Ship"];
		};
		if (typeOf(cursorTarget) in _objectClasses) then {
			objSelection = cursorTarget;
			objName = getText (configFile >> "CfgVehicles" >> (typeOf objSelection) >> "displayName");
			cutText [format["%1 selected", objName], "PLAIN DOWN"];
		} else {
			cutText ["Cannot select that object.", "PLAIN DOWN"];
		};
	};
	case "destroySingle": {
		if (isNil "objSelection") then {
			cutText ["No object selected", "PLAIN DOWN"];
		} else {
			if (alive objSelection) then {
				objSelection setDamage 1;
				deleteVehicle objSelection;
				cutText [format["%1 Deleted", objName], "PLAIN DOWN"];
				objSelection = nil;
			};
		};
	};
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
×
×
  • Create New...