Jump to content

[How To] [CPC] Indestructible Bases


ToejaM

Recommended Posts

i have found something we need to sort out...

so you wrote that the maintenance will swap the objects to destructable again...

 

have you checked objects which can be upgraded?

it seems this produces the same effect...

for example the half cinder walls... are indestructable when built... but if i upgrade them to a full wall they are destructable again...

also the doorways... if the door is placed in they are destructable again...

 

so maybe your swap file modification will do the trick?

 

nonetheless... really like your modifications so far =)

 

Place a plot pole to stop people from upgrading buildables and only make upgrades near a server restart if you're worried about destruction for the moment :)

 

There is a dayz_swapobj file that could be used to make sure all builables are always indestructible. If I get time I'll put my code into it and update it unless someone wants to go ahead and do it first.

Link to comment
Share on other sites

private ["_result","_pos","_wsDone","_dir","_block","_isOK","_countr","_objWpnTypes","_objWpnQty","_dam","_selection","_totalvehicles","_object","_idKey","_type","_ownerID","_worldspace","_intentory","_hitPoints","_fuel","_damage","_date","_script","_key","_outcome","_vehLimit","_hiveResponse","_objectCount","_codeCount","_objectArray","_year","_month","_day","_hour","_minute","_data","_status","_val","_traderid","_retrader","_traderData","_id"];
[]execVM "\z\addons\dayz_server\system\s_fps.sqf"; //server monitor FPS (writes each ~181s diag_fps+181s diag_fpsmin*)

