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

Hey, so i had this running before the steam required release and was working fine.

 

Then did the update and the player id's changed to the steam ID. So, i didn't want to make drastic changes yet. 

 

What i did, worked for me, was just increase the limit to the characterid column in object_data with a sql command. Syntax for what you use can be found here: http://www.w3schools.com/sql/sql_alter.asp

 

If you received the "out of range" error. This is what i used. http://stackoverflow.com/questions/14284494/mysql-error-1264-out-of-range-value-for-column

 

Then all i had to do was delete the players plot pole with in game tools then give them a new one. Able to build fine and continue using this as before. 

 

ALTER TABLE object_data
MODIFY COLUMN  CharacterID varchar(25)
 
I did attempt to just link what was all ready built with the new steam ID and that didn't work as attended. Well it did alter the column but i wasn't able to build. 
 
SET sql_safe_updates=0;
UPDATE `object_data` SET `CharacterID`='new steam ID' WHERE `CharacterID`='old player ID';
 
This is just a quick fix but got the job done. Hope that helps anyone else trying to fix this. 
 
Good luck and thank you for the work here. 
 
-Detour. 
 
 
 
EDIT: I take it back, i just used the getPlayerUIDOld in place of anything that had getPlayerUID. Works great for right now till i complete the upgrade. 
Edited by Detour
Link to comment
Share on other sites

  • 2 weeks later...

Hello, 

I have been having a problem.  My problem is that when one player tries to tag the other, the names only show up as white like normal.  It only lets the first person tag and not the other.  I have read over all of the steps 3 times now but still will not work.

if there is anyone who could help, that would be awesome!

 

Thanks!

Link to comment
Share on other sites

  • 4 months later...

Having an issue installing this,

 

In step 6, you say to search for _CharID

 

But i do not have that in my updategui

 

 

This is my updateGui.sqf 

 

private ["_display","_ctrlBlood","_ctrlBleed","_bloodVal","_humanityName","_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","_playerUID","_rplayerUID","_rfriendlies","_rfriendlyTo","_distance","_targetControl"];
disableSerialization;
 
_foodVal =  1 - (dayz_hunger / SleepFood);
_thirstVal =  1 - (dayz_thirst / SleepWater);
_tempVal  =  1 - ((dayz_temperatur - dayz_temperaturmin)/(dayz_temperaturmax - dayz_temperaturmin)); // Normalise to [0,1]
_combatVal = 1 - dayz_combat; // May change later to be a range of red/green to loosely indicate 'time left in combat'
 
if (uiNamespace getVariable ["DZ_displayUI", 0] == 1) exitWith {
_array = [_foodVal,_thirstVal];
_array
};
 
_display = uiNamespace getVariable 'DAYZ_GUI_display';
 
_ctrlBlood =  _display displayCtrl 1300;
_ctrlBleed =  _display displayCtrl 1303;
_bloodVal = r_player_blood / r_player_bloodTotal;
_ctrlFood =  _display displayCtrl 1301;
_ctrlThirst =  _display displayCtrl 1302;
_ctrlTemp  =  _display displayCtrl 1306; //TeeChange
_ctrlEar =  _display displayCtrl 1304;
_ctrlEye =  _display displayCtrl 1305;
//_ctrlHumanity = _display displayCtrl 1207;
_ctrlCombat = _display displayCtrl 1307;
_ctrlFracture =  _display displayCtrl 1203;
 
//Food/Water/Blood
_ctrlBlood ctrlSetTextColor  [(Dayz_GUI_R + (0.3 * (1-_bloodVal))),(Dayz_GUI_G * _bloodVal),(Dayz_GUI_B * _bloodVal), 0.5];
_ctrlFood ctrlSetTextColor  [(Dayz_GUI_R + (0.3 * (1-_foodVal))),(Dayz_GUI_G * _foodVal),(Dayz_GUI_B * _foodVal), 0.5];
_ctrlThirst ctrlSetTextColor  [(Dayz_GUI_R + (0.3 * (1-_thirstVal))),(Dayz_GUI_G * _thirstVal),(Dayz_GUI_B * _thirstVal), 0.5];
_ctrlTemp ctrlSetTextColor  [(Dayz_GUI_R + (0.3 * (1-_tempVal))), (Dayz_GUI_G * _tempVal), _tempVal, 0.5]; // Color ranges from iceblue (cold) to red (hot)
_ctrlCombat ctrlSetTextColor [(Dayz_GUI_R + (0.3 * (1-_combatVal))),(Dayz_GUI_G * _combatVal),(Dayz_GUI_B * _combatVal), 0.5];
 
