Jump to content

Base Destruction Dome (Admin Script)


Axe Cop

Recommended Posts

Hey MrTesla nice addition! I actually use the default "Kill Target" admin menu to destroy single elements (extended that script to also target base building stuff month ago), but this way you see what you destroy before you do, with "Kill Target" you sometimes miss and destroy something you didn't intended to :P

 

Btw if you use the "_objectClasses" at multiple places I would suggest to only define it once, because it is quite a long list and easier to modify if there is only one place. :)

Link to comment
Share on other sites

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.

Okay i have been messing around a bit, still not working tho but i'm doing my best :p

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

This means i need the sqf in the same folder as the anti hack?

what if i do it like this:

adminadd = adminadd + [" Base Destruction Menu",destructiondome,"0","0","0","1",[]];

and add this in the anti hack where its calling the scripts like adminspec

destructiondome = {

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

Is this right?

and then i'm still wondering how the scrollwheel will work.

Link to comment
Share on other sites

Yeah kinda, you can define the script with "destructiondome" like you did, BUT you can't call it like that because it needs a parameter to work (like in my menu with "center", "radius", "destroy", that are the parameters so the script knows what to do), I guess that can be done with the menu as well but I am not sure.

I would try to add the parameter at the "[]" in your menu, that looks promising but I have no idea what parameter in your menu does what, but it's worth a try ^^

adminadd = adminadd + [" Base Destruction - Set Center",destructiondome,"0","0","0","1",["center"]];
adminadd = adminadd + [" Base Destruction - Set Radius",destructiondome,"0","0","0","1",["radius"]];
adminadd = adminadd + [" Base Destruction - Show Dome",destructiondome,"0","0","0","1",["dome"]];
adminadd = adminadd + [" Base Destruction - DESTROY ALL INSIDE DOME",destructiondome,"0","0","0","1",["destroy"]];

something like that has to work (a sub menu would be better if you know how to do that ^^), but as I said I am not sure if that is the parameter list passed to the script or not, (if not it does nothing I guess)

 

You can still do it like I told you in the previous post, the path is always relative to your mission file not the script you call it from (from where your init.sqf is, no matter where you admin menu is)!

Link to comment
Share on other sites

Hello

 

just wanted to tell you that i made some progress :p

right now i have, the option in the menu and if i enable it i get the scrollwheel option with set radius, set pos, destroy all etc but when i click it nothing happends so i think it is something with this.

if (isNil "BD_vehicles") then {BD_vehicles = true;};
				destructionscrollwheel =
				[
				["",true],
						["Set Center", [2], "", -5, [["expression", '["center"] "[] spawn basedestruction"']], "1", "1"],
						["Set Radius", [3], "", -5, [["expression", '["radius"] "[] spawn basedestruction"']], "1", "1"],
						["Show Dome", [4], "", -5, [["expression", '["dome"] "[] spawn basedestruction"']], "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"] "[] spawn basedestruction"']], "1", "1"],
						["", [-1], "", -5, [["expression", ""]], "1", "0"],
							["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
			];

the [] spawn basedestruction is called later again, like this:

basedestruction =
	{
		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"];
			};
		};
	};
};
	};

do you see what i did wrong?

thanks :)

Link to comment
Share on other sites

yeah the code you run in the menu is wrong at least:

replace:

["Set Center", [2], "", -5, [["expression", '["center"] "[] spawn basedestruction"']], "1", "1"],

with:

["Set Center", [2], "", -5, [["expression", '["center"] spawn basedestruction']], "1", "1"],

"spawn" should work like that, do it with the other menus as well  :D

The stuff after "expression" is essentially code to execute if you activate the menu, so you run this code:

["center"] spawn basedestruction;

to start the script passing the argument "center" to it.

Link to comment
Share on other sites

hi dude,

 

you did very good work with this script! well done and thanks for that.

 

i have added vaultstorages and lockboxes to the remove script but otherwise its perfect

