Jump to content

[Release] - A Plot for life v2.5. Keep your buildables on death. Take plot ownership


Recommended Posts

Got a strange issue where when players put down a lockbox or safe they get the code but they can't interact with either of them until after restart, it's like they're just not there, would this mod interfere with that at all?

Link to comment
Share on other sites

Got a strange issue where when players put down a lockbox or safe they get the code but they can't interact with either of them until after restart, it's like they're just not there, would this mod interfere with that at all?

 

I haven't tried with lockboxes but I didn't have the issue with safes.  Anyone should be able to try to open the safe with the combination so ownership only matters if the safe is being opened by the owner (i.e. they do not need to put in the combination).

 

A slightly older version of this mod did have an issue like the one you describe but that was fixed in the v2.2.3 release.  Have a look in vault_unpack.sqf and look for the following around line 160.

_tent setVariable ["CharacterID",_combination,true];
_object setVariable ["ownerPUID",_playerUID,true];          // <-  This was missing in older versions.
_tent setVariable ["OEMPos",_location,true];

//["PVDZE_obj_Publish",[_combination,_tent,[_dir,_location],"VaultStorageLocked"]] call callRpcProcedure;
PVDZE_obj_Publish = [_combination,_tent,[_dir,_location, _playerUID],"VaultStorageLocked"];
publicVariableServer "PVDZE_obj_Publish";
Link to comment
Share on other sites

Where are you  suppose to place the player_build.sqf when running both P4L and Snap_Pro? I have one in each folder and they're conflicting, I know one was made that said it merged the two together so they could both work, but where is that modded player_build.sqf actually being placed? In the snap folder or the P4L folder? I have tried all manner of variations but I cannot get them both to be fully functional at the same time, separate yes, together no. Anyone?

Link to comment
Share on other sites

Where are you  suppose to place the player_build.sqf when running both P4L and Snap_Pro? I have one in each folder and they're conflicting, I know one was made that said it merged the two together so they could both work, but where is that modded player_build.sqf actually being placed? In the snap folder or the P4L folder? I have tried all manner of variations but I cannot get them both to be fully functional at the same time, separate yes, together no. Anyone?

 

Put it anywhere you like and make sure the compiles.sqf only has one player_build line and that that line points to that merged file.  There should be no references to the player_build files that came with the P3L or SBPro mods, just the one merged player_build.sqf wherever you decide to place it (almost anywhere is good so just take your pick).

 

How about creating a custom/common folder and putting it there.  You could then store any common files that are merged with updates from multiple mods in there.  You could then reference it via "custom/common/player_build.sqf".

 

Note that SBPro install instructions tell you to link that mods compiles to the normal compiles you are using.  Make sure the SBPro player_build line is also commented out "//" or removed.

Link to comment
Share on other sites

Thanks for getting back to me so quickly RimBlock, so I've checked my vault_pitch.sqf (I didn't see a vault_unpack.sqf there) and at line 160 I have:

 

_tent setVariable ["CharacterID",_combination,true];
_object setVariable ["ownerPUID",_playerUID,true];
_tent setVariable ["OEMPos",_location,true];


//["PVDZE_obj_Publish",[_combination,_tent,[_dir,_location],"VaultStorageLocked"]] call callRpcProcedure;
PVDZE_obj_Publish = [_combination,_tent,[_dir,_location, _playerUID],"VaultStorageLocked"];
publicVariableServer  "PVDZE_obj_Publish";

This is version 2.2.2 though, is there something else in 2.2.3 that might fix it? I'll update to 2.2.3 tonight anyway, It's just not fun since I have to merge it with Snap Building :P

Link to comment
Share on other sites

There were small fixes around the vaults and door codes I believe.

 

Grab a copy of Windiff and compare the files.  Only 4 of the files were affected I think and player_build was not one of them so you should not have an issue with merging :) .

 

In fact, download v2.2.3 and copy everything apart from player_build.sqf over the v2.2.2 version and you should be good and not have to merge for Snap Build.

Link to comment
Share on other sites

Put it anywhere you like and make sure the compiles.sqf only has one player_build line and that that line points to that merged file.  There should be no references to the player_build files that came with the P3L or SBPro mods, just the one merged player_build.sqf wherever you decide to place it (almost anywhere is good so just take your pick).

 

How about creating a custom/common folder and putting it there.  You could then store any common files that are merged with updates from multiple mods in there.  You could then reference it via "custom/common/player_build.sqf".

 

Note that SBPro install instructions tell you to link that mods compiles to the normal compiles you are using.  Make sure the SBPro player_build line is also commented out "//" or removed.

Well that's the thing, I took the merged files download you linked and used the player_build.sqf out of that, I copied it's content's and pasted it to the player_build that comes in the Snap_Pro, I then pointed the main compiles.sqf and the custom compiles.sqf that comes with snap_pro at that player_build.sqf. If that is the merged file that works for both mods then that should work just fine, the player_build.sqf is not conflicting because only one of them is being called by both compiles.sqf. I tried using all of the files that came with that modded merged file but I found some errors in some of the files and cannot tell where some of them are even being called from. So rather than use all of those files from the merged mod I only took out the player_build.sqf and am using that.

Link to comment
Share on other sites

The player_build in 2.2.3 has not changed.  It is the other files that have changed.

 

Download P4L v2.2.3

Download the player_build.sqf that PyrMary has made available (also in the first post).

Download Snap Build Pro

 

Extract the files to their places in the mpmissions/[map]/ folder and put the server_monitor.sqf in the dayz_server.pbo file.

 

Put pryMays player_build somewhere.

 

Copy everything from SnapBuildPro compiles in to the P4L compiles file except the line for player_build.

 

Find the player_build in the P4L compiles and change the path to the player_build by PryMary.

 

I think that is more or less it.

Link to comment
Share on other sites

If people are having issues with safes access if the player is not the safes owner and the safe is a legacy safe (i.e. placed before this mod), try this...

 

Open the fn_selfactions.sqf file 

find