dayz_versionNo =   getText(configFile >> "CfgMods" >> "DayZ" >> "version");
dayz_hiveVersionNo =  getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
_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 {

if ((count playableUnits == 0) and !isDedicated) then {
 isSinglePlayer = true;
};

waitUntil{initialized}; //means all the functions are now defined

diag_log "HIVE: Starting";

waituntil{isNil "sm_done"}; // prevent server_monitor be called twice (bug during login of the first player)

//Set the Time
//Send request
_key = "CHILD:307:";
_result = _key call server_hiveReadWrite;
_outcome = _result select 0;
if(_outcome == "PASS") then {
 _date = _result select 1;
  
 if(dayz_fullMoonNights) then {
  //date setup
  _year = _date select 0;
  _month = _date select 1;
  _day = _date select 2;
  _hour = _date select 3;
  _minute = _date select 4;
  
  //Force full moon nights
  _date = [2012,6,6,_hour,_minute];
 };
  
 if(isDedicated) then {
  setDate _date;
  dayzSetDate = _date;
  publicVariable "dayzSetDate";
 };

 diag_log ("HIVE: Local Time set to " + str(_date));
};

 
// Custom Configs
if(isnil "MaxVehicleLimit") then {
 MaxVehicleLimit = 50;
};
if(isnil "MaxHeliCrashes") then {
 MaxHeliCrashes = 5;
};
if(isnil "MaxDynamicDebris") then {
 MaxDynamicDebris = 100;
};
// Custon Configs End

if (isServer and isNil "sm_done") then {

 serverVehicleCounter = [];
 _hiveResponse = [];

 for "_i" from 1 to 5 do {
  diag_log "HIVE: trying to get objects";
  _key = format["CHILD:302:%1:", dayZ_instance];
  _hiveResponse = _key call server_hiveReadWrite; 
  if ((((isnil "_hiveResponse") || {(typeName _hiveResponse != "ARRAY")}) || {((typeName (_hiveResponse select 1)) != "SCALAR")})) then {
   diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse));
   _hiveResponse = ["",0];
  }
  else {
   diag_log ("HIVE: found "+str(_hiveResponse select 1)+" objects" );
   _i = 99; // break
  };
 };

 _objectArray = [];
 if ((_hiveResponse select 0) == "ObjectStreamStart") then {
  _objectCount = _hiveResponse select 1;
  diag_log ("HIVE: Commence Object Streaming...");
  for "_i" from 1 to _objectCount do {
   _hiveResponse = _key call server_hiveReadWrite;
   _objectArray set [_i - 1, _hiveResponse];
   //diag_log (format["HIVE dbg %1 %2", typeName _hiveResponse, _hiveResponse]);
  };
  diag_log ("HIVE: got " + str(count _objectArray) + " objects");
 };

 // # START OF STREAMING #
 _countr = 0; 
 _totalvehicles = 0;
 {
  //Parse Array
  _countr = _countr + 1;

  _idKey =  _x select 1;
  _type =  _x select 2;
  _ownerID =  _x select 3;

  _worldspace = _x select 4;
  _intentory= _x select 5;
  _hitPoints= _x select 6;
  _fuel =  _x select 7;
  _damage =  _x select 8;

  _dir = 0;
  _pos = [0,0,0];
  _wsDone = false;
  if (count _worldspace >= 2) then
  {
   _dir = _worldspace select 0;
   if (count (_worldspace select 1) == 3) then {
    _pos = _worldspace select 1;
    _wsDone = true;
   }
  };   
  if (!_wsDone) then {
   if (count _worldspace >= 1) then { _dir = _worldspace select 0; };
   _pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
   if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
   diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
  };

  if (_damage < 1) then {
   //diag_log format["OBJ: %1 - %2", _idKey,_type];
   
   //Create it
   _object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
   _object setVariable ["lastUpdate",time];
   _object setVariable ["ObjectID", _idKey, true];

   _lockable = 0;
   if(isNumber (configFile >> "CfgVehicles" >> _type >> "lockable")) then {
    _lockable = getNumber(configFile >> "CfgVehicles" >> _type >> "lockable");
   };

   // fix for leading zero issues on safe codes after restart
   if (_lockable == 4) then {
    _codeCount = (count (toArray _ownerID));
    if(_codeCount == 3) then {
     _ownerID = format["0%1", _ownerID];
    };
    if(_codeCount == 2) then {
     _ownerID = format["00%1", _ownerID];
    };
    if(_codeCount == 1) then {
     _ownerID = format["000%1", _ownerID];
    };
   };

   if (_lockable == 3) then {
    _codeCount = (count (toArray _ownerID));
    if(_codeCount == 2) then {
     _ownerID = format["0%1", _ownerID];
    };
    if(_codeCount == 1) then {
     _ownerID = format["00%1", _ownerID];
    };
   };

   _object setVariable ["CharacterID", _ownerID, true];
   
   clearWeaponCargoGlobal  _object;
   clearMagazineCargoGlobal  _object;
   
   if ((typeOf _object) in dayz_allowedObjects) then {
    _object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
    // Test disabling simulation server side on buildables only.
    _object enableSimulation false;
    // used for inplace upgrades and lock/unlock of safe
    _object setVariable ["OEMPos", _pos, true];
   };
   
   _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

   if (count _intentory > 0) then {
    if (_type in DZE_LockedStorage) then {
     // Fill variables with loot
     _object setVariable ["WeaponCargo", (_intentory select 0), true];
     _object setVariable ["MagazineCargo", (_intentory select 1), true];
     _object setVariable ["BackpackCargo", (_intentory select 2), true];
    } else {

     //Add weapons
     _objWpnTypes = (_intentory select 0) select 0;
     _objWpnQty = (_intentory select 0) select 1;
     _countr = 0;     
     {
      if (_x == "Crossbow") then { _x = "Crossbow_DZ" }; // Convert Crossbow to Crossbow_DZ
      _isOK =  isClass(configFile >> "CfgWeapons" >> _x);
      if (_isOK) then {
       _block =  getNumber(configFile >> "CfgWeapons" >> _x >> "stopThis") == 1;
       if (!_block) then {
        _object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
       };
      };
      _countr = _countr + 1;
     } forEach _objWpnTypes;
    
     //Add Magazines
     _objWpnTypes = (_intentory select 1) select 0;
     _objWpnQty = (_intentory select 1) select 1;
     _countr = 0;
     {
      if (_x == "BoltSteel") then { _x = "WoodenArrow" }; // Convert BoltSteel to WoodenArrow
      if (_x == "ItemTent") then { _x = "ItemTentOld" };
      _isOK =  isClass(configFile >> "CfgMagazines" >> _x);
      if (_isOK) then {
       _block =  getNumber(configFile >> "CfgMagazines" >> _x >> "stopThis") == 1;
       if (!_block) then {
        _object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
       };
      };
      _countr = _countr + 1;
     } forEach _objWpnTypes;

     //Add Backpacks
     _objWpnTypes = (_intentory select 2) select 0;
     _objWpnQty = (_intentory select 2) select 1;
     _countr = 0;
     {
      _isOK =  isClass(configFile >> "CfgVehicles" >> _x);
      if (_isOK) then {
       _block =  getNumber(configFile >> "CfgVehicles" >> _x >> "stopThis") == 1;
       if (!_block) then {
        _object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
       };
      };
      _countr = _countr + 1;
     } forEach _objWpnTypes;
    };
   }; 
   
   if (_object isKindOf "AllVehicles") then {
    {
     _selection = _x select 0;
     _dam = _x select 1;
     if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
     [_object,_selection,_dam] call object_setFixServer;
    } forEach _hitpoints;

    _object setFuel _fuel;

    if (!((typeOf _object) in dayz_allowedObjects)) then {
     
     _object setvelocity [0,0,1];
     _object call fnc_veh_ResetEH;  
     
     if(_ownerID != "0") then {
      _object setvehiclelock "locked";
     };
     
     _totalvehicles = _totalvehicles + 1;

     // total each vehicle
     serverVehicleCounter set [count serverVehicleCounter,_type];
    };
   };

   //Monitor the object
   dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
  };
 } forEach _objectArray;
 // # END OF STREAMING #

 // preload server traders menu data into cache
 {
  // get tids
  _traderData = call compile format["menu_%1;",_x];
  if(!isNil "_traderData") then {
   {
    _traderid = _x select 1;

    _retrader = [];

    _key = format["CHILD:399:%1:",_traderid];
    _data = "HiveEXT" callExtension _key;

    //diag_log "HIVE: Request sent";
  
    //Process result
    _result = call compile format ["%1",_data];
    _status = _result select 0;
  
    if (_status == "ObjectStreamStart") then {
     _val = _result select 1;
     //Stream Objects
     //diag_log ("HIVE: Commence Menu Streaming...");
     call compile format["ServerTcache_%1 = [];",_traderid];
     for "_i" from 1 to _val do {
      _data = "HiveEXT" callExtension _key;
      _result = call compile format ["%1",_data];
      call compile format["ServerTcache_%1 set [count ServerTcache_%1,%2]",_traderid,_result];
      _retrader set [count _retrader,_result];
     };
     //diag_log ("HIVE: Streamed " + str(_val) + " objects");
    };

   } forEach (_traderData select 0);
  };
 } forEach serverTraders;

 //  spawn_vehicles
 _vehLimit = MaxVehicleLimit - _totalvehicles;
 diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
 if(_vehLimit > 0) then {
  for "_x" from 1 to _vehLimit do {
   [] spawn spawn_vehicles;
  };
 };
 //  spawn_roadblocks
 diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));
 for "_x" from 1 to MaxDynamicDebris do {
  [] spawn spawn_roadblocks;
 };

 if(isnil "dayz_MapArea") then {
  dayz_MapArea = 10000;
 };
 if(isnil "HeliCrashArea") then {
  HeliCrashArea = dayz_MapArea / 2;
 };
 if(isnil "OldHeliCrash") then {
  OldHeliCrash = false;
 };

 allowConnection = true;

 // [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire]
 if(OldHeliCrash) then {
  nul = [3, 4, (50 * 60), (15 * 60), 0.75, 'center', HeliCrashArea, true, false] spawn server_spawnCrashSite;
 };

 if (isDedicated) then {
  // Epoch Events
  _id = [] spawn server_spawnEvents;
  // server cleanup
  _id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
 };

 
 sm_done = true;
 publicVariable "sm_done";
};

