Jump to content

[Howto/Release] Tie PlayerUID To All Buildable Objects / Keep plot pole after death [No SQL Triggers] UPDATE 16/04/2014


Recommended Posts

First off i would like to thank one of my players in my community Tim aka maccon for the patience to help me test this to the point where I think he don't like spawning and joining in DayZ any more. We have tried to test this extensively in many different scenarios and i just can't get it to fail at all. So i really hope this is true.

Now to the fun part, converting to PlayerUID tied build system. This is not a beginner choice, but i will try and explain it step for step, even tho you might not fully understand why it has to be like this or that when we edit the code, just know that it has to be and you shouldn't edit it any other way then how i explain you to do it.

I expect that you have custom compiles.sqf and fn_selfAction.sqf else search for it on the forum how to

First off a little help for debugging, i'm going to show you how to log info from the clients connected to your server to the Server RPT! This is NOT the same as using the client RPT file so do not exclude looking in that if anything isn't working for you.

  • Open "Client_PBO\dayz_code\init" folder and copy publicEH.sqf to your "MISSION_FOLDER\custom" folder
  • Open your mission init.sqf and change
    call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\publicEH.sqf";
    to
    call compile preprocessFileLineNumbers "custom\publicEH.sqf";
  • Open your publicEH.sqf that we just copied and search for PVDZE_obj_setlocalVars below this line add this in
    "WG_admin_Log" addPublicVariableEventHandler {_logWGadmin = _this select 1;diag_log format["Client To Server: %1",_logWGadmin];};
  • any where you want to log anything from the client to the server log you use this code
    _log = (format["your text here: %1 %2 %3",your,variables,here]);WG_admin_Log = [_log];publicVariableServer "WG_admin_Log";
    The above code will show "Client To Server: your text here: your variables here" in the server RPT

Thats it for Client to server logging use it as you want, it helped me out alot! beside the Server and Client RPT






 

Change Character to PlayerUID

