Jump to content

[How To] [CPC] Indestructible Bases


ToejaM

Recommended Posts

Patch 1.0.3 Information

I would just like to point out that my script is working entirely flawlessly however the line numbers are wrong in some cases in the tutorials below but they are easy enough to see where it goes instead by searching for the correct words. All the information you need is in this post.

 

At present I do not have time to write the tutorial on pulling the maintain_area.sqf from the DayZ code files, however you will need to do this as Axe Cop's script is now part of Epoch as standard.

 

When I get time I will add this if someone hasn't done it already, its very quick and easy to do but I want to make sure I write it as perfectly as possible to avoid confusion. Its as simple as finding it in the file structure, placing it in your mission folder and then changing the path inside the self actions file.

 

If you do not pull the maintain_area.sqf from the code and add my fix to it, when you maintain your base using the area function on the plot pole it will make your base vulnerable to attack until the restart.

 

[CPC] Indestructible Bases - PART1: On Server Restart

 

What it does:

 

Anything you define inside the _cpcimmune tag will respawn on server restart entirely indestructible and will also not be able to be knocked down. You can add anything you like to the list. the list currently only comprises of the new modular base buildables.

 

How to:

 

Step 1)

 

Unpack your dayz_server.pbo

 

Step 2)

 

Find \system\server_monitor.sqf add copy this at around line 6

_script = getText(missionConfigFile >> "onPauseScript");
// ### [CPC] Indestructible Buildables Fix
_cpcimmune =[
"WoodFloor_DZ",
"WoodFloorHalf_DZ",
"WoodFloorQuarter_DZ",
"Land_DZE_LargeWoodDoorLocked",
"WoodLargeWallDoor_DZ",
"WoodLargeWallWin_DZ",
"WoodLargeWall_DZ",
"Land_DZE_WoodDoorLocked",
"WoodSmallWallDoor_DZ",
"WoodSmallWallWin_DZ",
"Land_DZE_GarageWoodDoor",
"Land_DZE_GarageWoodDoorLocked",
"WoodLadder_DZ",
"WoodStairsSans_DZ",
"WoodStairs_DZ",
"WoodSmallWall_DZ",
"WoodSmallWallThird_DZ",
"CinderWallHalf_DZ",
"CinderWall_DZ",
"CinderWallDoorway_DZ",
"Land_DZE_LargeWoodDoor",
"MetalFloor_DZ",
"CinderWallDoorSmallLocked_DZ",
"CinderWallSmallDoorway_DZ",
"CinderWallDoor_DZ"
];
// ### [CPC] Indestructible Buildables Fix
if ((count playableUnits == 0) and !isDedicated) then {

Step 3)

 

Scroll down to around line 180 and copy this

			_object setdir _dir;
			_object setpos _pos;
			_object setDamage _damage;
// ### [CPC] Indestructible Buildables Fix
					if (typeOf(_object) in _cpcimmune) then {
						_object addEventHandler ["HandleDamage", {false}];
						_object enableSimulation false;
					};
// ### [CPC] Indestructible Buildables Fix

Step 4)

 

Repack your dayz_server.pbo

 

Notes:

 

You're done, its as simple as that. This has been tested on my server for well over a few weeks and is entirely stable. We don't have buildables destructible until a server restart to allow players to remove them by force themselves if neccesary to reduce admin intervention.

 

If you wish to contribute and add your a tutorial for spawning items indestructible without need for a server restart then send me a PM and I'll update this post.

 

[CPC] Indestructible Base Fix - PART2: On Object Creation

 

What it does

 

This is how to make your base objects spawn immediately indestructible without the need for a restart - Credit to Snowmobil for the player_build.sqf coding.

 

If you already have a custom compiles.sqf you can skip the first 3 steps

 

Create a custom compiles.sqf in your mission file.

Creating a custom compiles.sqf

 

Step 1)

Unpack your dayz_code.pbo in Dayz_Epoch\addons\

 

Step 2)

Pull out the compiles.sqf from dayz_code\init\ and place into your root mission folder (where mission.sqm is)

 

Step 3)

 

Edit your init.sqf inside your mission file around line 58 to look like this

call compile preprocessFileLineNumbers "compiles.sqf";				//Compile regular functions

Step 4)

 

If not already done due to step 1, unpack your dayz_code.pbo in DayZ_Epoch\addons\

 

Step 5)

 

Find your player_build.sqf in your dayz_code\actions\

 

Step 6)

 