Link to comment
Share on other sites

You have:

 

if ((count playableUnits == 0) and !isDedicated) then {

if ((count playableUnits == 0) and !isDedicated) then {

 

There should only be one, so remove one of them. If you still have the problem, make a paste in http://pastebin.com/ - makes it easier for people to read and we can quote line numbers back to you. its a little late but that was the first problem I saw, check the rest of your code for similar duplicates.

Link to comment
Share on other sites

Hi, I seem to be having a small problem with the indestructible modular items. They behave as expected and become indestructible after restart, but after about 6 days they begin to be cleaned up. I suspect its cleanup doing it as the items always disappear in the exact order they were placed and over the course of a couple of days (the time it took to build the base). I have adjusted my cleanup setting to 30 days but it seems to happen after 6 or so dayz.

 

This is how my HiveExt.ini is set;

;Which table should the objects be stored and fetched from ?
;Table = Object_DATA

;Negative values will disable this feature
;0 means that ALL empty placed items will be deleted every server restart
;A positive number is how old (in days) a placed empty item must be, in order for it to be deleted
;CleanupPlacedAfterDays = 30

;Flag indicating whether hiveext should detect vehicles out of map boundaries (X < 0, or Y > 15360) and reset their position to []
;Note: YOU MUST have a proper dayz_server.pbo that supports this feature, otherwise you will get script errors
;You can find that file under the SQF directory for your server version
;ResetOOBVehicles = false

;If using OFFICIAL hive, the settings in this section have no effect, it will manage objects on its own

 And this is my server_monitor.sqf

private ["_result","_pos","_wsDone","_dir","_block","_isOK","_countr","_objWpnTypes","_objWpnQty","_dam","_selection","_totalvehicles","_object","_idKey","_type","_ownerID","_worldspace","_intentory","_hitPoints","_fuel","_damage","_date","_script","_key","_outcome","_vehLimit","_hiveResponse","_objectCount","_codeCount","_objectArray","_year","_month","_day","_hour","_minute","_data","_status","_val","_traderid","_retrader","_traderData","_id"];
[]execVM "\z\addons\dayz_server\system\s_fps.sqf"; //server monitor FPS (writes each ~181s diag_fps+181s diag_fpsmin*)

dayz_versionNo = 		getText(configFile >> "CfgMods" >> "DayZ" >> "version");
dayz_hiveVersionNo = 	getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
_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",
"CinderWallDoorLocked_DZ",
"LightPole_DZ"
];
// ### [CPC] Indestructible Buildables Fix
if ((count playableUnits == 0) and !isDedicated) then {
	isSinglePlayer = true;
};

waitUntil{initialized}; //means all the functions are now defined

diag_log "HIVE: Starting";

waituntil{isNil "sm_done"}; // prevent server_monitor be called twice (bug during login of the first player)

//Set the Time
//Send request
_key = "CHILD:307:";
_result = _key call server_hiveReadWrite;
_outcome = _result select 0;
if(_outcome == "PASS") then {
	_date = _result select 1; 
		
	if(dayz_fullMoonNights) then {
		//date setup
		_year = _date select 0;
		_month = _date select 1;
		_day = _date select 2;
		_hour = _date select 3;
		_minute = _date select 4;
		
		//Force full moon nights
		_date = [2012,6,6,_hour,_minute];
	};
		
	if(isDedicated) then {
		setDate _date;
		dayzSetDate = _date;
		publicVariable "dayzSetDate";
	};

	diag_log ("HIVE: Local Time set to " + str(_date));
};

	
// Custom Configs
if(isnil "MaxVehicleLimit") then {
	MaxVehicleLimit = 50;
};
if(isnil "MaxHeliCrashes") then {
	MaxHeliCrashes = 5;
};
if(isnil "MaxDynamicDebris") then {
	MaxDynamicDebris = 100;
};
// Custon Configs End

if (isServer and isNil "sm_done") then {

	serverVehicleCounter = [];
	_hiveResponse = [];

	for "_i" from 1 to 5 do {
		diag_log "HIVE: trying to get objects";
		_key = format["CHILD:302:%1:", dayZ_instance];
		_hiveResponse = _key call server_hiveReadWrite;  
		if ((((isnil "_hiveResponse") || {(typeName _hiveResponse != "ARRAY")}) || {((typeName (_hiveResponse select 1)) != "SCALAR")})) then {
			diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse));
			_hiveResponse = ["",0];
		} 
		else {
			diag_log ("HIVE: found "+str(_hiveResponse select 1)+" objects" );
			_i = 99; // break
		};
	};

	_objectArray = [];
	if ((_hiveResponse select 0) == "ObjectStreamStart") then {
		_objectCount = _hiveResponse select 1;
		diag_log ("HIVE: Commence Object Streaming...");
		for "_i" from 1 to _objectCount do { 
			_hiveResponse = _key call server_hiveReadWrite;
			_objectArray set [_i - 1, _hiveResponse];
			//diag_log (format["HIVE dbg %1 %2", typeName _hiveResponse, _hiveResponse]);
		};
		diag_log ("HIVE: got " + str(count _objectArray) + " objects");
	};

	// # START OF STREAMING #
	_countr = 0;	
	_totalvehicles = 0;
	{
		//Parse Array
		_countr = _countr + 1;

		_idKey = 	_x select 1;
		_type =		_x select 2;
		_ownerID = 	_x select 3;

		_worldspace = _x select 4;
		_intentory=	_x select 5;
		_hitPoints=	_x select 6;
		_fuel =		_x select 7;
		_damage = 	_x select 8;

		_dir = 0;
		_pos = [0,0,0];
		_wsDone = false;
		if (count _worldspace >= 2) then
		{
			_dir = _worldspace select 0;
			if (count (_worldspace select 1) == 3) then {
				_pos = _worldspace select 1;
				_wsDone = true;
			}
		};			
		if (!_wsDone) then {
			if (count _worldspace >= 1) then { _dir = _worldspace select 0; };
			_pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
			if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
			diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
		};

		if (_damage < 1) then {
			//diag_log format["OBJ: %1 - %2", _idKey,_type];
			
			//Create it
			_object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
			_object setVariable ["lastUpdate",time];
			_object setVariable ["ObjectID", _idKey, true];

			_lockable = 0;
			if(isNumber (configFile >> "CfgVehicles" >> _type >> "lockable")) then {
				_lockable = getNumber(configFile >> "CfgVehicles" >> _type >> "lockable");
			};

			// fix for leading zero issues on safe codes after restart
			if (_lockable == 4) then {
				_codeCount = (count (toArray _ownerID));
				if(_codeCount == 3) then {
					_ownerID = format["0%1", _ownerID];
				};
				if(_codeCount == 2) then {
					_ownerID = format["00%1", _ownerID];
				};
				if(_codeCount == 1) then {
					_ownerID = format["000%1", _ownerID];
				};
			};

			if (_lockable == 3) then {
				_codeCount = (count (toArray _ownerID));
				if(_codeCount == 2) then {
					_ownerID = format["0%1", _ownerID];
				};
				if(_codeCount == 1) then {
					_ownerID = format["00%1", _ownerID];
				};
			};

			_object setVariable ["CharacterID", _ownerID, true];
			
			clearWeaponCargoGlobal  _object;
			clearMagazineCargoGlobal  _object;
			
			if ((typeOf _object) in dayz_allowedObjects) then {
				_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
				// Test disabling simulation server side on buildables only.
				_object enableSimulation false;
				// used for inplace upgrades and lock/unlock of safe
				_object setVariable ["OEMPos", _pos, true];
			};
			
			_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

			if (count _intentory > 0) then {
				if (_type in DZE_LockedStorage) then {
					// Fill variables with loot
					_object setVariable ["WeaponCargo", (_intentory select 0), true];
					_object setVariable ["MagazineCargo", (_intentory select 1), true];
					_object setVariable ["BackpackCargo", (_intentory select 2), true];
				} else {

					//Add weapons
					_objWpnTypes = (_intentory select 0) select 0;
					_objWpnQty = (_intentory select 0) select 1;
					_countr = 0;					
					{
						if (_x == "Crossbow") then { _x = "Crossbow_DZ" }; // Convert Crossbow to Crossbow_DZ
						_isOK = 	isClass(configFile >> "CfgWeapons" >> _x);
						if (_isOK) then {
							_block = 	getNumber(configFile >> "CfgWeapons" >> _x >> "stopThis") == 1;
							if (!_block) then {
								_object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
							};
						};
						_countr = _countr + 1;
					} forEach _objWpnTypes; 
				
					//Add Magazines
					_objWpnTypes = (_intentory select 1) select 0;
					_objWpnQty = (_intentory select 1) select 1;
					_countr = 0;
					{
						if (_x == "BoltSteel") then { _x = "WoodenArrow" }; // Convert BoltSteel to WoodenArrow
						if (_x == "ItemTent") then { _x = "ItemTentOld" };
						_isOK = 	isClass(configFile >> "CfgMagazines" >> _x);
						if (_isOK) then {
							_block = 	getNumber(configFile >> "CfgMagazines" >> _x >> "stopThis") == 1;
							if (!_block) then {
								_object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
							};
						};
						_countr = _countr + 1;
					} forEach _objWpnTypes;

					//Add Backpacks
					_objWpnTypes = (_intentory select 2) select 0;
					_objWpnQty = (_intentory select 2) select 1;
					_countr = 0;
					{
						_isOK = 	isClass(configFile >> "CfgVehicles" >> _x);
						if (_isOK) then {
							_block = 	getNumber(configFile >> "CfgVehicles" >> _x >> "stopThis") == 1;
							if (!_block) then {
								_object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
							};
						};
						_countr = _countr + 1;
					} forEach _objWpnTypes;
				};
			};	
			
			if (_object isKindOf "AllVehicles") then {
				{
					_selection = _x select 0;
					_dam = _x select 1;
					if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
					[_object,_selection,_dam] call object_setFixServer;
				} forEach _hitpoints;

				_object setFuel _fuel;

				if (!((typeOf _object) in dayz_allowedObjects)) then {
					
					_object setvelocity [0,0,1];
					_object call fnc_veh_ResetEH;		
					
					if(_ownerID != "0") then {
						_object setvehiclelock "locked";
					};
					
					_totalvehicles = _totalvehicles + 1;

					// total each vehicle
					serverVehicleCounter set [count serverVehicleCounter,_type];
				};
			};

			//Monitor the object
			dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
		};
	} forEach _objectArray;
	// # END OF STREAMING #


	// preload server traders menu data into cache
	{
		// get tids
		_traderData = call compile format["menu_%1;",_x];
		if(!isNil "_traderData") then {
			{
				_traderid = _x select 1;

				_retrader = [];

				_key = format["CHILD:399:%1:",_traderid];
				_data = "HiveEXT" callExtension _key;

				//diag_log "HIVE: Request sent";
		
				//Process result
				_result = call compile format ["%1",_data];
				_status = _result select 0;
		
				if (_status == "ObjectStreamStart") then {
					_val = _result select 1;
					//Stream Objects
					//diag_log ("HIVE: Commence Menu Streaming...");
					call compile format["ServerTcache_%1 = [];",_traderid];
					for "_i" from 1 to _val do {
						_data = "HiveEXT" callExtension _key;
						_result = call compile format ["%1",_data];
						call compile format["ServerTcache_%1 set [count ServerTcache_%1,%2]",_traderid,_result];
						_retrader set [count _retrader,_result];
					};
					//diag_log ("HIVE: Streamed " + str(_val) + " objects");
				};

			} forEach (_traderData select 0);
		};
	} forEach serverTraders;

	//  spawn_vehicles
	_vehLimit = MaxVehicleLimit - _totalvehicles;
	diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
	if(_vehLimit > 0) then {
		for "_x" from 1 to _vehLimit do {
			[] spawn spawn_vehicles;
		};
	};
	//  spawn_roadblocks
	diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));
	for "_x" from 1 to MaxDynamicDebris do {
		[] spawn spawn_roadblocks;
	};

	if(isnil "dayz_MapArea") then {
		dayz_MapArea = 10000;
	};
	if(isnil "HeliCrashArea") then {
		HeliCrashArea = dayz_MapArea / 2;
	};
	if(isnil "OldHeliCrash") then {
		OldHeliCrash = false;
	};

	allowConnection = true;

	// [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire]
	if(OldHeliCrash) then {
		nul = [3, 4, (50 * 60), (15 * 60), 0.75, 'center', HeliCrashArea, true, false] spawn server_spawnCrashSite;
	};

	if (isDedicated) then {
		// Epoch Events
		_id = [] spawn server_spawnEvents;
		// server cleanup
		_id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
	};

	
	sm_done = true;
	publicVariable "sm_done";
};