/*
Blood: round((r_player_blood / 2) / 1000) = _bloodLvl (6 = full, 1 = empty)
Thirst: round(_thirstVal / 0.25) = _thirstLvl (4 = full, 0 = empty)
Hunger: round(_foodVal / 0.25) = _foodLvl (4 = full, 0 = empty)
Temp: round(dayz_temperatur) = tempLvl (>= 36 = full <= 28 = empty)
*/
 
_blood = "";
_thirst = "";
_food = "";
_temp = "";
_tempImg = 0;
_bloodLvl = round((r_player_blood / 2) / 1000);
_thirstLvl = round(_thirstVal / 0.25);
_foodLvl = round(_foodVal / 0.25);
_tempLvl = round(dayz_temperatur);
 
/*
diag_log format["DEBUG: bloodlvl: %1 r_player_blood: %2 bloodval: %3",_bloodLvl, r_player_blood, _bloodVal];
diag_log format["DEBUG: thirstlvl: %1 dayz_thirst: %2 thirstval: %3",_thirstLvl, dayz_thirst, _thirstVal];
diag_log format["DEBUG: foodlvl: %1 dayz_hunger: %2 foodval: %3",_foodLvl, dayz_hunger, _foodVal];
diag_log format["DEBUG: templvl: %1 dayz_temperatur: %2 tempval: %3",_tempLvl, dayz_temperatur, _tempVal];
*/
 
if (_bloodLvl <= 0) then { 
_blood = "\z\addons\dayz_code\gui\status_blood_inside_1_ca.paa";
} else {
_blood = "\z\addons\dayz_code\gui\status_blood_inside_" + str(_bloodLvl) + "_ca.paa";
};
 
if (_thirstLvl < 0) then { _thirstLvl = 0 };
_thirst = "\z\addons\dayz_code\gui\status_thirst_inside_" + str(_thirstLvl) + "_ca.paa";
 
if (_foodLvl < 0) then { _foodLvl = 0 };
_food = "\z\addons\dayz_code\gui\status_food_inside_" + str(_foodLvl) + "_ca.paa";
 
if ( _tempLvl >= 36 ) then { _tempImg = 4 };
if ( _tempLvl > 33 && _tempLvl < 36 ) then { _tempImg = 3 };
if ( _tempLvl >= 30 && _tempLvl <= 33 ) then { _tempImg = 2 };
if ( _tempLvl > 28 && _tempLvl < 30 ) then { _tempImg = 1 };
if ( _tempLvl <= 28 ) then { _tempImg = 0 };
 
_temp = "\z\addons\dayz_code\gui\status_temp_" + str(_tempImg) + "_ca.paa";
 
_ctrlBlood ctrlSetText _blood;
_ctrlThirst ctrlSetText _thirst;
_ctrlFood ctrlSetText _food;
_ctrlTemp ctrlSetText _temp;
 
/*
Visual:
*/
_visualtext = "";
    _visual = (round((dayz_disVisual / 100) * 4)) min 5;
if (_visual > 0) then {_visualtext = "\z\addons\dayz_code\gui\val_" + str(_visual) + "_ca.paa"};
_ctrlEye ctrlSetText _visualtext;
 
/*
Audible:
*/
_audibletext = "";
    _audible = (round((dayz_disAudial / 50) * 4)) min 5;
if (_audible > 0) then {_audibletext = "\z\addons\dayz_code\gui\val_" + str(_audible) + "_ca.paa"};
_ctrlEar ctrlSetText _audibletext;
 
/*
Fracture:
*/
if (!canStand player) then {
if (!(ctrlShown _ctrlFracture)) then {
r_fracture_legs = true;
_ctrlFracture ctrlShow true;
};
};
 
/*
Flashing:
*/
if (_combatVal == 0) then {
_ctrlCombat call player_guiControlFlash;
};
 
if (_bloodVal < 0.2) then {
_ctrlBlood call player_guiControlFlash;
};
 
if (_thirstVal < 0.2) then {
_ctrlThirst call player_guiControlFlash;
};
 