if((_typeOfCursorTarget in DZE_LockableStorage) && _ownerID != "0" && (player distance _cursorTarget < 3)) then {

change to

if((_typeOfCursorTarget in DZE_LockableStorage) && _characterID != "0" && (player distance _cursorTarget < 3)) then {

The reason is that if items do not have a ownerUID already they are given an ownerUID of 0 when loaded.  

 

I believe the check is to make sure someone cannot lock / unlock safes whilst they are being packed or unpacked (i.e. before they are allocated a lock code) so I have reverted it to the characterID.

Link to comment
Share on other sites

Quick question.  I have a heavily scripted Overpoch server.  If I do not want to use your entire init.sqf because I do not want to to overwrite all my other scripts could I simply add the following line to my current init.sqf?

 

[] execVM "custom\APlotForLifeV2.2.1\server_monitor.sqf";

 

Thanks for the help in advance :)

 

zkirby

Link to comment
Share on other sites

Yep I just did and the only lines I see that are additional are the following:

 

[] execVM "custom\APlotPoleForLifeV2.2.1\server_monitor.sqf";

daig_log format["[_serverMonitor: %1]",_serverMonitor];

 

diag_log text "Init.sqf Is Server End.";

 

And I believe only the first line is needed to call the Plot Pole For Life script but I'm not entirely sure.

 

zkirby

Link to comment
Share on other sites

Ok was hoping for a little help.  The install instructions are a little vague to me or maybe I'm just dense lol.  Either way can someone please provide a better explanation of how to install this script onto an already heavily scripted server?  I do not want to use the init.sqf that comes with this mod and when I try to just replace the lines in my init.sqf with the ones form this mod my server refuses to start.  I simply get stuck at authenticating player...

 

UPDATE:  Never mind for now I was dropping the files into my server pbo not my mission pbo.  I'll play around a little more with it :)

 

zkirby

Link to comment
Share on other sites

zkirby, correct you can just add that line into your existing init.

 

I personally had to do a heap of merging because I have snap building, CPC invulnerable bases and this mod so it was hell to install. Ended up with modifications to the files all over the place but I just compared them in Notepad++ and copied over the lines of code needed. If you're unsure I recommend doing that, getting the compare plugin for Notepad++ and just running through the files line by line to make sure you don't leave anything out, if you already have a custom compiles don't use the one provided just change the lines that are different. So long as it references the right files it'll work.

Link to comment
Share on other sites

The player_build in 2.2.3 has not changed.  It is the other files that have changed.

 

Download P4L v2.2.3

Download the player_build.sqf that PyrMary has made available (also in the first post).

Download Snap Build Pro

 

Extract the files to their places in the mpmissions/[map]/ folder and put the server_monitor.sqf in the dayz_server.pbo file.

 

Put pryMays player_build somewhere.

 

Copy everything from SnapBuildPro compiles in to the P4L compiles file except the line for player_build.

 

Find the player_build in the P4L compiles and change the path to the player_build by PryMary.

 

I think that is more or less it.

This isn't working, I have 1 compiles.sqf that is being called from the init.sqf, that compiles has the information from the Snap_pro copied into it and all the changes needed to make it call the P4L files (which was working before this install). Compiles calls snap_build.sqf and dayz_spaceInterrupt.sqf from snap_pro and calls player_build from the location that I placed the merged player_build.sqf. Everything else is untouched, I have no bloody clue why this isn't working but now I can't even drop anything to build it. I know everything is being called correctly because I can still bloodbag myself which I wrote into the fn_selfactions.

 

Update: I think the problem is that after restart all the objects I placed treat me like I am not the owner, when I got back to the working version of P4L it all works until a restart, which may explain why I thought they weren't working together, maybe they were but because of the restart problem it looks like they're not. Now to figure this problem out..

Link to comment
Share on other sites

Ok so I got snap pro working and P4l working at the same time, didn't even have to use the merged player_build.sqf. I installed both of them as their instructions outline and they both work together no problem, the only issue is that anything I build will not allow me to do anything to it after a server restart, that includes safes, walls, plot poles, anything. Do I need to make a DB entry to get this fixed or are there some lines somewhere that need to be edited because I think in vanilla epoch database objects to not save to the characterID organically after a restart.

 

So I built a few items and verified I could use them, upgrade them and remove them and then restarted, I verfied they no longer worked and then placed new items in a different location and verified those work. Here is a pic of the DB, the steamID does appear in the worldspace for all objects.

post-17435-0-29738700-1405650186_thumb.j

Link to comment
Share on other sites

==================================Step by Step guide================================
I have alot of custom scripts and files in my server, so i decided to look into the custom scripts from RimBlock and search what he has changed so i can make a step by step guide for guys who have the same problem like me. But ok lets start now.
 
Required:

-Time about an hour

-Custom compiles.sqf

-A general knowledge about scripting and formating

-Brain.exe
 
At first here is a file list compare it with your custom folder if some files are missing get them from the DayZ_Code.pbo.

  1. compiles.sqf
  2. fn_damageActions.sqf
  3. fn_selfActions.sqf
  4. player_build.sqf (If you have any kind of snap building, just added the player_build.sqf in the snap building folder)
  5. player_buildingDowngrade.sqf
  6. player_lockvault.sqf (not needed, it was in the folder but RimBlock did no changes to the file, so its equal to the original one)
  7. player_packtent.sqf
  8. player_packvault.sqf
  9. player_tagfriendly.sqf
  10. player_unlockvault.sqf
  11. player_updategui.sqf
  12. player_upgrade.sqf
  13. remove.sqf
  14. server_monitor.sqf (Note dont take the file from the dayz_code.pbo go into your dayz_server.pbo and search for server_monitor.sqf and copy it out)
  15. tent_pitch.sqf
  16. vault_pitch.sqf 

If you checked theese list and maked sure that you have every file, you can start with the compiles.sqf

Remeber, i use my own file path´s, if you have another folder who is not named "Custom" you need to change the path´s to fit your folders.

I also call the custom compiles.sqf twice, so first the original one then the custom one, so my compiles.sqf looks like this:

if (!isDedicated) then {
fnc_usec_damageActions =        compile preprocessFileLineNumbers "Custom\fn_damageActions.sqf";
fnc_usec_selfActions =            compile preprocessFileLineNumbers "Custom\fn_selfActions.sqf";
player_packTent =            compile preprocessFileLineNumbers "Custom\player_packTent.sqf";
player_packVault =            compile preprocessFileLineNumbers "Custom\player_packVault.sqf";
player_unlockVault =            compile preprocessFileLineNumbers "Custom\player_unlockVault.sqf";
player_removeObject =            compile preprocessFileLineNumbers "Custom\remove.sqf";
player_lockVault =            compile preprocessFileLineNumbers "Custom\player_lockVault.sqf";
player_updateGui =            compile preprocessFileLineNumbers "Custom\player_updateGui.sqf";
player_tentPitch =            compile preprocessFileLineNumbers "Custom\tent_pitch.sqf";
player_vaultPitch =            compile preprocessFileLineNumbers "Custom\vault_pitch.sqf";
player_build =                compile preprocessFileLineNumbers "Custom\player_build.sqf";
};


So, now we came to the changes in every file:

  • fn_damageActions.sqf

Find at the private variables at the top:

"_charid"

and replace it with:

"_playerUID"

Find:

_charID =		_unit getVariable ["CharacterID", 0];

Replace with:

_playerUID = 	getPlayerUID player;

Find:

if ((isPlayer _unit) && !(_charID in _friendlies)) then {

Replace with:

if ((isPlayer _unit) && !(_playerUID in _friendlies)) then {

Find:

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

and replace it with your own path which point to your custom player_tagFriendly.sqf for me it looks like this:

"Custom\player_tagFriendly.sqf"

Done!

  •  Fn_sefactions.sqf

Find (again the private section at the top):

"_attached"

and add this behind it

,"_playerUID","_characterID"

Find:

_isMan = _cursorTarget isKindOf "Man";

and add directly above it:

_playerUID = getPlayerUID player;

Find:

_ownerID = _cursorTarget getVariable ["CharacterID","0"];

Replace with:

_ownerID = _cursorTarget getVariable ["ownerPUID","0"];

Directly under this add:

_characterID = _cursorTarget getVariable ["CharacterID","0"];

Find:

//Allow player to delete objects

and add above it:

diag_log format["fn_actons: [PlayerUID: %1] [_ownerID: %2] [_isModularDoor: %3] [typeOfCursorTarget: %4]",_playerUID, _ownerID, _isModularDoor, _typeOfCursorTarget];
diag_log format["[_isDestructable:%1 ] [_isWreck: %2 ] [_isRemovable: %3 ] [_isWreckBuilding: %4 ]",_isDestructable, _isWreck, _isRemovable, _isWreckBuilding];

Find 2 times:

(dayz_characterID == _ownerID))

and replace it with:

(_playerUID == _ownerID))

Find:

if(!_isMan && _ownerID != "0" && !(_cursorTarget isKindOf "Bicycle")) then {

and replace it with:

if(!_isMan && _characterID != "0" && !(_cursorTarget isKindOf "Bicycle")) then {

Find 2x times:

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

and replace it with your own path pointing to your custom remove.sqf for me it looks like this:

"Custom\remove.sqf"

Find:

_hasKey = _ownerID in _temp_keys;
_oldOwner = (_ownerID == dayz_playerUID);

Replace with:
 

_hasKey = _characterID in _temp_keys;
_oldOwner = (_characterID == dayz_playerUID);

Find:

_Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _ownerID))], 2, true, true, "", ""];