Does anyone have any ideas whats going on?

Link to comment
Share on other sites

Very nice script, works perfectly.

 

But it seems to create a conflict with this mod:

 

http://opendayz.net/threads/release-dayzchernarus-mission-system.12169/

ATM i'm figuring out what causes the problem, but after i installed the indestructible base mod, the missions didn't start, no markers, no announcements etc. So it seems the trigger that starts everything within the mission script isn't being pulled ;p

 

Someone has some suggestions on this one?

Link to comment
Share on other sites

Very nice script, works perfectly.

 

But it seems to create a conflict with this mod:

 

http://opendayz.net/threads/release-dayzchernarus-mission-system.12169/

ATM i'm figuring out what causes the problem, but after i installed the indestructible base mod, the missions didn't start, no markers, no announcements etc. So it seems the trigger that starts everything within the mission script isn't being pulled ;p

 

Someone has some suggestions on this one?

 

Both of them work perfectly fine together. You must have made a mistake somewhere

Link to comment
Share on other sites

Hopefully someone here can help me.... I am running Dayz Epoch 1.0.2.3 and I am having troubles getting part 1 to work. I edit the "server_monitor.sqf" as stated in the @Dayz_Epoch_Server/addons/dayz_server.pbo and every time I repack and upload to server it just hangs in "waiting for server to send authentication" and then sometimes just go to debug. Tried for 2 dayz now and have been reading through other posts and can't seem to find anyone having the issue I have.

 