if (_foodVal < 0.2) then {
_ctrlFood call player_guiControlFlash;
};
 
if (_tempVal > 0.8) then { //TeeChange
_ctrlTemp call player_guiControlFlash;
} else {
_ctrlTemp ctrlShow true;
};
 
if (r_player_injured) then {
_ctrlBleed call player_guiControlFlash;
};
 
/*
Opt-in tag system with friend tagging
*/
_string = "";
_humanityTarget = cursorTarget;
if (!isNull _humanityTarget && isPlayer _humanityTarget && alive _humanityTarget) then {
 
_distance = player distance _humanityTarget;
 
if (_distance < DZE_HumanityTargetDistance) then {
 
_size = (1-(floor(_distance/5)*0.1)) max 0.1;
 
// Display name if player opt-in || if friend
_friendlies = player getVariable ["friendlies", []];
_playerUID = getPlayerUID player;
 
_rplayerUID = getPlayerUID _humanityTarget;
_rfriendlies = _humanityTarget getVariable ["friendlies", []];
_rfriendlyTo = _humanityTarget getVariable ["friendlyTo", []];
 
if ((_rplayerUID in _friendlies) && (_playerUID in _rfriendlies)) then {
 
if !(_playerUID in _rfriendlyTo) then {
// diag_log format["IS FRIENDLY: %1", _player];
_rfriendlyTo set [count _rfriendlyTo, _playerUID];
_humanityTarget setVariable ["friendlyTo", _rfriendlyTo, true];
};
 
// <br /><t %2 align='center' size='0.7'>Humanity: %3</t>
 
_color = "color='#339933'";
_string = format["<t %2 align='center' size='%3'>%1</t>",(name _humanityTarget),_color,_size];
 
} else {
 
// Humanity checks
_humanity = _humanityTarget getVariable ["humanity",0];
 
_color = "color='#ffffff'";
if(_humanity < -5000) then {
_color = "color='#ff0000'";
} else {
if(_humanity > 5000) then {
_color = "color='#3333ff'";
};
};
if((_humanityTarget getVariable ["DZE_display_name", false]) || (DZE_ForceNameTagsInTrader && isInTraderCity)) then {
_string = format["<t %2 align='center' size='%3'>%1</t>",(name _humanityTarget),_color,_size];
};
};
};
};
 
// update gui if changed
if (dayz_humanitytarget != _string) then {
_targetControl = _display displayCtrl 1199;
_targetControl ctrlSetStructuredText (parseText _string);
dayz_humanitytarget = _string;
};
 
_array = [_foodVal,_thirstVal];
_array

Link to comment
Share on other sites

Having an issue installing this,

 

In step 6, you say to search for _CharID

 

But i do not have that in my updategui

 

 

This is my updateGui.sqf 

 

private ["_display","_ctrlBlood","_ctrlBleed","_bloodVal","_humanityName","_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","_playerUID","_rplayerUID","_rfriendlies","_rfriendlyTo","_distance","_targetControl"];
disableSerialization;
 
_foodVal =  1 - (dayz_hunger / SleepFood);
_thirstVal =  1 - (dayz_thirst / SleepWater);
_tempVal  =  1 - ((dayz_temperatur - dayz_temperaturmin)/(dayz_temperaturmax - dayz_temperaturmin)); // Normalise to [0,1]
_combatVal = 1 - dayz_combat; // May change later to be a range of red/green to loosely indicate 'time left in combat'
 
if (uiNamespace getVariable ["DZ_displayUI", 0] == 1) exitWith {
_array = [_foodVal,_thirstVal];
_array
};
 
_display = uiNamespace getVariable 'DAYZ_GUI_display';
 
_ctrlBlood =  _display displayCtrl 1300;
_ctrlBleed =  _display displayCtrl 1303;
_bloodVal = r_player_blood / r_player_bloodTotal;
_ctrlFood =  _display displayCtrl 1301;
_ctrlThirst =  _display displayCtrl 1302;
_ctrlTemp  =  _display displayCtrl 1306; //TeeChange
_ctrlEar =  _display displayCtrl 1304;
_ctrlEye =  _display displayCtrl 1305;
//_ctrlHumanity = _display displayCtrl 1207;
_ctrlCombat = _display displayCtrl 1307;
_ctrlFracture =  _display displayCtrl 1203;
 
