Jump to content
  • 0

Indestructible Bases + Destructible Locked Doors = Bugs Bunny


naz

Question

I'm running 1.0.4, I have CPC Indestructible Bases script, which I modified a bit so that locked doors are excluded.  I modified the array in dayz_server -> system\server_monitor.sqf to reflect the changes I wished to make, so that when server starts, any walls or floors that are in the database will be indestructible, except of course for the locked doors, which I commented out.

/ ### [CPC] Indestructible Buildables Fix
_cpcimmune =[
"WoodFloor_DZ",
"WoodFloorHalf_DZ",
"WoodFloorQuarter_DZ",
"WoodLargeWallDoor_DZ",
"WoodLargeWallWin_DZ",
"WoodLargeWall_DZ",
"WoodSmallWallDoor_DZ",
"WoodSmallWallWin_DZ",
"Land_DZE_WoodDoor",
//"Land_DZE_WoodDoorLocked",
"Land_DZE_LargeWoodDoor",
//"Land_DZE_LargeWoodDoorLocked",
"Land_DZE_GarageWoodDoor",
//"Land_DZE_GarageWoodDoorLocked",
"WoodLadder_DZ",
"WoodStairsSans_DZ",
"WoodStairs_DZ",
"WoodSmallWall_DZ",
"WoodSmallWallThird_DZ",
"CinderWallHalf_DZ",
"CinderWall_DZ",
"CinderWallDoorway_DZ",
"CinderWallDoor_DZ",
"Land_DZE_LargeWoodDoor",
"MetalFloor_DZ",
//"CinderWallDoorSmallLocked_DZ",
//"CinderWallDoorLocked_DZ",
"CinderWallSmallDoorway_DZ",
"CinderWallDoor_DZ"
];
// ### [CPC] Indestructible Buildables Fix
Just to be thorough, it also has this bit of code a little further down
// ### [CPC] Indestructible Buildables Fix
if (typeOf(_object) in _cpcimmune) then {
        _object addEventHandler ["HandleDamage", {false}];
        _object enableSimulation false;
};
// ### [CPC] Indestructible Buildables Fix
 

This works great as long as no one messes with your building until a restart.  CPC already had a fix for that too, I took player_build.sqf from the dayz_code and modified it with the necessary fix, plus another fix, of course, for excluding locked doors.

_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
_object setDir _dir;
_object attachTo [player,_offset];

// ### [XXX] Destructible Locked Doors Fix
_lockdoor = [
	"Land_DZE_LargeWoodDoorLocked",
	"Land_DZE_WoodDoorLocked",
	"Land_DZE_GarageWoodDoorLocked",
	"CinderWallDoorSmallLocked_DZ",
	"CinderWallDoorLocked_DZ"
];
if (typeOf(_object) in _lockdoor) then {
	_object addEventHandler ["HandleDamage", {true}];
	_object enableSimulation true;
};
if (!(typeOf(_object) in _lockdoor)) then {
	_object addEventHandler ["HandleDamage", {false}];
	_object enableSimulation false;
};

This all works fine and dandy, except when *upgrading* your structure.  I first noticed it when I could shoot a half concrete wall all day with a rocket launcher, but as soon as I upgraded it, it became vulnerable to destruction.  The same goes for all upgradable structures, namely from open-doorways to doored-doorways if you get my drift.

 

After playing around with player_build.sqf for a bit, I realized that this file is not used at all when upgrading a structure.  Now I am at a loss, because I have no idea what to do next!  What I really need to know right now is, where can I get or access the script that is called when a player upgrades an existing structure?

 

Thanks in advance.

 

EDIT:  I figured it out on my own.  I had to get this player_upgrade.sqf file from vbawol's repository.  I edited it a little bit to reflect the changes I was wanting to make:

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

// Set direction
_object setDir _dir;

// Set location
_object setPosATL _location;

// ### [XXX] Handle Custom Destructibles
if (!(_classname in DZE_DoorsLocked)) then {
	_object addEventHandler ["HandleDamage", {false}];
	_object enableSimulation false;
	cutText [format["This %1 is now indestructible. Swapping it for the old %2",_classname,_oldclassname], "PLAIN DOWN", 10];
};
// ### [/XXX]

Saved it in my custom folder, then in fn_selfActions file I called it to execute instead of the generic one from dayz_code (which wasnt even in my dayz_code, weird) and it works great!  All builds are indestructible except for locked doors.  :-)

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

so that when server starts, any walls or floors that are in the database will be indestructible

 

 I first noticed it when I could shoot a half concrete wall all day with a rocket launcher, but as soon as I upgraded it, it became vulnerable to destruction

 

 

 

Did you get this sorted out?

seems as though since the half wall made it through a restart it became indestructible, but once its "upgraded" the half wall no longer exists, and the full wall replacing it needs to go through a restart to become indestructible.

 

 

Side note, 

Sorry I think its silly that you have wood structures indestructible, but to each his own.

Also, what about metal panels?

Link to comment
Share on other sites

  • 0

Did you get this sorted out?

seems as though since the half wall made it through a restart it became indestructible, but once its "upgraded" the half wall no longer exists, and the full wall replacing it needs to go through a restart to become indestructible.

 

Thanks for your reply.  I did get everything sorted.  Let me stress that I'm *very* new to DayZ coding.  You're right, the half wall disappears completely, and is replaced with a full wall.  The same goes for replacing doorways with doors.  The fix for this was just a matter of implementing that conditional statement in my player_upgrade.sqf, and calling it as a custom call in my selfactions file.

 

I know its pretty bad to have the no plot pole + indestructible bases thing going, especially if the server ever gets very populated, seeing as everything will stay until manually deleted.  I also know that wood structures should be realistically destructible, but then again so should anything.  My idea was just to make all bases raidable, but not destructible.  Its the worst when you log in to find that someone has totally levelled your hours of hard work and engineering!

 

Metal panels are indestructible, too.  Anything that's included in the array at the top of my first post will *always* be indestructible, before or after a restart.  Before a restart, any structure except for locked doors will be indestructible.  So say I were to place some scaffolding.  It would be indestructible until the next restart, and then, since it's not in the server_monitor array, it will again become vulnerable (I think).  I still haven't fully tested this, but the logic seems sound.

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
  • Discord

×
×
  • Create New...