I am using PBO Manager v1.4 beta to unpack and repack

 

Thanks in advance to anyone able to help!

private ["_result","_pos","_wsDone","_dir","_block","_isOK","_countr","_objWpnTypes","_objWpnQty","_dam","_selection","_totalvehicles","_object","_idKey","_type","_ownerID","_worldspace","_intentory","_hitPoints","_fuel","_damage","_date","_script","_key","_outcome","_vehLimit","_hiveResponse","_objectCount","_codeCount","_objectArray","_year","_month","_day","_hour","_minute","_data","_status","_val","_traderid","_retrader","_traderData","_id"];
[]execVM "\z\addons\dayz_server\system\s_fps.sqf"; //server monitor FPS (writes each ~181s diag_fps+181s diag_fpsmin*)

dayz_versionNo = 		getText(configFile >> "CfgMods" >> "DayZ" >> "version");
dayz_hiveVersionNo = 	getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
_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 {
	isSinglePlayer = true;
};

waitUntil{initialized}; //means all the functions are now defined

diag_log "HIVE: Starting";

waituntil{isNil "sm_done"}; // prevent server_monitor be called twice (bug during login of the first player)

//Set the Time
//Send request
_key = "CHILD:307:";
_result = _key call server_hiveReadWrite;
_outcome = _result select 0;
if(_outcome == "PASS") then {
	_date = _result select 1; 
		
	if(dayz_fullMoonNights) then {
		//date setup
		_year = _date select 0;
		_month = _date select 1;
		_day = _date select 2;
		_hour = _date select 3;
		_minute = _date select 4;
		
		//Force full moon nights
		_date = [2012,6,6,_hour,_minute];
	};
		
	if(isDedicated) then {
		setDate _date;
		dayzSetDate = _date;
		publicVariable "dayzSetDate";
	};

	diag_log ("HIVE: Local Time set to " + str(_date));
};

	
// Custom Configs
if(isnil "MaxVehicleLimit") then {
	MaxVehicleLimit = 50;
};
if(isnil "MaxHeliCrashes") then {
	MaxHeliCrashes = 5;
};
if(isnil "MaxDynamicDebris") then {
	MaxDynamicDebris = 100;
};
// Custon Configs End