//Food/Water/Blood
_ctrlBlood ctrlSetTextColor  [(Dayz_GUI_R + (0.3 * (1-_bloodVal))),(Dayz_GUI_G * _bloodVal),(Dayz_GUI_B * _bloodVal), 0.5];
_ctrlFood ctrlSetTextColor  [(Dayz_GUI_R + (0.3 * (1-_foodVal))),(Dayz_GUI_G * _foodVal),(Dayz_GUI_B * _foodVal), 0.5];
_ctrlThirst ctrlSetTextColor  [(Dayz_GUI_R + (0.3 * (1-_thirstVal))),(Dayz_GUI_G * _thirstVal),(Dayz_GUI_B * _thirstVal), 0.5];
_ctrlTemp ctrlSetTextColor  [(Dayz_GUI_R + (0.3 * (1-_tempVal))), (Dayz_GUI_G * _tempVal), _tempVal, 0.5]; // Color ranges from iceblue (cold) to red (hot)
_ctrlCombat ctrlSetTextColor [(Dayz_GUI_R + (0.3 * (1-_combatVal))),(Dayz_GUI_G * _combatVal),(Dayz_GUI_B * _combatVal), 0.5];
 
/*
Blood: round((r_player_blood / 2) / 1000) = _bloodLvl (6 = full, 1 = empty)
Thirst: round(_thirstVal / 0.25) = _thirstLvl (4 = full, 0 = empty)
Hunger: round(_foodVal / 0.25) = _foodLvl (4 = full, 0 = empty)
Temp: round(dayz_temperatur) = tempLvl (>= 36 = full <= 28 = empty)
*/
 
_blood = "";
_thirst = "";
_food = "";
_temp = "";
_tempImg = 0;
_bloodLvl = round((r_player_blood / 2) / 1000);
_thirstLvl = round(_thirstVal / 0.25);
_foodLvl = round(_foodVal / 0.25);
_tempLvl = round(dayz_temperatur);
 
/*
diag_log format["DEBUG: bloodlvl: %1 r_player_blood: %2 bloodval: %3",_bloodLvl, r_player_blood, _bloodVal];
diag_log format["DEBUG: thirstlvl: %1 dayz_thirst: %2 thirstval: %3",_thirstLvl, dayz_thirst, _thirstVal];
diag_log format["DEBUG: foodlvl: %1 dayz_hunger: %2 foodval: %3",_foodLvl, dayz_hunger, _foodVal];
diag_log format["DEBUG: templvl: %1 dayz_temperatur: %2 tempval: %3",_tempLvl, dayz_temperatur, _tempVal];
*/
 
if (_bloodLvl <= 0) then { 
_blood = "\z\addons\dayz_code\gui\status_blood_inside_1_ca.paa";
} else {
_blood = "\z\addons\dayz_code\gui\status_blood_inside_" + str(_bloodLvl) + "_ca.paa";
};
 
if (_thirstLvl < 0) then { _thirstLvl = 0 };
_thirst = "\z\addons\dayz_code\gui\status_thirst_inside_" + str(_thirstLvl) + "_ca.paa";
 
if (_foodLvl < 0) then { _foodLvl = 0 };
_food = "\z\addons\dayz_code\gui\status_food_inside_" + str(_foodLvl) + "_ca.paa";
 
if ( _tempLvl >= 36 ) then { _tempImg = 4 };
if ( _tempLvl > 33 && _tempLvl < 36 ) then { _tempImg = 3 };
if ( _tempLvl >= 30 && _tempLvl <= 33 ) then { _tempImg = 2 };
if ( _tempLvl > 28 && _tempLvl < 30 ) then { _tempImg = 1 };
if ( _tempLvl <= 28 ) then { _tempImg = 0 };
 
_temp = "\z\addons\dayz_code\gui\status_temp_" + str(_tempImg) + "_ca.paa";
 
_ctrlBlood ctrlSetText _blood;
_ctrlThirst ctrlSetText _thirst;
_ctrlFood ctrlSetText _food;
_ctrlTemp ctrlSetText _temp;
 
/*
Visual:
*/
_visualtext = "";
    _visual = (round((dayz_disVisual / 100) * 4)) min 5;
