Jump to content

[Release] Indestructible Items (For 1.0.5.1)


Recommended Posts

I started a new thread for this as the way it is done is different from ToejaM's ()

 

I take no credit for this, all I have done is take information from both ToejaM's and Epoch's indestructible scripts and pull it together to give the ability to select what items are indestructible.

 

I have it set to make only Cinder walls, Metal floors, ladders, ramps & stairs indestructible however its easy to add more to the list.

 

All items set in the array take no damage when created, upgraded, downgraded or after server restart.

 

Files are now on github here https://github.com/mathewjknott/Dayz-Epoch-Indestructible-Items

 

 

Installation instructions - (last updated 08/07/14 @ 18:30)

 

 

PART A (setting up mission file file structure)

 

Step 1)

 

Unpack your dayz_code.pbo in @DayZ_Epoch\addons\

 

 

Step 2)

 

Create a new folder in your missions files called "dayz_code"

Create 3 new folders in the newly created "dayz_code" folder called "actions", "compile" & "init"

 

 

Step 3)

 

Copy variables.sqf from @DayZ_epoch\addons\dayz_code\init\ to dayz_code\init\

Copy compiles.sqf from @DayZ_epoch\addons\dayz_code\init\ to dayz_code\init\

Copy fn_selfActions.sqf  from @DayZ_epoch\addons\dayz_code\compile\ to dayz_code\compile\

Copy player_build.sqf from @DayZ_epoch\addons\dayz_code\actions\ to dayz_code\actions\

Copy player_upgrade.sqf from @DayZ_epoch\addons\dayz_code\actions\ to dayz_code\actions\

Copy player_buildingDowngrade.sqf from @DayZ_epoch\addons\dayz_code\actions\ to dayz_code\actions\

 

 

Step 4)

 

Open mission files\init.sqf

 

Replace

"\z\addons\dayz_code\init\variables.sqf";

with

"dayz_code\init\variables.sqf";

Replace

"\z\addons\dayz_code\init\compiles.sqf";

with

"dayz_code\init\compiles.sqf";

Step 5)

 

Open mission files\dayz_code\compiles.sqf

 

replace

"\z\addons\dayz_code\compile\fn_selfActions.sqf";

with

"dayz_code\compile\fn_selfActions.sqf";

replace

"\z\addons\dayz_code\actions\player_build.sqf"; 

with

"dayz_code\actions\player_build.sqf"; 

Step 6)

 

Open mission files\day_code\compile\fn_selfActions.sqf

 

replace

"\z\addons\dayz_code\actions\player_upgrade.sqf"

with

"dayz_code\actions\player_upgrade.sqf"

replace

"\z\addons\dayz_code\actions\player_buildingDowngrade.sqf"

with

"dayz_code\actions\player_buildingDowngrade.sqf" 

PART B (mission file Edits for mod)

 

 

Step 1)

 

Open mission files\dayz_code\init\variables.sqf

 

find

dayz_allowedObjects

add below

//#########################INDESTRUCTIBLE ITEMS#########################
indestructible = ["CinderWallHalf_DZ","CinderWall_DZ","CinderWallSmallDoorway_DZ","CinderWallDoorSmall_DZ","CinderWallDoorSmallLocked_DZ","CinderWallDoorway_DZ","CinderWallDoor_DZ","CinderWallDoorLocked_DZ","MetalFloor_DZ","WoodLadder_DZ","WoodStairs_DZ","WoodStairsSans_DZ","WoodStairsRails_DZ","WoodRamp_DZ"];
//######################################################################

N.B - add/remove items to this list to have them indestructible.

 

 

Step 2)

 

open mission files\dayz_code\actions\player_build.sqf

 

find

		// Start Build
		_tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];

N.B - _tmpbuilt may be _object if you are using snap building.

 

add after

//#########################INDESTRUCTIBLE ITEMS#########################
		if ((typeOf _tmpbuilt) in indestructible) then {
			_tmpbuilt addEventHandler ["HandleDamage", {false}];
			_tmpbuilt enableSimulation false;
		};
//######################################################################

N.B - If _tmpbuilt is _object, change all _tmpbuilt in above code to _object.

 

 

Step 3)

 

open mission files\dayz_code\actions\player_upgrade.sqf

 

find

			// Create new object 
			_object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"];

add after

//#########################INDESTRUCTIBLE ITEMS#########################
			if ((typeOf _object) in indestructible) then {
				_object addEventHandler ["HandleDamage", {false}];
				_object enableSimulation false;
			};
//######################################################################

Step 4)

 

open mission files\dayz_code\actions\player_buildingDowngrade.sqf

 

find

		// Create new object
		_object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"];

add after

//#########################INDESTRUCTIBLE ITEMS#########################
		if ((typeOf _object) in indestructible) then {
			_object addEventHandler ["HandleDamage", {false}];
			_object enableSimulation false;
		};