if (isServer and isNil "sm_done") then {

	serverVehicleCounter = [];
	_hiveResponse = [];

	for "_i" from 1 to 5 do {
		diag_log "HIVE: trying to get objects";
		_key = format["CHILD:302:%1:", dayZ_instance];
		_hiveResponse = _key call server_hiveReadWrite;  
		if ((((isnil "_hiveResponse") || {(typeName _hiveResponse != "ARRAY")}) || {((typeName (_hiveResponse select 1)) != "SCALAR")})) then {
			diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse));
			_hiveResponse = ["",0];
		} 
		else {
			diag_log ("HIVE: found "+str(_hiveResponse select 1)+" objects" );
			_i = 99; // break
		};
	};

	_objectArray = [];
	if ((_hiveResponse select 0) == "ObjectStreamStart") then {
		_objectCount = _hiveResponse select 1;
		diag_log ("HIVE: Commence Object Streaming...");
		for "_i" from 1 to _objectCount do { 
			_hiveResponse = _key call server_hiveReadWrite;
			_objectArray set [_i - 1, _hiveResponse];
			//diag_log (format["HIVE dbg %1 %2", typeName _hiveResponse, _hiveResponse]);
		};
		diag_log ("HIVE: got " + str(count _objectArray) + " objects");
	};

	// # START OF STREAMING #
	_countr = 0;	
	_totalvehicles = 0;
	{
		//Parse Array
		_countr = _countr + 1;

		_idKey = 	_x select 1;
		_type =		_x select 2;
		_ownerID = 	_x select 3;

		_worldspace = _x select 4;
		_intentory=	_x select 5;
		_hitPoints=	_x select 6;
		_fuel =		_x select 7;
		_damage = 	_x select 8;

		_dir = 0;
		_pos = [0,0,0];
		_wsDone = false;
		if (count _worldspace >= 2) then
		{
			_dir = _worldspace select 0;
			if (count (_worldspace select 1) == 3) then {
				_pos = _worldspace select 1;
				_wsDone = true;
			}
		};			
		if (!_wsDone) then {
			if (count _worldspace >= 1) then { _dir = _worldspace select 0; };
			_pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
			if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
			diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
		};

		if (_damage < 1) then {
			//diag_log format["OBJ: %1 - %2", _idKey,_type];
			
			//Create it
			_object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
			_object setVariable ["lastUpdate",time];
			_object setVariable ["ObjectID", _idKey, true];

			_lockable = 0;
			if(isNumber (configFile >> "CfgVehicles" >> _type >> "lockable")) then {
				_lockable = getNumber(configFile >> "CfgVehicles" >> _type >> "lockable");
			};

			// fix for leading zero issues on safe codes after restart
			if (_lockable == 4) then {
				_codeCount = (count (toArray _ownerID));
				if(_codeCount == 3) then {
					_ownerID = format["0%1", _ownerID];
				};
				if(_codeCount == 2) then {
					_ownerID = format["00%1", _ownerID];
				};
				if(_codeCount == 1) then {
					_ownerID = format["000%1", _ownerID];
				};
			};

			if (_lockable == 3) then {
				_codeCount = (count (toArray _ownerID));
				if(_codeCount == 2) then {
					_ownerID = format["0%1", _ownerID];
				};
				if(_codeCount == 1) then {
					_ownerID = format["00%1", _ownerID];
				};
			};

			_object setVariable ["CharacterID", _ownerID, true];
			
			clearWeaponCargoGlobal  _object;
			clearMagazineCargoGlobal  _object;
			
			if ((typeOf _object) in dayz_allowedObjects) then {
				_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
				// Test disabling simulation server side on buildables only.
				_object enableSimulation false;
				// used for inplace upgrades and lock/unlock of safe
				_object setVariable ["OEMPos", _pos, true];
			};
			
			_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

			if (count _intentory > 0) then {
				if (_type in DZE_LockedStorage) then {
					// Fill variables with loot
					_object setVariable ["WeaponCargo", (_intentory select 0), true];
					_object setVariable ["MagazineCargo", (_intentory select 1), true];
					_object setVariable ["BackpackCargo", (_intentory select 2), true];
				} else {

					//Add weapons
					_objWpnTypes = (_intentory select 0) select 0;
					_objWpnQty = (_intentory select 0) select 1;
					_countr = 0;					
					{
						if (_x == "Crossbow") then { _x = "Crossbow_DZ" }; // Convert Crossbow to Crossbow_DZ
						_isOK = 	isClass(configFile >> "CfgWeapons" >> _x);
						if (_isOK) then {
							_block = 	getNumber(configFile >> "CfgWeapons" >> _x >> "stopThis") == 1;
							if (!_block) then {
								_object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
							};
						};
						_countr = _countr + 1;
					} forEach _objWpnTypes; 
				
					//Add Magazines
					_objWpnTypes = (_intentory select 1) select 0;
					_objWpnQty = (_intentory select 1) select 1;
					_countr = 0;
					{
						if (_x == "BoltSteel") then { _x = "WoodenArrow" }; // Convert BoltSteel to WoodenArrow
						if (_x == "ItemTent") then { _x = "ItemTentOld" };
						_isOK = 	isClass(configFile >> "CfgMagazines" >> _x);
						if (_isOK) then {
							_block = 	getNumber(configFile >> "CfgMagazines" >> _x >> "stopThis") == 1;
							if (!_block) then {
								_object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
							};
						};
						_countr = _countr + 1;
					} forEach _objWpnTypes;

					//Add Backpacks
					_objWpnTypes = (_intentory select 2) select 0;
					_objWpnQty = (_intentory select 2) select 1;
					_countr = 0;
					{
						_isOK = 	isClass(configFile >> "CfgVehicles" >> _x);
						if (_isOK) then {
							_block = 	getNumber(configFile >> "CfgVehicles" >> _x >> "stopThis") == 1;
							if (!_block) then {
								_object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
							};
						};
						_countr = _countr + 1;
					} forEach _objWpnTypes;
				};
			};	
			
			if (_object isKindOf "AllVehicles") then {
				{
					_selection = _x select 0;
					_dam = _x select 1;
					if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
					[_object,_selection,_dam] call object_setFixServer;
				} forEach _hitpoints;

				_object setFuel _fuel;

				if (!((typeOf _object) in dayz_allowedObjects)) then {
					
					_object setvelocity [0,0,1];
					_object call fnc_veh_ResetEH;		
					
					if(_ownerID != "0") then {
						_object setvehiclelock "locked";
					};
					
					_totalvehicles = _totalvehicles + 1;

					// total each vehicle
					serverVehicleCounter set [count serverVehicleCounter,_type];
				};
			};

			//Monitor the object
			dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
		};
	} forEach _objectArray;
	// # END OF STREAMING #


	// preload server traders menu data into cache
	{
		// get tids
		_traderData = call compile format["menu_%1;",_x];
		if(!isNil "_traderData") then {
			{
				_traderid = _x select 1;

				_retrader = [];

				_key = format["CHILD:399:%1:",_traderid];
				_data = "HiveEXT" callExtension _key;

				//diag_log "HIVE: Request sent";
		
				//Process result
				_result = call compile format ["%1",_data];
				_status = _result select 0;
		
				if (_status == "ObjectStreamStart") then {
					_val = _result select 1;
					//Stream Objects
					//diag_log ("HIVE: Commence Menu Streaming...");
					call compile format["ServerTcache_%1 = [];",_traderid];
					for "_i" from 1 to _val do {
						_data = "HiveEXT" callExtension _key;
						_result = call compile format ["%1",_data];
						call compile format["ServerTcache_%1 set [count ServerTcache_%1,%2]",_traderid,_result];
						_retrader set [count _retrader,_result];
					};
					//diag_log ("HIVE: Streamed " + str(_val) + " objects");
				};

			} forEach (_traderData select 0);
		};
	} forEach serverTraders;

	//  spawn_vehicles
	_vehLimit = MaxVehicleLimit - _totalvehicles;
	diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
	if(_vehLimit > 0) then {
		for "_x" from 1 to _vehLimit do {
			[] spawn spawn_vehicles;
		};
	};
	//  spawn_roadblocks
	diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));
	for "_x" from 1 to MaxDynamicDebris do {
		[] spawn spawn_roadblocks;
	};

	if(isnil "dayz_MapArea") then {
		dayz_MapArea = 10000;
	};
	if(isnil "HeliCrashArea") then {
		HeliCrashArea = dayz_MapArea / 2;
	};
	if(isnil "OldHeliCrash") then {
		OldHeliCrash = false;
	};

	allowConnection = true;

	// [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire]
	if(OldHeliCrash) then {
		nul = [3, 4, (50 * 60), (15 * 60), 0.75, 'center', HeliCrashArea, true, false] spawn server_spawnCrashSite;
	};

	if (isDedicated) then {
		// Epoch Events
		_id = [] spawn server_spawnEvents;
		// server cleanup
		_id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
	};

	
	sm_done = true;
	publicVariable "sm_done";
};