if (_visual > 0) then {_visualtext = "\z\addons\dayz_code\gui\val_" + str(_visual) + "_ca.paa"};
_ctrlEye ctrlSetText _visualtext;
 
/*
Audible:
*/
_audibletext = "";
    _audible = (round((dayz_disAudial / 50) * 4)) min 5;
if (_audible > 0) then {_audibletext = "\z\addons\dayz_code\gui\val_" + str(_audible) + "_ca.paa"};
_ctrlEar ctrlSetText _audibletext;
 
/*
Fracture:
*/
if (!canStand player) then {
if (!(ctrlShown _ctrlFracture)) then {
r_fracture_legs = true;
_ctrlFracture ctrlShow true;
};
};
 
/*
Flashing:
*/
if (_combatVal == 0) then {
_ctrlCombat call player_guiControlFlash;
};
 
if (_bloodVal < 0.2) then {
_ctrlBlood call player_guiControlFlash;
};
 
if (_thirstVal < 0.2) then {
_ctrlThirst call player_guiControlFlash;
};
 
if (_foodVal < 0.2) then {
_ctrlFood call player_guiControlFlash;
};
 
if (_tempVal > 0.8) then { //TeeChange
_ctrlTemp call player_guiControlFlash;
} else {
_ctrlTemp ctrlShow true;
};
 
if (r_player_injured) then {
_ctrlBleed call player_guiControlFlash;
};
 
/*
Opt-in tag system with friend tagging
*/
_string = "";
_humanityTarget = cursorTarget;
if (!isNull _humanityTarget && isPlayer _humanityTarget && alive _humanityTarget) then {
 
_distance = player distance _humanityTarget;
 
if (_distance < DZE_HumanityTargetDistance) then {
 
_size = (1-(floor(_distance/5)*0.1)) max 0.1;
 
// Display name if player opt-in || if friend
_friendlies = player getVariable ["friendlies", []];
_playerUID = getPlayerUID player;
 
_rplayerUID = getPlayerUID _humanityTarget;
_rfriendlies = _humanityTarget getVariable ["friendlies", []];
_rfriendlyTo = _humanityTarget getVariable ["friendlyTo", []];
 
if ((_rplayerUID in _friendlies) && (_playerUID in _rfriendlies)) then {
 
if !(_playerUID in _rfriendlyTo) then {
// diag_log format["IS FRIENDLY: %1", _player];
_rfriendlyTo set [count _rfriendlyTo, _playerUID];
_humanityTarget setVariable ["friendlyTo", _rfriendlyTo, true];
};
 
// <br /><t %2 align='center' size='0.7'>Humanity: %3</t>
 
_color = "color='#339933'";
_string = format["<t %2 align='center' size='%3'>%1</t>",(name _humanityTarget),_color,_size];
 
} else {
 
// Humanity checks
_humanity = _humanityTarget getVariable ["humanity",0];
 
_color = "color='#ffffff'";
if(_humanity < -5000) then {
_color = "color='#ff0000'";
} else {
if(_humanity > 5000) then {
_color = "color='#3333ff'";
};
};
if((_humanityTarget getVariable ["DZE_display_name", false]) || (DZE_ForceNameTagsInTrader && isInTraderCity)) then {
_string = format["<t %2 align='center' size='%3'>%1</t>",(name _humanityTarget),_color,_size];
};
};
};
};
 
// update gui if changed
if (dayz_humanitytarget != _string) then {
_targetControl = _display displayCtrl 1199;
_targetControl ctrlSetStructuredText (parseText _string);
dayz_humanitytarget = _string;
};
 
_array = [_foodVal,_thirstVal];
_array

Try     _playerUID

Link to comment
Share on other sites

  • 9 months later...
  • 8 months later...
On 9/29/2015 at 0:13 AM, bFe said:

Does this work with 1.0.5.1?

Just to reply to this in case anyone else has been wondering.  No it doesn't work due to an out of bounds exception with the PlayerUID being too long for the database. :( 
I have tried increasing the length and the data type for the objectID and CharacterID which doesn't work. 

Hive.ext Error:
HiveExt(0): [Error] Error executing |CHILD:308:19:CinderWall_DZ:0:76561198053773143:[300.73,[9633.21,10487,0.00143909],[[-0.859584,0.510994,0],[0,0,1]]]:[]:[]:0:96332104870065:|
 

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