Around line 231 copy to look like this

	// Start Build 
	_tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
        // ### [CPC] Indestructible Base Fix	
        _tmpbuilt addEventHandler ["HandleDamage", {false}];
        _tmpbuilt enableSimulation false;
	// ### [CPC] Indestructible Base Fix

Save the file in its current location if not already made a copy elsewhere.

 

Step 7)

In your mission folder create a folder called "fixes" and place the player_build.sqf in there.

 

Step 8)

 

Edit your compiles.sqf around line 95

	player_build =				compile preprocessFileLineNumbers "fixes\player_build.sqf";

Notes:

You're now done. You don't need to repack your dayz_code folder as the fix overwrites the original file due to where its called from, you also don't need to save the player_buid.sqf in the folder you copied it from, you can copy it elsewhere if you wish to keep an original version incase you need to revert for what ever reason.

 

This does not need the buildable array that the first part of this tutorial needs, however you will need the first part that edits the server side files for a restart to keep these buildables indestructible.

 

Locations of files are optional, the compiles.sqf does not have to be in the root folder if you wish to have it in your fixes folder just amend the file path. This also means you do not need to name the folder where player_build.sqf goes to "fixes" it can be called anything you like, I just happen to use "fixes" for my custom files.

 

If you use this fix or think its a good idea, please hit the like button on this post. It doesn't do anything for me but shows interest in having indestructible bases. Thanks.

 

[CPC] Indestructible Base Fix - PART3: Prevent Maintenance Exploit

 

 

Currently you can "maintain" an object and it becomes destructible. This stops players from "maintaining" your buildables and then destroying them, as the server swaps them out to destructible types. There are several ways to implement this fix. If someone wishes to modify the server_dayzswap file so that the swapped buildables are also indestructible I will update this post. This however is suitable for my servers needs and helps players to register their base.
 
If you have a custom fn_selfActions file you can skip to step 3.
 
Step 1)
 
Unpack your dayz_code.pbo in your @DayZ_Epoch client folder
 
Step 2)
 
Put the \addons\dayz_code\compile\fn_selfActions.sqf inside your fixes folder.
 
Step 3)
 
Modify your fn_selfActions.sqf this around line 501 and save
 
        if (s_player_maint_build < 0) then {
	s_player_lastTarget set [1,_cursorTarget];
	// ### [CPC] Maintenance Fix 
	s_player_maint_build = player addAction [format["Maintain %1",_text], "fixes\cpcmaintfix.sqf",_cursorTarget, -2, false, true, "",""];
	// ### [CPC] Maintenance Fix 
	};
	} else {

Step 4)

 

Create a new .sqf file, either by copying an existing one or renaming the file extension of a newly created .txt document. Name this file cpcmaintfix.sqf, place this in your fixes folder and put this code inside the newly created .sqf

cutText [format["Maintenance is disabled on this server as it is not required. Please see our website on how to ensure your base is not deleted."], "PLAIN DOWN"];

Optionally customize the message to what you like, we run a base registration system so that we can delete old bases due to there being no viable cleanup system thanks to indestructible buildables and believing that maintenance as it stands, its too much work for base owners.

Step 5)

Modify your compiles.sqf (see above on this post on how to create one, you should have already done it by now if you're this far though) around line 17

fnc_usec_selfActions =		compile preprocessFileLineNumbers "fixes\fn_selfActions.sqf";		//Checks which actions for self

Notes:

 

None

 

[CPC] Indestructible Base Fix - PART4: Swap Objects Fix

 

When you maintain an object either through Axe Cop's areal maintenance script or by doing it individually on each object, it swaps out the object for a new one. You don't see a change but it does happen. This spawns it in using server_swapObject.sqf which does not have the indestructible code inside. You don't have to do this as a restart will make your objects indestructible again however, if you maintain many objects they will be vulnerable to normal attacks until a restart, so it is advised that you do this.

 

Part 4a: Normal DayZ Epoch maintenance system

 

Step 1)

 

Decompile dayz_server.pbo

 

Step 2)

 

Goto: @DayZ_Epoch_Server\addons\dayz_server\compile\ and find server_swapObject.sqf

 

Step 3)

 

Around line 44 change this:

_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
// Test disabling simulation server side on buildables only.
_object enableSimulation false;

to this:

_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
// Test disabling simulation server side on buildables only.
_object enableSimulation false;
// ### CPC Swap Object Fix
_object addEventHandler ["HandleDamage", {false}];
// ### CPC Swap Object Fix

Step 4)

 

Recompile your dayz_server.pbo and you're now done.

 

Notes:

 

None

 

Part 4b: Axe Cop's Maintain Area Script

 

Step 1)

 