Link to comment
Share on other sites

dosnt work for me on 1.0.2.4

 

Locked vehicle can not unlocked an vaults can not unlocked...

 

can anybody help?

 

I think you changed the wrong part in PART3: Prevent Maintenance Exploit

 

Remember there is now a // downgrade system section also for removing locks. Don't change this section.

 

You need to change the "// inplace maintenance tool" part of the if like this:

	// downgrade system
	if((_isDestructable or _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" or _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") and (DZE_Lock_Door == _ownerID)) then {
		if ((s_player_lastTarget select 1) != _cursorTarget) then {
			if (s_player_downgrade_build > 0) then {	
				player removeAction s_player_downgrade_build;
				s_player_downgrade_build = -1;
			};
		};

		if (s_player_downgrade_build < 0) then {
			s_player_lastTarget set [1,_cursorTarget];
			s_player_downgrade_build = player addAction [format["Remove Lock from %1",_text], "\z\addons\dayz_code\actions\player_buildingDowngrade.sqf",_cursorTarget, -2, false, true, "",""];
		};
	} else {
		player removeAction s_player_downgrade_build;
		s_player_downgrade_build = -1;
	};

	// inplace maintenance tool
	if((_cursorTarget isKindOf "ModularItems" or _cursorTarget isKindOf "DZE_Housebase") and (damage _cursorTarget >= 0.1)) then {
		if ((s_player_lastTarget select 2) != _cursorTarget) then {
			if (s_player_maint_build > 0) then {	
				player removeAction s_player_maint_build;
				s_player_maint_build = -1;
			};
		};

		if (s_player_maint_build < 0) then {
			s_player_lastTarget set [2,_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 {

Hope I wrote that right atm

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