Replace with:

_Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _characterID))], 2, true, true, "", ""];

Find:

if (_ownerID == dayz_characterID) then {

Replace with:

if (_ownerID == _playerUID) then {

Find:

if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {

Replace with:

if(_characterID == dayz_combination || _ownerID == _playerUID) then {

Find:

if(_ownerID != dayz_combination && _ownerID != dayz_playerUID) then {

Replace with:

if(_characterID != dayz_combination && _ownerID != _playerUID) then {

Find:

if(_typeOfCursorTarget in DZE_UnLockedStorage && _ownerID != "0" &&

Replace with:

if(_typeOfCursorTarget in DZE_UnLockedStorage && _characterID != "0" &&

Find:

if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {

Replace with:
 

if(_characterID == dayz_combination || _ownerID == dayz_playerUID) then {

Find:

if (s_player_packvault < 0 && (_ownerID == dayz_combination || _ownerID == dayz_playerUID))

Replace with:

if (s_player_packvault < 0 && (_characterID == dayz_combination || _ownerID == dayz_playerUID))

Find:

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

And replace it with your path pointing to player_upgrade:sqf for me it looks like this:

"Custom\player_upgrade.sqf"

Find:

} else {
		player removeAction s_player_upgrade_build;
		s_player_upgrade_build = -1;
	};

and add directly under this:

	diag_log text "============================================";
	
	diag_log format["fn_actons: [PlayerUID: %1] [_ownerID: %2] [DZE_Lock_Door: %3] [_characterID: %4] [typeOfCursorTarget: %5]",_playerUID, _ownerID, DZE_Lock_Door, _characterID, _typeOfCursorTarget];
	diag_log format["[s_player_downgrade_build:%1 ] [s_player_lastTarget: %2 ] [_isRemovable: %3 ] [_isWreckBuilding: %4 ]",s_player_downgrade_build, s_player_lastTarget, _isRemovable, _isWreckBuilding];
	

FInd:

&& (DZE_Lock_Door == _ownerID)) then {

Replace with:

&& (DZE_Lock_Door == _characterID)) then {

Find:

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

Replace it with your own path pointing to your custom player_buildingDowngrade.sqf for me it looks like this:

"Custom\player_buildingDowngrade.sqf"

Find:

if(_isTent && _ownerID == dayz_characterID) then {

Replace with:

if(_isTent && _ownerID == _playerUID) then {

Find:

if (_isDog && _isAlive && (_hasRawMeat) && _ownerID == "0" &&

Replace with:

if (_isDog && _isAlive && (_hasRawMeat) && _characterID == "0" &&

Find:

if (_isDog && _ownerID == dayz_characterID && _isAlive) then {

Replace with:

if (_isDog && _characterID == dayz_characterID && _isAlive) then {

Find:

_ownerID = "0";

Replace with:

_characterID = "0";

Find:

if (!isNull cursorTarget) then { _ownerID = cursorTarget getVariable ["CharacterID","0"]; };

Replace with:

if (!isNull cursorTarget) then { _characterID = cursorTarget getVariable ["CharacterID","0"]; };

Find:

if (_canDo && !_inVehicle && alive _dog && _ownerID != dayz_characterID) then {

Replace with:

if (_canDo && !_inVehicle && alive _dog && _characterID != dayz_characterID) then {

Wow we are done with the Fn_selfactions, this file alone take 1 hour for me :)

  •  player_packtent.sqf

Lets start with player_packTent.sqf
 
Add at the top the private variables:

"_playerUID"

Find:

_ownerID = _obj getVariable["CharacterID","0"];

Replace with:

_ownerID = _obj getVariable["ownerPUID","0"];

Find:

_objectUID	= _obj getVariable["ObjectUID","0"];

and add directly under it:
 

_playerUID = getPlayerUID player;

Find:

if(_ownerID != dayz_characterID)

Replace with:

if(_ownerID != _playerUID)

That was fast we are done with playerpacktent.

  • player_unlockvault.sqf


add to the private variables at the top:
,"_characterID"

Find:

_ownerID = _obj getVariable["CharacterID","0"];

replace with:

_characterID = _obj getVariable["CharacterID","0"];
_ownerID = _obj getVariable["ownerPUID","0"];;

Find:

if ((_ownerID == dayz_combination) || (_ownerID == dayz_playerUID)) then {

replace with:
 

if ((_characterID == dayz_combination) || (_ownerID == dayz_playerUID)) then {

Find:

_holder setVariable ["OEMPos", _pos, true];

add directly under it:

_holder setVariable ["ownerPUID", _ownerID , true];

Find:
 

_holder setVariable["CharacterID",_ownerID,true];

Replace with:

_holder setVariable["CharacterID",_characterID,true];

Done.

  • remove.sqf


Add to the private variables at the top:
 
,"_playerUID"

Find:

_objOwnerID = _obj getVariable["CharacterID","0"];

replace with:

_objOwnerID = _obj getVariable["ownerPUID","0"];

and add directly above it:
 

_playerUID = getPlayerUID _activatingPlayer;

Find:

_isOwnerOfObj = (_objOwnerID == dayz_characterID);

Replace with:

_isOwnerOfObj = (_objOwnerID == _playerUID);

Find:

_ownerID = _nearestPole getVariable["CharacterID","0"];

Replace with:

_ownerID = _nearestPole getVariable["ownerPUID","0"];

Find:

if(dayz_characterID != _ownerID) then {

replace with:

if(_playerUID != _ownerID) then {

Done.

  • player_updateGui.sqf


Find:
"_charID","_rcharID"

Replace with:

"_playerUID","_rplayerUID"

Find:

_charID = player getVariable ["CharacterID", "0"];

replace with:

_playerUID = getPlayerUID player;

Find:

_rcharID = _humanityTarget getVariable ["CharacterID", "0"];

replace with:

_rplayerUID = getPlayerUID _humanityTarget;

Find:

if ((_rcharID in _friendlies) && (_charID in _rfriendlies)) then {

Replace with:

if ((_rplayerUID in _friendlies) && (_playerUID in _rfriendlies)) then {

Find:

if !(_charID in _rfriendlyTo) then {

replace with:

if !(_playerUID in _rfriendlyTo) then {

Find:

_rfriendlyTo set [count _rfriendlyTo, _charID];

replace with:

_rfriendlyTo set [count _rfriendlyTo, _playerUID];

Done.

  • tent_pitch.sqf


Add to the private variables at the top:
,"_playerUID"

Find:

_isOk = [(vehicle player),_building] call fnc_isInsideBuilding;

and add directly under it:

_playerUID = getPlayerUID player;

Find:

_object setVariable ["CharacterID",dayz_characterID,true];

and add directly under it:

_object setVariable ["ownerPUID",_playerUID,true];

FInd:

PVDZE_obj_Publish = [dayz_characterID,_object,[_dir,_location],_classname];

replace with:

PVDZE_obj_Publish = [dayz_characterID,_object,[_dir,_location, _playerUID],_classname];

Done.

  • vault_pitch.sqf


add at to the private variables at the top
,"_playerUID"

Find:

_location = player modeltoworld [_offset_x,_offset_y,_offset_z];

and add directly under it:

_playerUID = getPlayerUID player;

Find:
 

_tent setVariable ["CharacterID",_combination,true];

and add directly under it:

_object setVariable ["ownerPUID",_playerUID,true];

Find:

PVDZE_obj_Publish = [_combination,_tent,[_dir,_location],"VaultStorageLocked"];

replace with:

PVDZE_obj_Publish = [_combination,_tent,[_dir,_location, _playerUID],"VaultStorageLocked"];

Done.

  • player_build.sqf


add to the private variables at the top:
,"_ownerPUID", "_playerUID"

Find:
 

_inVehicle = (_vehicle != player);

and add under it:

_playerUID = getPlayerUID player;

Find:

_ownerID = _nearestPole getVariable ["CharacterID","0"];

replace with:

_ownerID = _nearestPole getVariable ["ownerPUID","0"];

Find:

// diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];

and replace it if you want to enable the debug,

diag_log format["Player_build start: [PlayerUID = %1]  [OwnerID = %2]", _playerUID, _ownerID];

Find:

if(dayz_characterID == _ownerID) then {  //Keep ownership

replace with:
 

if(_playerUID == _ownerID) then {  //Keep ownership

Find:

// owner can build anything within his plot except other plots

and if you want to enable the debug add directly under it:

diag_log text "Player is owner";

Find:

_tmpbuilt setVariable ["CharacterID",dayz_characterID,true]; 

and add directly under it:

_tmpbuilt setVariable ["ownerPUID",_playerUID,true];

Find:
 

_tmpbuilt setVariable ["CharacterID",_combination,true];

and add directly under it:
 

_tmpbuilt setVariable ["ownerPUID",_playerUID,true];

Find:
 

PVDZE_obj_Publish = [_combination,_tmpbuilt,[_dir,_location],_classname];

Replace with:

PVDZE_obj_Publish = [_combination,_tmpbuilt,[_dir,_location,_playerUID],_classname];

Find:
 

PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location],_classname];

Replace with:

PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,_playerUID],_classname];

Done.
 

  • player_buildingDowngrade.sqf


add to the private variables at the top:
,"_playerUID"

Find:
 

_needText = localize "str_epoch_player_246";

and add directly under it:

_playerUID = getPlayerUID player;

Find:
 

_ownerID = _nearestPole getVariable["CharacterID","0"];

replace with:

_ownerID = _nearestPole getVariable["ownerPUID","0"];

Find:
 

if(dayz_characterID == _ownerID) then {

replace with:
 

if(_playerUID == _ownerID) then {

Find:

_objectCharacterID 	= _obj getVariable ["CharacterID","0"];

and add directly under it:

_ownerID = _obj getVariable["ownerPUID","0"];

Find:

// Set location
_object setPosATL _location;

And add under it:

		// Set Owner.
		_object setVariable ["ownerPUID",_ownerID,true];
		
		diag_log format["Player_buildingdowngrade: [newclassname: %1] [_ownerID: %2] [_objectCharacterID: %2]",_newclassname, _ownerID, _objectCharacterID];

Find:

PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location],_classname,_obj,player];

replace with:

PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_ownerID],_classname,_obj,player];

Done.

  • player_tagfriendly.sqf


Find:
_callerID = _caller getVariable ["CharacterID", "0"];

replace with:

_callerID = getPlayerUID _caller;

Find:

_targetID = _target getVariable ["CharacterID", "0"];

Replace with:

_targetID = getPlayerUID _target;

add above this 2 entries:

diag_log format["[_target: $1] [_caller: %2]", _target,_caller];

add below this 2 entries:

diag_log format["[_targetID: $1] [_callerID: %2]", _targetID,_callerID];

Done.

  • player_upgrade.sqf


Find:
_ownerID = _nearestPole getVariable["CharacterID","0"];

Replace with:

_ownerID = _nearestPole getVariable["ownerPUID","0"];

add directly under it:

_playerUID = getPlayerUID player;

Find:

if(dayz_characterID == _ownerID) then {

replace with:

if(_playerUID == _ownerID) then {

Find:

_objectCharacterID 	= _obj getVariable ["CharacterID","0"];

add under it:

_ownerID = _obj getVariable["ownerPUID","0"];

Find:

			// Set location
			_object setPosATL _location;

Add under it:

			// Set Owner.
			_object setVariable ["ownerPUID",_ownerID,true];
			

Find:

PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location],_classname,_obj,player];

Replace with:

PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location, _ownerID],_classname,_obj,player];

Done.

  • Server_monitor.sqf

open it and find:

		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));
		};

directly under it add:
 

		// Realign characterID to OwnerPUID - need to force save though.
		
		if (count _worldspace < 3) then
		{
			_worldspace set [count _worldspace, "0"];
		};		

		_ownerPUID = _worldspace select 2;
		
		// diag_log format["Server_monitor: [ObjectID = %1]  [ClassID = %2] [_ownerPUID = %3]", _idKey, _type, _ownerPUID];
		

Find:

_object setVariable ["ObjectID", _idKey, true];

Directly under it add:
 

_object setVariable ["OwnerPUID", _ownerPUID, true];

Done.
 


Now go to your init.sqf
and find:

_serverMonitor = 	[] execVM "\z\addons\dayz_code\system\server_monitor.sqf";

and replace it with your custom path pointing to your custom folder in my case it looks like this:
 

_serverMonitor = 	[] execVM "custom\server_monitor.sqf";

For me everything is working, i dont test the script before, i doed exact the same like above and its working for me with vanilla epoch and with my normal MPmission where i have about 22 custom files from the dayz_code.pbo.

#Edit: fixxed some synatx errors in my instruction

Link to comment
Share on other sites

Ok, from looking through the building maintenance code, I do not believe this mod will affect it at all.  It just grabs any valid buildings (listed in DZE_maintainClasses) within range (DZE_maintainRange) that have a damage equal to or more than DZE_DamageBeforeMaint.

 

 

Neither of the two scripts used for this function call the characterID object variable to check.

 

 

PlayerUID (i.e. SteamID) is now stored as an extra field in the worldspace field in the DB allowing the characterID to be stored in the characterID field so you can switch back and forth (between vanilla or this mod) and need no change in the DB.  It also means there is no clash with any other usage of the characterID field in the DB (keys, safe codes, or other mods) and there is no need to truncate the steamID to fit.

 

This is what I wanted to do for v2 anyway but Steam just forced my hand.

 

Here is some select SQL that will display any object ownerships that can be changed automatically (i.e. where the objects characterID matches a playerUID in the characterID table.  It is limited to 15 character playerUIDs so should only pick out the SteamID matches.  This will just report and will not change anything.

select CD.playerUID, OD.characterID as Characters_characterID, OD.characterID as Objects_characterID, OD.worldspace as Current_worldspace, INSERT(OD.worldspace, (char_length(OD.worldspace)), (char_length(concat('\,\"', CD.playerUID, '\"\]'))), (concat('\,\"', CD.playerUID, '\"\]'))) as new_worldspace from object_data as OD, character_data as CD
where CD.characterID = OD.characterID
and not locate('"', OD.worldspace)
and char_length(CD.playerUID) > 15;

If that looks good the following code will insert the ownership values to the worldspace field for this mod.  

 

Please test first.  It works for me but your config may be different.  Always backup the DB first (see the end of this post for a Windows .bat script to do a backup).

 

If you are in triple figure characterIDs this may cause problems with safe / door code or vehicle key clashes.  Check the precheck above carefully.

SET SQL_SAFE_UPDATES=0;

start transaction;

Update object_data
inner join character_data as CD on (CD.characterID = object_data.characterID)
set object_data.worldspace = INSERT(object_data.worldspace, (char_length(object_data.worldspace)), (char_length(concat('\,\"', CD.playerUID, '\"\]'))), (concat('\,\"', CD.playerUID, '\"\]')))
where CD.characterID = object_data.characterID
and not locate('"', object_data.worldspace)
and char_length(CD.playerUID) > 15;

Check the results and if they look good

Select * from object_data where locate('"', object_data.worldspace);

If something looks wrong

rollback;

SET SQL_SAFE_UPDATES=1;

If all looks good 

commit;

SET SQL_SAFE_UPDATES=1;

Mysql generally defaults to safe updates which means you need to specify, in this case, each objectID you want to update.  As we are updating many objects we turn it off before the update and then turn it on after.  If you are happy to leave it off then don't run the "SET SQL_SAFE_UPDATES=1;" command at the end.

 

If you want to update just one characterID then you can add "and characterID = [characterID to affect here];" before the last ';'

 

i.e.

SET SQL_SAFE_UPDATES=0;

start transaction;

Update object_data
inner join character_data as CD on (CD.characterID = object_data.characterID)
set object_data.worldspace = INSERT(object_data.worldspace, (char_length(object_data.worldspace)), (char_length(concat('\,\"', CD.playerUID, '\"\]'))), (concat('\,\"', CD.playerUID, '\"\]')))
where CD.characterID = object_data.characterID
and not locate('"', object_data.worldspace)
and char_length(CD.playerUID) > 15
and object_data.characterID = 5;

The above code would only affect items in the object_data field with a characterID of 5.

 

If you know the players steamID and old value in the object_data.characterID field (maybe the old playerUID) then the following code should work.

 

Change [steamID of player] x 2 and [Current value of object_data.characterID field] x 1 to actual values without the [].  Search for '[' to make sure you have changed them all. 

SET SQL_SAFE_UPDATES=0;

start transaction;

Update object_data
set object_data.worldspace = INSERT(object_data.worldspace, (char_length(object_data.worldspace)), (char_length(concat('\,\"', [SteamID of player], '\"\]'))), (concat('\,\"', [SteamID of player], '\"\]')))
where not locate('"', object_data.worldspace)
and object_data.characterID = [Current value of object_data.characterID field];

After you check using the above check code then just commit or rollback as above.

 
Put the following in to a Windows batch file on your server (.bat file), amend the details and run it to backup the DB.  I have put a read at the end so the cmd box stays and you can see any errors.  You can take it out if you want once the backup is running ok.  You can also add it to Windows scheduler once working for automatic DB dumps.  You may need to check with your provider for the Mysqldir path where "mysqldump " is located.
 

The backups will be in the form of a .sql file that you can load and run from a SQL client to rebuild your tables and data.  The files will be housekept.  Any older than 5 days will be removed (I have this backing up every 15 minutes).  To change this, just change the "-5" in the forfiles line at the bottom to a number of days you prefer.

@REM *** PARAMETERS/VARIABLES ***
SET BackupDir="[Put the path to dump the DB to here]"
SET DatabaseName="[Put your DB name in here]"
SET mysqldir="C:\Program Files\MySQL\MySQL Server 5.6\bin"
SET mysqluser=[Put your MySQL userid in here]
SET mysqlpassword=[Put your MySQL password in here]
SET datestamp=%date:~-10,2%-%date:~-7,2%-%date:~-4,4%_%time:~0,2%.%time:~3,2%.%time:~6,2%
@REM *** EXECUTION ***
@REM Change to mysqldir
c:
cd %mysqldir%
@REM dump/backup ALL database, this is all in one line
mysqldump -u %mysqluser% -p%mysqlpassword% --databases %DatabaseName% >%BackupDir%\%DatabaseName%_backup.%datestamp%.sql

@REM - YOU ARE DONE!


forfiles -p %BackupDir% -s -m *.* -d -5 -c "cmd /c del @path"

The code above can be changed in may ways to do a DB dump every day and then just specific table dumps every 15 minutes or so but as my DB is quite small, this seems to work fine for me.

 

Backup first, be careful and enjoy.  Report any issues and I will re-examine and revise the code.

 

Have some question left, did you can provide a automaticlly cleanup for it :) ? i have not enough expirience with mysql so i dont know how i could make it, i dont use maintain on my server cause the bases are indestructable, how i would do it automaticlly is easy just

 SELECT `PlayerUID` FROM `Character_DATA` WHERE `Alive`='1' and DATE(`LastLogin`) < CURDATE() - INTERVAL 24 DAY);

take this uid´s and then something like that

SELECT * FROM `object_data` WHERE `worldspace` IS LIKE `1`;

but i dont know how to do that automaticlly in one script .... :)

any help would be awesome!

Link to comment
Share on other sites

========================Tutorial for guys who dont want to copy and paste the entire files=======================================

at first, i hope i am allowed to post this, if not Rimblock, message me and i will delete this post.

ok lets start,

first grab your custom compiles.sqf (Warning, i use my own paths, if you have another one you have to edit it to fit your paths)

add the following to the if (!isDedicated) then { section:

fnc_usec_damageActions =		compile preprocessFileLineNumbers "Custom\fn_damageActions.sqf";
fnc_usec_selfActions =			compile preprocessFileLineNumbers "Custom\fn_selfActions.sqf";
player_packTent =			compile preprocessFileLineNumbers "Custom\player_packTent.sqf";
player_packVault =			compile preprocessFileLineNumbers "Custom\player_packVault.sqf";
player_unlockVault =			compile preprocessFileLineNumbers "Custom\player_unlockVault.sqf";
player_removeObject =			compile preprocessFileLineNumbers "Custom\remove.sqf";
player_lockVault =			compile preprocessFileLineNumbers "Custom\player_lockVault.sqf";
player_updateGui =			compile preprocessFileLineNumbers "Custom\player_updateGui.sqf";
player_tentPitch =			compile preprocessFileLineNumbers "Custom\tent_pitch.sqf";
player_vaultPitch =			compile preprocessFileLineNumbers "Custom\vault_pitch.sqf";
player_build =				compile preprocessFileLineNumbers "Custom\player_build.sqf";

Now get the files (if you dont allready have it) from the dayz_code.pbo from the @dayz_epoch folder and paste it to your folder where your path is pointing to.

----------------------------------------------------------------------------

Open fn_damageActions.sqf and find (i mean the private variables on the top):

"_charid"

and replace it with:

"_playerUID"

Next find:

_charID =		_unit getVariable ["CharacterID", 0];

and replace it with:

_playerUID = 	getPlayerUID player;

Find:

if ((isPlayer _unit) && !(_charID in _friendlies)) then {

and replace it with:

if ((isPlayer _unit) && !(_playerUID in _friendlies)) then {

Find:

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

and replace it with your own path which point to your custom player_tagFriendly.sqf for me it looks like this:

"Custom\player_tagFriendly.sqf"

Now we are done, lets start with fn_selfActions.sqf

 

Find (again the private section at the top):

"_attached"

and add this behind it

,"_playerUID","_characterID"

Find:

_isMan = _cursorTarget isKindOf "Man";

and add directly above it:

_playerUID = getPlayerUID player;

Find:

_ownerID = _cursorTarget getVariable ["CharacterID","0"];

and replace it with:

_ownerID = _cursorTarget getVariable ["ownerPUID","0"];

Directly under _ownerID = ...... and so on

add this:

_characterID = _cursorTarget getVariable ["CharacterID","0"];

Find:

//Allow player to delete objects

and add above it:

diag_log format["fn_actons: [PlayerUID: %1] [_ownerID: %2] [_isModularDoor: %3] [typeOfCursorTarget: %4]",_playerUID, _ownerID, _isModularDoor, _typeOfCursorTarget];
diag_log format["[_isDestructable:%1 ] [_isWreck: %2 ] [_isRemovable: %3 ] [_isWreckBuilding: %4 ]",_isDestructable, _isWreck, _isRemovable, _isWreckBuilding];

Find 2 times:

(dayz_characterID == _ownerID))

and replace it with:

(_playerUID == _ownerID))

Find:

if(!_isMan && _ownerID != "0" && !(_cursorTarget isKindOf "Bicycle")) then {

and replace it with:

if(!_isMan && _characterID != "0" && !(_cursorTarget isKindOf "Bicycle")) then {

Find 2x times:

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

and replace it with your own path pointing to your custom remove.sqf for me it looks like this:

"Custom\remove.sqf"

Find:

_hasKey = _ownerID in _temp_keys;
_oldOwner = (_ownerID == dayz_playerUID);

and replace it with:

 

_hasKey = _characterID in _temp_keys;
_oldOwner = (_characterID == dayz_playerUID);

Find:

_Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _ownerID))], 2, true, true, "", ""];

Replace it with:

_Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _characterID))], 2, true, true, "", ""];

Find:

(_ownerID == dayz_characterID) then {

Replace it with:

if (_ownerID == _playerUID) then {

Find:

if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {

and replace it with:

if(_characterID == dayz_combination || _ownerID == _playerUID) then {

Find:

if(_ownerID != dayz_combination && _ownerID != dayz_playerUID) then {

and replace it with:

if(_characterID != dayz_combination && _ownerID != _playerUID) then {

Find:

if(_typeOfCursorTarget in DZE_UnLockedStorage && _ownerID != "0" &&

and replace it with:

if(_typeOfCursorTarget in DZE_UnLockedStorage && _characterID != "0" &&

Find:

if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {

Replace with:

 

if(_characterID == dayz_combination || _ownerID == dayz_playerUID) then {

Find:

if (s_player_packvault < 0 && (_ownerID == dayz_combination || _ownerID == dayz_playerUID))

Replace with:

if (s_player_packvault < 0 && (_characterID == dayz_combination || _ownerID == dayz_playerUID))

Find:

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

And replace it with your path pointing to player_upgrade:sqf for it looks like this:

"Custom\player_upgrade.sqf"

Find:

} else {
		player removeAction s_player_upgrade_build;
		s_player_upgrade_build = -1;
	};

and add directly under this:

	diag_log text "============================================";
	
	diag_log format["fn_actons: [PlayerUID: %1] [_ownerID: %2] [DZE_Lock_Door: %3] [_characterID: %4] [typeOfCursorTarget: %5]",_playerUID, _ownerID, DZE_Lock_Door, _characterID, _typeOfCursorTarget];
	diag_log format["[s_player_downgrade_build:%1 ] [s_player_lastTarget: %2 ] [_isRemovable: %3 ] [_isWreckBuilding: %4 ]",s_player_downgrade_build, s_player_lastTarget, _isRemovable, _isWreckBuilding];
	

FInd:

&& (DZE_Lock_Door == _ownerID)) then {

and replace it with:

&& (DZE_Lock_Door == _characterID)) then {

Find:

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

Replace it with your own path pointing to your custom player_buildingDowngrade.sqf for me it looks like this:

"Custom\player_buildingDowngrade.sqf"

Find:

if(_isTent && _ownerID == dayz_characterID) then {

Replace it with:

if(_isTent && _ownerID == _playerUID) then {

Find:

if (_isDog && _isAlive && (_hasRawMeat) && _ownerID == "0" &&

Replace with:

if (_isDog && _isAlive && (_hasRawMeat) && _characterID == "0" &&

Find:

if (_isDog && _ownerID == dayz_characterID && _isAlive) then {

Replace with:

if (_isDog && _characterID == dayz_characterID && _isAlive) then {

Find:

_ownerID = "0";

Replace with:

_characterID = "0";

Find:

if (!isNull cursorTarget) then { _ownerID = cursorTarget getVariable ["CharacterID","0"]; }

Replace with:

if (!isNull cursorTarget) then { _characterID = cursorTarget getVariable ["CharacterID","0"]; };

Find:

if (_canDo && !_inVehicle && alive _dog && _ownerID != dayz_characterID) then {

Replace with:

if (_canDo && !_inVehicle && alive _dog && _characterID != dayz_characterID) then {

Wow we are dont with the Fn_selfactions, this file alone take 1 hours for me :)

 

Lets start with player_packTent.sqf

 

Add at the top the private variables:

"_playerUID"

Find:

_ownerID = _obj getVariable["CharacterID","0"];

Replace with:

_ownerID = _obj getVariable["ownerPUID","0"];

Find:

_objectUID	= _obj getVariable["ObjectUID","0"];

and add directly under it:

 

_playerUID = getPlayerUID player;

Find:

if(_ownerID != dayz_characterID)

Replace with:

if(_ownerID != _playerUID)

That was fast we are done with playerpacktent.

 

Lets start with player_packVault.sqf

add to the private variables at the top:

,"_characterID"

Find:

_ownerID = _obj getVariable["CharacterID","0"];

replace with:

_characterID = _obj getVariable["CharacterID","0"];

Find:

_objectUID	= _obj getVariable["ObjectUID","0"];

add directly under this:

 

_ownerID =  _obj getVariable["ownerPUID", "0"];

Find:

if((_ownerID != dayz_combination) &&

replace with:

if((_characterID != dayz_combination) &&

Find:

_holder setVariable["CharacterID",_ownerID,true];

Replace with:

_holder setVariable["CharacterID",_characterID,true];

Find:

_holder setVariable ["OEMPos", _pos, true];

add directly under it:

_holder setVariable ["ownerPUID", _ownerID , true];

Done.

lets start with player_unlockVault.sqf

 

Add to the private variables at the top:

,"_characterID"

Find:

_ownerID = _obj getVariable["CharacterID","0"];

Replace with:

_characterID = _obj getVariable["CharacterID","0"];

and add directly under it:

_ownerID = _obj getVariable["ownerPUID","0"];;

Find:

if ((_ownerID == dayz_combination) || (_ownerID == dayz_playerUID)) then {

replace with:

if ((_characterID == dayz_combination) || (_ownerID == dayz_playerUID)) then {

Find:

 

_holder setVariable["CharacterID",_ownerID,true];

Replace with:

_holder setVariable["CharacterID",_characterID,true];

Find:

 

_holder setVariable ["OEMPos", _pos, true];

and add directly under it:

 

_holder setVariable ["ownerPUID", _ownerID , true];

Done.

Lets start with remove.sqf

 

Add to the private variables at the top:

 

,"_playerUID"

Find:

_objOwnerID = _obj getVariable["CharacterID","0"];

replace with:

_objOwnerID = _obj getVariable["ownerPUID","0"];

and add directly above it:

 

_playerUID = getPlayerUID _activatingPlayer;

Find:

_isOwnerOfObj = (_objOwnerID == dayz_characterID);

Replace with:

_isOwnerOfObj = (_objOwnerID == _playerUID);

Find:

_ownerID = _nearestPole getVariable["CharacterID","0"];

Replace with:

_ownerID = _nearestPole getVariable["ownerPUID","0"];

Find:

if(dayz_characterID != _ownerID) then {

replace with:

if(_playerUID != _ownerID) then {

Done.

lets start with player_lockVault.sqf

 

Oh hey wait, there is nothing which was changed :)

 

Done.

 

lets start with player_updateGui.sqf

 

Find:

"_charID","_rcharID"

and replace with:

"_playerUID","_rplayerUID"

Find:

_charID = player getVariable ["CharacterID", "0"];

replace with:

_playerUID = getPlayerUID player;

Find:

_rcharID = _humanityTarget getVariable ["CharacterID", "0"];

replace with:

_rplayerUID = getPlayerUID _humanityTarget;

Find:

if ((_rcharID in _friendlies) && (_charID in _rfriendlies)) then {

Replace with:

if ((_rplayerUID in _friendlies) && (_playerUID in _rfriendlies)) then {

Find:

if !(_charID in _rfriendlyTo) then {

replace with:

if !(_playerUID in _rfriendlyTo) then {

Find:

_rfriendlyTo set [count _rfriendlyTo, _charID];

replace with:

_rfriendlyTo set [count _rfriendlyTo, _playerUID];

Done.

 

lets start with tent_pitch.sqf

 

Add to the private variables at the top:

,"_playerUID"

Find:

_isOk = [(vehicle player),_building] call fnc_isInsideBuilding;

and add directly under it:

_playerUID = getPlayerUID player;

Find:

_object setVariable ["CharacterID",dayz_characterID,true];

and add directly under it:

_object setVariable ["ownerPUID",_playerUID,true];

FInd:

PVDZE_obj_Publish = [dayz_characterID,_object,[_dir,_location],_classname];

replace with:

PVDZE_obj_Publish = [dayz_characterID,_object,[_dir,_location, _playerUID],_classname];

Done.

lets start with  vault_pitch.sqf

 

add at to the private variables at the top

,"_playerUID"

Find:

_location = player modeltoworld [_offset_x,_offset_y,_offset_z];

and add directly under it:

_playerUID = getPlayerUID player;

Find:

 

_tent setVariable ["CharacterID",_combination,true];

and add directly under it:

_object setVariable ["ownerPUID",_playerUID,true];

Find:

PVDZE_obj_Publish = [_combination,_tent,[_dir,_location],"VaultStorageLocked"];

replace with:

PVDZE_obj_Publish = [_combination,_tent,[_dir,_location, _playerUID],"VaultStorageLocked"];

Done lets start with player_build.sqf

add to the private variables at the top:

,"_ownerPUID", "_playerUID"

Find:

 

_inVehicle = (_vehicle != player);

and add under it:

_playerUID = getPlayerUID player;

Find:

_ownerID = _nearestPole getVariable ["CharacterID","0"];

replace with:

_ownerID = _nearestPole getVariable ["ownerPUID","0"];

Find:

// diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];

and replace it if you want to enable the debug,

diag_log format["Player_build start: [PlayerUID = %1]  [OwnerID = %2]", _playerUID, _ownerID];

Find:

if(dayz_characterID == _ownerID) then {  //Keep ownership

replace with:

 

if(_playerUID == _ownerID) then {  //Keep ownership

Find:

// owner can build anything within his plot except other plots

and if you want to enable the debug add directly under it:

diag_log text "Player is owner";

Find 2x:

 

_tmpbuilt setVariable ["CharacterID",_combination,true];

and add directly under it:

 

_tmpbuilt setVariable ["ownerPUID",_playerUID,true];

Find:

 

PVDZE_obj_Publish = [_combination,_tmpbuilt,[_dir,_location],_classname];

Replace with:

PVDZE_obj_Publish = [_combination,_tmpbuilt,[_dir,_location,_playerUID],_classname];

Find:

 

PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location],_classname];

Replace with:

PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,_playerUID],_classname];

Done.

 

Now copy

Player_buildingmaint.sqf , Player_buildingdowngrade.sqf , player_tagfriendly.sqf , player_upgrade.sqf to your custom folder if you dont allready have them.

 

Lets start with Player_buildingmaint.sqf

 

add to the private variables at the top:

,"_playerUID"

Find:

 

_needText = localize "str_epoch_player_246";

and add directly under it:

_playerUID = getPlayerUID player;

Find:

 

_ownerID = _nearestPole getVariable["CharacterID","0"];

replace with:

_ownerID = _nearestPole getVariable["ownerPUID","0"];

Find:

 

if(dayz_characterID == _ownerID) then {

replace with:

 

if(_playerUID == _ownerID) then {

Find:

_objectCharacterID 	= _obj getVariable ["CharacterID","0"];

and add directly under it:

_ownerID = _obj getVariable["ownerPUID","0"];

Find:

// Set location
_object setPosATL _location;

And add under it:

		// Set Owner.
		_object setVariable ["ownerPUID",_ownerID,true];
		
		diag_log format["Player_buildingdowngrade: [newclassname: %1] [_ownerID: %2] [_objectCharacterID: %2]",_newclassname, _ownerID, _objectCharacterID];

Find:

PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location],_classname,_obj,player];

replace with:

PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_ownerID],_classname,_obj,player];

Done.

lets start with player_tagfriendly.sqf

 

Find:

_callerID = _caller getVariable ["CharacterID", "0"];

replace with:

_callerID = getPlayerUID _caller;

Find:

_targetID = _target getVariable ["CharacterID", "0"];

Replace with:

_targetID = getPlayerUID _target;

add above this 2 entrys:

diag_log format["[_target: $1] [_caller: %2]", _target,_caller];

add below this 2 entrys:

diag_log format["[_targetID: $1] [_callerID: %2]", _targetID,_callerID];

Done.

Lets start with player_upgrade.sqf

 

Find:

_ownerID = _nearestPole getVariable["CharacterID","0"]

Replace with:

_ownerID = _nearestPole getVariable["ownerPUID","0"];

add directly under it:

_playerUID = getPlayerUID player;

Find:

if(dayz_characterID == _ownerID) then {

replace with:

if(_playerUID == _ownerID) then {

Find:

_objectCharacterID 	= _obj getVariable ["CharacterID","0"];

add under it:

_ownerID = _obj getVariable["ownerPUID","0"];

Find:

			// Set location
			_object setPosATL _location;

Add under it:

			// Set Owner.
			_object setVariable ["ownerPUID",_ownerID,true];
			

Find:

PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location],_classname,_obj,player];

Replace with:

PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location, _ownerID],_classname,_obj,player];

Done,

Now copy from your dayz_server.pbo the  server_monitor.sqf out of the system folder in your custom folder or whatever your folder is named.

 

open it and find:

		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));
		};

directly under it add:

 

		// Realign characterID to OwnerPUID - need to force save though.
		
		if (count _worldspace < 3) then
		{
			_worldspace set [count _worldspace, "0"];
		};		

		_ownerPUID = _worldspace select 2;
		
		// diag_log format["Server_monitor: [ObjectID = %1]  [ClassID = %2] [_ownerPUID = %3]", _idKey, _type, _ownerPUID];
		

Find:

_object setVariable ["ObjectID", _idKey, true];

Directly under it add:

 

_object setVariable ["OwnerPUID", _ownerPUID, true];

Done.

 

Now go to your init.sqf

and find:

_serverMonitor = 	[] execVM "\z\addons\dayz_code\system\server_monitor.sqf";

and replace it with your custom path pointing to your custom folder in my case it looks like this:

 

_serverMonitor = 	[] execVM "custom\server_monitor.sqf";

Ps, i write this where i was really tiered, but for me it worked, i will overwork it in 10-15 hrs

 

Great, thanks for taking the time to put this together.

 

I will put it up on the first page so everyone can benefit after you have double checked it with day time eyes :) .

Link to comment
Share on other sites

Have some question left, did you can provide a automaticlly cleanup for it :) ? i have not enough expirience with mysql so i dont know how i could make it, i dont use maintain on my server cause the bases are indestructable, how i would do it automaticlly is easy just

 SELECT `PlayerUID` FROM `Character_DATA` WHERE `Alive`='1' and DATE(`LastLogin`) < CURDATE() - INTERVAL 24 DAY);

take this uid´s and then something like that

SELECT * FROM `object_data` WHERE `worldspace` IS LIKE `1`;

but i dont know how to do that automaticlly in one script .... :)

any help would be awesome!

 

Sorry, I am not sure what you are after.

 

The maintenance feature in Epoch only happens when buildings are damaged past a set amount.  To simulate 'decay' Epoch comes with a set of SQL events which cause decay damage daily to any buildables.  The code to enable these events are in the SQL directory of the Epoch server download.

 

If you remove the events that cause the decay damage then your buildables would not be automatically damaged but there are other events in the Epoch supplied SQL that you should keep which help to clear away destroyed items etc.

 

Running

DROP EVENT IF EXISTS `setDamageOnAge`;

Should stop the buildables being damaged as part of the maintenance feature.

Link to comment
Share on other sites

Rim do you know the common cause of objects not allowing you to upgrade, downgrade after a server restart? When I restart the server I get the unable to upgrade plot pole near message on all items dropped, cannot downgrade them and cannot access safes.

Link to comment
Share on other sites

you've messed up your files at some point then. start over with good working pbo's and do each file at a time.

I've redone the install of both mods now at least 10 times trying to find the magical alignment to make it all work, I even did a fresh reinstall of my test server and tried, still same results. I think the issue has to do with the way the objects are being written to the DB because vanilla Epoch does not save the character ID to objects after a restart, so even if you changed the script to have the object associated with a PUid vs Character ID it would still not save. Obvioulsy I am doing something wrong as other people have gotten it to work and I have not, I did see McPimpin ask about this exact issue in an earlier thread but I never saw an answer for it. If I used the merged player_build.sqf it fucks everything up royally, and I know that everthing is pointed the way it should be, so instead I am using both player_build.sqf's via my custom compiles and the snap_pro custom compiles and that makes everything work. Both scripts work perfectly until restart. Then after that the snap_pro still works perfectly and the P4L works as designed but only with new objects placed, any object placed before acts like I'm a complete stranger, so this has to be a problem with the PUid not being saved to objects in the DB. May look into trying to write an SQL trigger to force the PUid saving to objects if I can't figure this out. When I look in the DB, the PUid saves to the worldspace of associated objects, and the character ID stays the same with the exception of vaults it would appear, so very confusing.

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