Then Search for

 

  • Download Kronzkys String Functions Library from HERE
     
  • Extract KRON_Strings.sqf to the root of your mission folder and open up the init.sqf in your mission folder and add to the bottom
    nul=[] execVM "KRON_Strings.sqf";
  • Now open KRON_Strings.sqf and at the bottom add this
    KRON_convertPlayerUID = {
       private["_in","_up","_out"];
       _in=_this select 0;
       _up=[_in] call KRON_StrUpper;
       _out=[_up,"AX","999"] call KRON_Replace;
       _out
    };
  • In your custom compiles add or edit the following (depending on how your run your compiles.sqf) to what in the codebox
    fnc_usec_damageActions = compile preprocessFileLineNumbers "custom\fn_damageActions.sqf";
    player_updateGui = compile preprocessFileLineNumbers "custom\player_updateGui.sqf";
    player_build = compile preprocessFileLineNumbers "custom\player_build.sqf";
  • Now copy over "Client_PBO\dayz_code\compile\fn_damageActions.sqf" and "Client_PBO\dayz_code\compile\player_updateGui.sqf" to the custom folder
     
  • Open player_updateGui.sqf in the custom folder and go to line 155 and replace this
    _charID = player getVariable ["CharacterID", "0"];
    _rcharID = _humanityTarget getVariable ["CharacterID", "0"];
    with this
    _charID = getPlayerUID player;
    _found=[_charID,"AX"] call KRON_StrInStr;
    if (_found) then {
       _charID=[_charID] call KRON_convertPlayerUID;
    };
    
    _rcharID = getPlayerUID _humanityTarget;
    _found=[_rcharID,"AX"] call KRON_StrInStr;
    if (_found) then {
       _rcharID=[_rcharID] call KRON_convertPlayerUID;
    };
    and add "_found" to the private array at the top
     
  • Open fn_damageActions.sqf in the custom folder and go to line 58 and replace this
    _charID = _unit getVariable ["CharacterID", 0];
    with this
    _charID = getPlayerUID _unit;
    _found=[_charID,"AX"] call KRON_StrInStr;
    if (_found) then {
       _charID=[_charID] call KRON_convertPlayerUID;
    };
    Now go to line 153 and change
    _action = _unit addAction ["Tag as friendly", "\z\addons\dayz_code\actions\player_tagFriendly.sqf", [], 0, false, true, "", ""];
    to
    _action = _unit addAction ["Tag as friendly", "custom\player_tagFriendly.sqf", [], 0, false, true, "", ""];
    and add "_found" to the private variable at the top of the file
     
  • Now copy over "Client_PBO\dayz_code\actions\player_tagFriendly.sqf" to your custom folder and open it up and replace
    _callerID = _caller getVariable "CharacterID";
    _targetID = _target getVariable "CharacterID";
    with
    _callerID = getPlayerUID _caller;
    _found=[_callerID,"AX"] call KRON_StrInStr;
    if (_found) then {
       _callerID=[_callerID] call KRON_convertPlayerUID;
    };
    
    _targetID = getPlayerUID _target;
    _found=[_targetID,"AX"] call KRON_StrInStr;
    if (_found) then {
       _targetID=[_targetID] call KRON_convertPlayerUID;
    };
    Now add "_found" to the private array at the top of the file
     
  • Now copy over "Client_PBO\dayz_code\actions\remove.sqf" and "Client_PBO\dayz_code\actions\player_upgrade.sqf" and "Client_PBO\dayz_code\actions\player_build.sqf" to your custom folder and open remove.sqf up and find at line 15
    _activatingPlayer = player;
    just below add this
    _playerUID = getPlayerUID _activatingPlayer;
    _found=[_playerUID,"AX"] call KRON_StrInStr;
    if (_found) then {
       _playerUID=[_playerUID] call KRON_convertPlayerUID;
    };
    Find
    _isOwnerOfObj = (_objOwnerID == dayz_characterID);
    and replace it with
    _isOwnerOfObj = (_objOwnerID == _playerUID);
    Now find
    if(dayz_characterID != _ownerID) then {
    and replace it with
    if(_playerUID != _ownerID) then {
    Now add "_playerUID" and "_found" to the private array at the top of the file
     
  • Now open up player_upgrade.sqf you copied before and find
    _needText = localize "str_epoch_player_246";
    below that insert
    _playerUID = getPlayerUID player;
    _found=[_playerUID,"AX"] call KRON_StrInStr;
    if (_found) then {
       _playerUID=[_playerUID] call KRON_convertPlayerUID;
    };
    Then find
    if(dayz_characterID == _ownerID) then {
    and replace it with
    if(_playerUID == _ownerID) then {
    Now add "_playerUID" and "_found" to the private array at the top of the file
  • Now open up player_build.sqf you copied before and find (This is also relatively easy to do if you use my or otternas version of snap build)
    if (player getVariable["combattimeout", 0] >= time) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_43"), "PLAIN DOWN"];};
    just below add
    _playerUID = getPlayerUID player;
    _found=[_playerUID,"AX"] call KRON_StrInStr;
    if (_found) then {
       _playerUID=[_playerUID] call KRON_convertPlayerUID;
    };
    Then find
    if(dayz_characterID == _ownerID) then {
    and replace it with
    if(_playerUID == _ownerID) then {
    Then find (if you use otternas or my version of build snap _tmpbuilt is _object)
    _tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
    and replace with
    _tmpbuilt setVariable ["CharacterID",_playerUID,true];
    Then find (if you use otternas or my version of build snap _tmpbuilt is _object)
    PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location],_classname];
    and replace with
    PVDZE_obj_Publish = [_playerUID,_tmpbuilt,[_dir,_location],_classname];
    Now add "_playerUID" and "_found" to the private array at the top of the file
     
  • Now copy over "Client_PBO\dayz_code\actions\player_buildingDowngrade.sqf" to your custom folder and open player_buildingDowngrade.sqf up and search for
    _needText = localize "str_epoch_player_246";

    and add this just below

    _playerUID = getPlayerUID player;
    _found=[_playerUID,"AX"] call KRON_StrInStr;
    if (_found) then {
        _playerUID=[_playerUID] call KRON_convertPlayerUID;
    };
    

    Then Search for

    // check if friendly to owner
    if(dayz_characterID == _ownerID) then {
    

    and replace it with

    // check if friendly to owner
    if(_playerUID == _ownerID) then {
    

    Then search for 

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

    and replace it with

    _object setVariable ["CharacterID",_playerUID,true];
    _objectCharacterID = _playerUID;
    
    Now add "_playerUID" and "_found" to the private array at the top of the file
     
  • In your fn_selfAction.sqf find
    "\z\addons\dayz_code\actions\remove.sqf"
    and replace with
    "custom\remove.sqf"
    there is 2 places it has to be changed.

    Now search for player_upgrade.sqf and change the path to
    "custom\player_upgrade.sqf"
    Then search for
    _ownerID = _cursorTarget getVariable ["CharacterID","0"];
    just below add
    _playerUID = getPlayerUID player;
    _found=[_playerUID,"AX"] call KRON_StrInStr;
    if (_found) then {
       _playerUID=[_playerUID] call KRON_convertPlayerUID;
    };
    Now search for
    if(_isModular and (dayz_characterID == _ownerID)) then {
    and replace it with
    if(_isModular and (_playerUID == _ownerID)) then {
    Now search for
    //Packing my tent
    	if(_isTent and (player distance _cursorTarget < 3)) then {
    		if (_ownerID == dayz_characterID) then {
    and replace it with
    //Packing my tent
    	if(_isTent and (player distance _cursorTarget < 3)) then {
    		if (_ownerID == _playerUID) then {
    Now search for
    //Sleep
    	if(_isTent and _ownerID == dayz_characterID) then {
    and replace with
    //Sleep
    	if(_isTent and _ownerID == _playerUID) then {
    Now search for player_buildingDowngrade.sqf and change the path to "custom\player_buildingDowngrade.sqf"

    Now add "_playerUID" and "_found" to the private array at the top of the file
     

Now you'r done and all build objects are now tied with your PlayerUID instead of CharacterID's. Friend system is also converted same goes for upgrade and remove. Just remember if you die the player has to refriend the players he was friends with before but they don't have to do it back unless they die themself. This also works perfectly if you run multiple characters as all characters have the same PlayerUID and they can all build. on the same plot.

So go tell your players to rebuild their plot pole!

I will not give any other install instructions or help in any other way as there is simply too many factors involved. i have tried following this guide before i posted it and it works if you follow it step for step. I will not help installing it on your server and i don't take any responsibility if you break anything on your server. Remember always to do backup!


 

If you want to test it out visit my Napf server 178.32.54.36:3000


I do NOT allow anyone to repost this on other sites, if you have a translated version into any language post it in the thread and I will merge it and give credit for translation. If I find a translated version or same version posted on other sites I will do what I can to get it removed and that person will never get any sort of help ever again from me!

Link to comment
Share on other sites

I am using your and I cannot find these in the player_build.sqf

 

Then find

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

and replace with:
 

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

Find:

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

and replace with

PVDZE_obj_Publish = [_playerId,_tmpbuilt,[_dir,_location],_classname];
Link to comment
Share on other sites

As i sad in the guide i won't give any kind of support on this as there is too many factors in play. This is also why the instructions is for vanilla epoch. And they are very easy to port to build snap system if you look at what I'm replacing of the actual code.

Doing this is in no way for beginners and you need SQF script experience

Link to comment
Share on other sites

I also noticed that when I build something, My items don't get removed from my inventory.

 

seems like when i saved the post the first time a single step in step 12 was missing about redirecting player_upgrade.sqf in the fn_selfAction.sqf

Post is updated again to see if it will save it this time around :D

Link to comment
Share on other sites

in build snap they are called

_object setVariable ["CharacterID",dayz_characterID,true];
PVDZE_obj_Publish = [dayz_characterID,_object,[_dir,_location],_classname];

This is the only help i'm going to give, if you can't get it to work with the instructions provided, sry to say but then this isn't for you yet mate :)

Link to comment
Share on other sites

This might upset you but I figure I should ask, coming from VB/C++ and how I'm use to defining variables, what do you mean by "now add "_playerId" and "_found" to the private variable at the top", I'll actually be looking into adding this tomorrow and I'm sure if I have the sqf's in front of me It would make more sense.

Link to comment
Share on other sites

It's just me not naming it correctly as it's an array not a variable. but what the heck, it were 1 at night when i wrote this

 

but an example is

private ["_display","_ctrlBlood","_ctrlBleed","_bloodVal","_ctrlFood","_ctrlThirst","_thirstVal","_foodVal","_ctrlTemp","_tempVal","_combatVal","_array","_ctrlEar","_ctrlEye","_ctrlCombat","_ctrlFracture","_visualText","_visual","_audibleText","_audible","_blood","_thirstLvl","_foodLvl","_tempImg","_thirst","_food","_temp","_bloodLvl","_tempLvl","_color","_string","_humanity","_size","_friendlies","_charID","_rcharID","_rfriendlies","_rfriendlyTo","_distance","_targetControl","_humanityTarget","_found"];
Link to comment
Share on other sites

@VBawol add this to the next epoch update? :wub:

+ Nice work @geekgarage!

Yes that would be nice, but I don't think that would happen :)

And thx, reason why I did it was simply as many other server admins keep hearing, players kept saying that they were annoyed by the fact that they had to replace their plot pole every time they died or switched character.

Also a lot of server owners have been asking for it for a long time

Link to comment
Share on other sites

Also this will allow you to create a simple SQL event to auto update last updated field on objects build by active players on your server, no need for maintenance on your server.. You can simply auto update all objects with a specific id in the characterID field. And then run a cleanup event that will delete an object that's out of date range you set. Can even be used if you don't use plot poles on your server

Link to comment
Share on other sites

the part help for debugging  is not working propely for my can you give an example were to place the files ?

I tried them but hanging on character request! 

 

And the part nul=[] execVM "KRON_Strings.sqf";

Does that not has to be _nul=[] execVM "KRON_Strings.sqf"; ?

 

Great work geekgarage.. 

Link to comment
Share on other sites

Your welcome, do you also use the PlayerUID system I posted? Would be funny to know who actually use it

Yup running it now.

1 thing i noticed is that the deconstructioncount goes to 6 even if you live and the pole is yours.

I changed in the init  DZE_StaticConstructionCount = 3; to DZE_StaticConstructionCount = 1;

Now it takes 2 steps and i did not tried to deconstruct a pole that is not mine!

In the database the pole gets the characterId from the new character

I will try the deconstruction with my other character. 

I use MultiChar.. Let you know

 

edit:  also 2 steps for not owners for deconstruction 

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