In your mission file, or where ever you have stored the script, open the file

 

e.g mine: D:\Gameservers\testserver\MPMissions\DayZ_Epoch_11.Chernarus\fixes\maintain_area.sqf

 

If neccesary you might need to unpack your mission.pbo

 

Step 2)

 

Go to around line 104

					// Set location
					_object setPosATL _location;
					
					PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location],_classname,_obj,_objectID,_objectUID];
					publicVariableServer "PVDZE_obj_Swap";

					player reveal _object;
				} forEach _objects;

and change to this

					// Set location
					_object setPosATL _location;
					
					// ### CPC Swap Object Fix
					_object enableSimulation false;
                                        _object addEventHandler ["HandleDamage", {false}];
                                        // ### CPC Swap Object Fix

					PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location],_classname,_obj,_objectID,_objectUID];
					publicVariableServer "PVDZE_obj_Swap";

					player reveal _object;
				} forEach _objects;

Step 3)

 

Save your file and if necessary, repack your mission.pbo and you're done.

 

Notes:

 

None

Link to comment
Share on other sites

Hey good post - I've also done this with a bit of advice from ToejaM on stopping fences being knocked over!

 

If anyone prefers to have the buildings not be destroy-able IMMEDIATELY (including when just placed), let me know and I'll be happy to help with that (tested, and working) - Unless of course ToejaM prefer's to advise ya, it's his thead after all :D

 

Nice one ToejaM! Good work!

Link to comment
Share on other sites

Editted the original post to include a way to spawn your bases in immediately indestructible. Credit to Snowmobil for the addition.

 

To all the thank yous, you're welcome! For the tiny bit of code, it took a while but its worth it.

 

I'm curious to see how many people are using this or appreciate it, so if you could like the original post I'd appreciate that!

Link to comment
Share on other sites

Update:

Fixed an exploit allowing you to maintain a buildable and then destroy it due to the swap mechanism. See first post for details.

 

@McPimpin I'm not sure what you mean?

 

@Mathewjknott I use the remove function from the base building 1.2 mod. It works the same way. This is admin only however until there is a client remove option for owners.

Link to comment
Share on other sites

We have tried the above script Toejam but we just cant get it to make the buildings undestroyable :/

 

The dayz_server.pbo you gave to Yank runs fine with the code in the exact same place but even after restarts we can destroy the objects. (Thankgod for server roll back or Speedy would be rather upset about the state of his house!)

 

Any suggestions?

Link to comment
Share on other sites

Its a very simple script to install for indestructibles on restart.

 

What objects are being destroyed?

 

Did you try it with only doing PART1 (see OP)?

 

What errors in your RPT logs?

 

I only gave yank the server_monitor.sqf that I use not the entire .pbo

What are you using to re-pbo the files?

Link to comment
Share on other sites

- The objects are just wood walls, doorways, garages and floors.

- We have only tried with Part 1 (the 2 copy/paste pieces of code)

- Is there anything in particular I should be looking for in the RPT logs, I cant seem to see anything that resembles cpcimune or any reference to walls, floors etc.

 I Satcheled a random wall and the only thing in the log that aappears aroudn that time is "16:48:28 Server: Object 4:20 not found (message 94)"

- PBOManager 1.4 is what we are using to unpack and repack the PBO's

 

#confused!

 

Cheers for the help

 

Edit, forgot to mention:

We had tried several things:

- New dayz_server.pbo with our own attempt at modding the server_monitor.sqf

- Modding our old server.pbo

- Using your server_monitor file in both a new and our existing dayz_server.pbo

 

Before, the game just threw you into debug, but using the server.pbo from the 1.0.2.3 release and inserting your server_monitor files the server will run.... but we can still destroy things :/

Link to comment
Share on other sites

As per your chat with Yank:

 

Full server re-install (different directory) No mods installed...

Code put it - servers starts up etc but walls still go boom :/

 

Anybody else having same issue?

Could you just confirm the directory of the dayz_server.pbo .... there is only 1 but just to make sure im not being a wally!

Link to comment
Share on other sites

@DayZ_Epoch_Server afaik?

Are you monging it and using the @Hive that comes with the installer?

 

We are using the correct dayz_server.pbo then!

This is so odd. The test server is literally vanilla - redownloaded all the files again, patched it up, new database, made sure it worked first, then stuck on TSW so I could spawn some boxes to build a few walls.. restart server and wont work!

Like you said, it is dead simple, and not exactly like much can go wrong with inserting 2 simple pieces of code :/

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
  • Advertisement
×
×
  • Create New...