Link to comment
Share on other sites

hi dude,

 

you did very good work with this script! well done and thanks for that.

 

i have added vaultstorages and lockboxes to the remove script but otherwise its perfect

Thanks dude, I left those out on purpose, see post #12 here http://dayzepoch.com/forum/index.php?/topic/3541-base-destruction-dome-admin-script/?p=22312 :D

But you should be able to add those if you want...

Link to comment
Share on other sites

Hey Axe, nice script there :)

One thought on it though, how about, instead of blowing things up, do it like so:

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

So they just get removed AND directly removed from the DB w/o the need for a Restart :)

 

€dit: Just realized you uncommented that part but already have it in there ;)

[Was just checking out the video]

Link to comment
Share on other sites

just uncomment the lines he has in there and remove the setdamage line to use it with indestructable bases!

 

make it look like this:

                    if (alive _x) then {
                        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;
                    };
Link to comment
Share on other sites

Yeah here a simple step by step guide if you don't have any admin tools:

 

Step 1) save my base destruction script in the mission folder as "admintools\basedestruction.sqf"

 

Step 2) create a file "admintools\openmenu.sqf" and copy the menu stuff in there, e.g.

if (isNil "BD_vehicles") then {BD_vehicles = true;};
BaseDestructionMenu = 
[
	["Base Destruction",true],
		["Set Center", [2], "", -5, [["expression", '["center"] execVM "admintools\basedestruction.sqf"']], "1", "1"],
		["Set Radius", [3], "", -5, [["expression", '["radius"] execVM "admintools\basedestruction.sqf"']], "1", "1"],
		["Show Dome", [4], "", -5, [["expression", '["dome"] execVM "admintools\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\basedestruction.sqf"']], "1", "1"],
		["", [-1], "", -5, [["expression", ""]], "1", "0"],
			["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];

showCommandingMenu "#USER:BaseDestructionMenu";

Step 3) to ensure only admins can open and use the menu add this to your fn_selfActions.sqf after "_canDo" as usual:

if (((getPlayerUID player) in ["YOURPLAYERID"]) && (speed player <= 1) && _canDo) then {
	if (s_player_adminTools < 0) then {
		s_player_adminTools = player addaction [("<t color=""#0074E8"">Tools Menu</t>"),"admintools\openmenu.sqf","",5,false,true,"",""];
	}
} else {
	player removeAction s_player_adminTools;
	s_player_adminTools = -1;
};

replace "YOURPLAYERID" with your player UID or a list of IDs for multiple admins ("YOURPLAYERID", "YOURPLAYERID", ..).

 

That is it, I think :)

Link to comment
Share on other sites

I've got a question.

MrTesla added nice fix for deleting single object which I'm using atm. But it only works on buildings. I'm looking for a tool which let's me delete all the items my cursos is at. Simply removal tool.

Any help with that?

Simple removal? here you go:

cursorTarget setDamage 1;
deleteVehicle cursorTarget;

that will also kill players and everything you look at, so be careful or add some restriction to the target :D

Link to comment
Share on other sites

Thanks, will try it after restart, hope it's not togglable, so I won't destroy half of the map by moving my mouse haha :D

Thanks bro, works great :)

Just destroying everything is easy, ask the hackers... :P

Can be done with 1 easy line of code, I better not post that here :D

Link to comment
Share on other sites

I follow your instruction but no menu when i sroll :s

 

I add a the end of my fn_selfaction:

 

if (((getPlayerUID player) in ["6812294"]) && (speed player <= 1) && _canDo) then {
    if (s_player_adminTools < 0) then {
        s_player_adminTools = player addaction [("<t color=""#0074E8"">Tools Menu</t>"),"admintools\openmenu.sqf","",5,false,true,"",""];
    }
} else {
    player removeAction s_player_adminTools;
    s_player_adminTools = -1;
};

 

 

My admin menu works (bluphoenix) but "Tools Menu" doesn't work

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...