//######################################################################

PART C (Server file Edits for mod)

 

 

Step 1)

 

Open dayz_server\system\server_monitor.sqf

 

find

				if (DZE_GodModeBase) then {
					_object addEventHandler ["HandleDamage", {false}];
				} else {
					_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
				};

replace with

//#########################REMOVED FOR INDESTRUCTIBLE ITEMS#########################
//				if (DZE_GodModeBase) then {
//					_object addEventHandler ["HandleDamage", {false}];
//				} else {
//					_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
//				};
//##################################################################################

Find

_object setDamage _damage;

add after

//#########################INDESTRUCTIBLE ITEMS#########################
			if ((typeOf _object) in indestructible) then {
				_object addEventHandler ["HandleDamage", {false}];
				_object enableSimulation false;
			} else {
				_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
			};
//######################################################################

For those of you that want to use "Plot for life (2.2.6)", "Snap build Pro(1.4)" and this script, i have created a set of files that for a vanilla server could just be uploaded. The mission files are for NAPF but it would not take much to use them on another map.

 

Download from here

Link to comment
Share on other sites

Tested and working well? I found a bug in CPCs, not sure if its in yours as well. Another admin and I put our chainsaws on fast and unlimited ammo and were able to cut through a cinder wall that satchels couldn't destroy....

Link to comment
Share on other sites

Sorry about that guys, have had the same issue my self. Never thought to test if they was actually destroyed and gone only that the items couldnt be destroyed.

 

Here is the fix for it. updated main post as well

 

 

Open dayz_server\system\server_monitor.sqf

 

Find

//#########################INDESTRUCTIBLE ITEMS#########################
            if ((typeOf _object) in indestructible) then {
                _object addEventHandler ["HandleDamage", {false}];
                _object enableSimulation false;
            };
//######################################################################

replace with

//#########################INDESTRUCTIBLE ITEMS#########################
            if ((typeOf _object) in indestructible) then {
                _object addEventHandler ["HandleDamage", {false}];
                _object enableSimulation false;
            } else {
                _object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
            };
//######################################################################
Link to comment
Share on other sites

This looks great Mathew and I will be adding to my server. Thanks!

 

One quick question before I do, like with Epoch's DZE_Godmodebase, does this only kick in after a restart or, do invincible items become invincible as soon as they are built?

Link to comment
Share on other sites

This works from as soon as items are built. It also works on items after a restart and also after they have been upgraded.

 

I need to sort downgrading as currently i think if you downgrade a item it will no longer be protected. ill try and push a update later today if needed. (just need to edit 1 new file i think)

Link to comment
Share on other sites

Updated first post with this info but for people who already installed it you need to do this to prevent downgraded items from taking damage.

 

 

 

Step 1)

 

Copy player_buildingDowngrade.sqf from @DayZ_epoch\addons\dayz_code\actions\ to dayz_code\actions\

 

 

Step 2)

 

Open mission files\day_code\compile\fn_selfActions.sqf

 

replace

"\z\addons\dayz_code\actions\player_buildingDowngrade.sqf"

with

"dayz_code\actions\player_buildingDowngrade.sqf" 

Step 3)

 

open mission files\dayz_code\actions\player_buildingDowngrade.sqf

 

find

        // Create new object
        _object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"];

add after

//#########################INDESTRUCTIBLE ITEMS#########################
		if ((typeOf _object) in indestructible) then {
			_object addEventHandler ["HandleDamage", {false}];
			_object enableSimulation false;
		};
//######################################################################

Also not really a bug as down to the server admin but the initial posting of this script was missing 2 class names from the array. if you don't add these then locked doors will take damage. 

"CinderWallDoorLocked_DZ"
"CinderWallDoorSmallLocked_DZ"
Link to comment
Share on other sites

Can't seem to get the script to work, I have Snap building, do I change all the _tmpbuilt to _object or just this code in the player_build.sqf

 

//#########################INDESTRUCTIBLE ITEMS#########################
        if ((typeOf _tmpbuilt) in indestructible) then {
            _tmpbuilt addEventHandler ["HandleDamage", {false}];
            _tmpbuilt enableSimulation false;
        };
//######################################################################

 

Snapping works fine

Link to comment
Share on other sites

You have to change _tmpbuilt to _object

//#########################INDESTRUCTIBLE ITEMS#########################
        if ((typeOf _object) in indestructible) then {
            _object addEventHandler ["HandleDamage", {false}];
            _object enableSimulation false;
        };
//######################################################################
Link to comment
Share on other sites

Maybe I missed something but when testing this out on my server everything in the "list" is indestructible until after the server restarted, then you can destroy it again. Is that how it's suppose to be or am I missing something? 

 

if you post your files ill take a look at them. i think it might be the server_monitor.sqf that your problem is with as the other files control before restart and server_monitor.sqf does after restart

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