[Release] Fred's Dead Player Journal (Study Body Replacement)

Yeh that will work, im not bothering till i see the new update on monday and see wether it actually fixes the loot on panthera, you can also stick the temp thing into that, its just a case of adding _temp to your cuttext and the temp code to it

if it does fix the loot/zombie spawns on panth, gonna redo my whole pbo, its a mess atm. calling for nearly every file in ur compiles.sqf but in the mission folder itself :p
 
Ok, so my code is

Code:
private ["_body", "_name", "_kills", "_killsH", "_killsB", "_humanity","_temp","_diff","_dateNow","_deathTime","_body","_name","_method","_methodStr"];
 
_body =    _this select 3;
_name =    _body getVariable["bodyName","unknown"];
_method =    _body getVariable["deathType","unknown"];
_deathTime =    _body getVariable["deathTime",-1];
_methodStr = localize format ["str_death_%1",_method];
 
 
 
//diag_log ("STUDY: deathtime " +str(_deathTime));
if (_deathTime < 0) then {
    _temp = "unknown";
} else {
    _dateNow = (DateToNumber date);
    _diff = (_dateNow - _deathTime) * 525948;
 
    _temp = "The body is freezing";
 
    if ( _diff < 30 ) then {
        _temp = "The body is cold";
    };
 
    if ( _diff < 15 ) then {
        _temp = "The body is slightly warm";
    };
 
    if ( _diff < 5 ) then {
        _temp = "The body is still warm";
    };
};
cutText [format["Their name was %1. %2. It appears there is a journal on the body.",_name,_temp], "PLAIN DOWN"];
sleep 2;
 
_body = _this select 3;
_name = _body getVariable ["bodyName","unknown"];
_kills = _body getVariable ["zombieKills",0];
_killsH = _body getVariable ["humanKills",0];
_killsB = _body getVariable ["banditKills",0];
_humanity = _body getVariable ["humanity",0];
 
cutText [format["Zombie Kills: %1, Murders: %2, Bandit Kills: %3, Humanity: %4.",_kills,_killsH,_killsB,_humanity], "PLAIN DOWN"];
sleep 5;

But, that only shows the following;

"Their name was NAME. It appears there is a journal on the body."

then

"Zombie Kills: X, Murders: X, Bandit Kills: X, Humanity: X."

Any idea why the temperature feature is not active?
 
the temperature body can be buggy at times, but works for the most part, thats the code i took straight from the file i tried, which was displaying the message, so try checking a few bodies
 
got it in there, but no other players alive at the moment, i will test it soon. otherwise GREAT JOB. ( If it works.. LOL )
 
Works brilliantly, nice job.

How would you add "killed by XX" if you wanted to? cheers


Code:
private ["_body", "_name", "_kills", "_killsH", "_killsB", "_humanity","_temp","_diff","_dateNow","_deathTime","_body","_name","_method","_methodStr","_killerName","_weapon","_distance"];
 
_body =    _this select 3;
_name =    _body getVariable["bodyName","unknown"];
_method =    _body getVariable["deathType","unknown"];
_deathTime =    _body getVariable["deathTime",-1];
_methodStr = localize format ["str_death_%1",_method];
_killerName = _body getVariable["AttackedByName", "nil"];
_weapon = _body getVariable["AttackedByWeapon", "nil"];
_distance = _body getVariable["AttackedFromDistance", "nil"];
_kills = _body getVariable ["zombieKills",0];
_killsH = _body getVariable ["humanKills",0];
_killsB = _body getVariable ["banditKills",0];
_humanity = _body getVariable ["humanity",0];
 
//diag_log ("STUDY: deathtime " +str(_deathTime));
if (_deathTime < 0) then {
    _temp = "";
} else {
    _dateNow = (DateToNumber date);
    _diff = (_dateNow - _deathTime) * 525948;
    _temp = "The body is freezing.";
 
    if ( _diff < 20 ) then {
        _temp = "The body is cold.";
    };
 
    if ( _diff < 8 ) then {
        _temp = "The body is slightly warm.";
    };
 
    if ( _diff < 4 ) then {
        _temp = "The body is still warm.";
    };
};
 
cutText [format["Their name was %1. %2",_name,_temp], "PLAIN DOWN"];
sleep 5;
 
cutText [format["They were killed by %1 with weapon %2 from %3m. It appears there is a journal on the body...",_killerName,_weapon,_distance], "PLAIN DOWN"];
sleep 5;
 
cutText [format["Zombie Kills: %1, Murders: %2, Bandit Kills: %3, Humanity: %4.",_kills,_killsH,_killsB,_humanity], "PLAIN DOWN"];
sleep 5;

Be warned though, if there is no killer it will say "They were killed by nil with weapon nil from nilm"
 
You could try this so it will only show the kill message if one exists. I'm no expert, but I believe this will work;

Code:
private ["_body", "_name", "_kills", "_killsH", "_killsB", "_humanity","_temp","_diff","_dateNow","_deathTime","_body","_name","_method","_methodStr","_killerName","_weapon","_distance","_killMsg"];
 
_body =    _this select 3;
_name =    _body getVariable["bodyName","unknown"];
_method =    _body getVariable["deathType","unknown"];
_deathTime =    _body getVariable["deathTime",-1];
_methodStr = localize format ["str_death_%1",_method];
_killerName = _body getVariable["AttackedByName", "nil"];
_weapon = _body getVariable["AttackedByWeapon", "nil"];
_distance = _body getVariable["AttackedFromDistance", "nil"];
_kills = _body getVariable ["zombieKills",0];
_killsH = _body getVariable ["humanKills",0];
_killsB = _body getVariable ["banditKills",0];
_humanity = _body getVariable ["humanity",0];
 
if (_killerName == "nil") then {
    _killMsg = "";
} else {
    _killMsg = "They were killed by " + _killerName + " with weapon " + _weapon + " from " + _distance + "m. ";
};
 
//diag_log ("STUDY: deathtime " +str(_deathTime));
if (_deathTime < 0) then {
    _temp = "";
} else {
    _dateNow = (DateToNumber date);
    _diff = (_dateNow - _deathTime) * 525948;
    _temp = "The body is freezing.";
 
    if ( _diff < 20 ) then {
        _temp = "The body is cold.";
    };
 
    if ( _diff < 8 ) then {
        _temp = "The body is slightly warm.";
    };
 
    if ( _diff < 4 ) then {
        _temp = "The body is still warm.";
    };
};
   
cutText [format["Their name was %1. %2",_name,_temp], "PLAIN DOWN"];
sleep 5;
 
cutText [format["%1It appears there is a journal on the body...",_killMsg], "PLAIN DOWN"];
sleep 5;
 
cutText [format["Zombie Kills: %1, Murders: %2, Bandit Kills: %3, Humanity: %4.",_kills,_killsH,_killsB,_humanity], "PLAIN DOWN"];
sleep 5;
 
Yes, I believe so. I reduced the values from what they were originally as under a heavy load (ie, when the server fps drops) it takes longer to register, so I went for a happy medium to work at both low and high server load.
 
the temperature body can be buggy at times, but works for the most part, thats the code i took straight from the file i tried, which was displaying the message, so try checking a few bodies

It's not buggy. You've just copied the code from this thread (credits to king2k) without even trying to understand it.
It needs a new variable in player_death.sqf which will mark the dead body with a time stamp - that's all.
 
It's not buggy. You've just copied the code from this thread (credits to king2k) without even trying to understand it.
It needs a new variable in player_death.sqf which will mark the dead body with a time stamp - that's all.


That was exactly the issue I had, it works fine now.

@MajoeT , the second segment of code I have written above does not work correctly. It will show the new study body cutText, but it will never show the kill message too. The first segment of code I posted does work however.

Could someone tell me what's wrong with

Code:
if (_killerName == "nil") then {
    _killMsg = "";
} else {
    _killMsg = "They were killed by " + _killerName + " with weapon " + _weapon + " from " + _distance + "m. ";
};
 
Doesnt appear to show the killer, weapon or distance or even the temperature! I watched a couple of people get shot and it just says "nil" :(

What did I do wrong?
 
Doesnt appear to show the killer, weapon or distance or even the temperature! I watched a couple of people get shot and it just says "nil" :(

What did I do wrong?


The main thing you did wrong was adding a bunch of code that random people posted in my thread instead of just using what I released. :p
 
The main thing you did wrong was adding a bunch of code that random people posted in my thread instead of just using what I released. :p

Exactly ;) But seriously, that worked for me. Maybe compare your server_playerDied.sqf with mine?

Code:
private["_characterID","_minutes","_newObject","_playerID","_key","_playerName","_playerID","_myGroup","_group","_victim", "_killer", "_weapon", "_message", "_distance","_loc_message","_victimName","_killerName","_killerPlayerID"];
//[unit, weapon, muzzle, mode, ammo, magazine, projectile]
_characterID =    _this select 0;
_minutes =        _this select 1;
_newObject =    _this select 2;
_playerID =    _this select 3;
_playerName =    _this select 4;
 
_victim removeAllEventHandlers "MPHit";
 
_victim = _this select 2;
_victimName = _victim getVariable["bodyName", "nil"];
 
_killer = _victim getVariable["AttackedBy", "nil"];
_killerName = _victim getVariable["AttackedByName", "nil"];
 
// when a zombie kills a player _killer, _killerName and _weapon will be "nil"
// we can use this to determine a zombie kill and send a customized message for that. right now no killmsg means it was a zombie.
if (_killerName != "nil") then
{
    _weapon = _victim getVariable["AttackedByWeapon", "nil"];
    _distance = _victim getVariable["AttackedFromDistance", "nil"];
 
    if (_victimName == _killerName) then
    {
        _message = format["%1 killed himself",_victimName];
        _loc_message = format["PKILL: %1 killed himself", _victimName];
    }
    else
    {
        _killerPlayerID = getPlayerUID _killer;
        _message = format["%1 was killed by %2 with weapon %3 from %4m",_victimName, _killerName, _weapon, _distance];
        _loc_message = format["PKILL: %1 (%5) was killed by %2 (%6) with weapon %3 from %4m", _victimName, _killerName, _weapon, _distance, _playerID, _killerPlayerID];
    };
 
    diag_log _loc_message;
    [nil, nil, rspawn, [_killer, _message], { (_this select 0) globalChat (_this select 1) }] call RE;
    //[nil, nil, rHINT, _message] call RE;
 
    // Cleanup
    _victim setVariable["AttackedBy", "nil", true];
    _victim setVariable["AttackedByName", "nil", true];
    _victim setVariable["AttackedByWeapon", "nil", true];
    _victim setVariable["AttackedFromDistance", "nil", true];
};
 
dayz_disco = dayz_disco - [_playerID];
_newObject setVariable["processedDeath",time];
 
/*
diag_log ("DW_DEBUG: (isnil _characterID): " + str(isnil "_characterID"));
if (isnil "_characterID") then {
diag_log ("DW_DEBUG: _newObject: " + str(_newObject));   
    };
*/
 
if (typeName _minutes == "STRING") then {
    _minutes = parseNumber _minutes;
};
 
if (_characterID != "0") then {
    _key = format["CHILD:202:%1:%2:",_characterID,_minutes];
    //diag_log ("HIVE: WRITE: "+ str(_key));
    _key call server_hiveWrite;
} else {
    deleteVehicle _newObject;
};
 
diag_log ("PDEATH: Player Died " + _playerID);
/*
_eh = [_newObject] spawn {
    _body = _this select 0;
    _method = _body getVariable["deathType","unknown"];
    _name = _body getVariable["bodyName","unknown"];
    waitUntil{!isPlayer _body;sleep 1};
    _body setVariable["deathType",_method,true];
    _body setVariable["bodyName",_name,true];
    diag_log ("PDEATH: Player Left Body " + _name);
};
*/
//dead_bodyCleanup set [count dead_bodyCleanup,_newObject];
 
The main thing you did wrong was adding a bunch of code that random people posted in my thread instead of just using what I released. :p


Well I did ask for help and this person was kind enough to reply with a solution.

Althasil - its likely because I'm using DayZ Epoch so my playerdied is different to that:

private["_characterID","_minutes","_newObject","_playerID","_playerName","_infected","_victim","_victimName","_killer","_killerName","_weapon","_distance","_message","_loc_message","_key","_eh","_body","_method","_name"];
//[unit, weapon, muzzle, mode, ammo, magazine, projectile]
_characterID =_this select 0;
_minutes =_this select 1;
_newObject =_this select 2;
_playerID =_this select 3;
_playerName =_this select 4;
_infected =_this select 5;


_victim removeAllEventHandlers "MPHit";


_victim = _this select 2;
_victimName = _victim getVariable["bodyName", "nil"];


_killer = _victim getVariable["AttackedBy", "nil"];
_killerName = _victim getVariable["AttackedByName", "nil"];


// when a zombie kills a player _killer, _killerName and _weapon will be "nil"
// we can use this to determine a zombie kill and send a customized message for that. right now no killmsg means it was a zombie.
if (_killerName != "nil") then
{
_weapon = _victim getVariable["AttackedByWeapon", "nil"];
_distance = _victim getVariable["AttackedFromDistance", "nil"];


if (_victimName == _killerName) then
{
_message = format["%1 killed himself",_victimName];
_loc_message = format["PKILL: %1 killed himself", _victimName];
}
else
{

_message = format["%1 was killed by %2 with weapon %3 from %4m",_victimName, _killerName, _weapon, _distance];
_loc_message = format["PKILL: %1 was killed by %2 with weapon %3 from %4m", _victimName, _killerName, _weapon, _distance];
};


diag_log _loc_message;
if(DZE_DeathMsgGlobal) then {
[nil, nil, rspawn, [_killer, _message], { (_this select 0) globalChat (_this select 1) }] call RE;
};
if(DZE_DeathMsgSide) then {
[nil, nil, rspawn, [_killer, _message], { (_this select 0) sideChat (_this select 1) }] call RE;
};
if(DZE_DeathMsgTitleTextLocal) then {
[nil,nil,"loc",rTITLETEXT,_message,"PLAIN DOWN"] call RE;
};
if(DZE_DeathMsgTitleText) then {
[nil,nil,"per",rTITLETEXT,_message,"PLAIN DOWN"] call RE;
};

// build array to store death messages to allow viewing at message board in trader citys.
PlayerDeaths set [count PlayerDeaths,_message];



// Cleanup
_victim setVariable["AttackedBy", "nil", true];
_victim setVariable["AttackedByName", "nil", true];
_victim setVariable["AttackedByWeapon", "nil", true];
_victim setVariable["AttackedFromDistance", "nil", true];
};


dayz_disco = dayz_disco - [_playerID];
_newObject setVariable["processedDeath",time];


/*
diag_log ("DW_DEBUG: (isnil _characterID): " + str(isnil "_characterID"));
if (isnil "_characterID") then {
diag_log ("DW_DEBUG: _newObject: " + str(_newObject));
};
*/

if (typeName _minutes == "STRING") then
{


_minutes = parseNumber _minutes;
};

if (_characterID != "0") then
{


_key = format["CHILD:202:%1:%2:%3:",_characterID,_minutes,_infected];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
}
else
{

deleteVehicle _newObject;
};


diag_log ("PDEATH: Player Died " + _playerID);
/*
_eh = [_newObject] spawn {
_body = _this select 0;
_method = _body getVariable["deathType","unknown"];
_name = _body getVariable["bodyName","unknown"];
waitUntil{!isPlayer _body;sleep 1};
_body setVariable["deathType",_method,true];
_body setVariable["bodyName",_name,true];
diag_log ("PDEATH: Player Left Body " + _name);
};
*/
//dead_bodyCleanup set [count dead_bodyCleanup,_newObject];
Any ideas? :) I also noticed my death message board has actually stopped working before adding the journal actually
 
Ah, well if there is no death message in game it will show as nil. For example, 2 players are killed on my server side-by-side but a killmessage saying "player X was killed by player Y with weapon Z from ##m" only appears for one. The one with the kill message will show it on the body whereas the other will show "They were killed by player nil with weapon nil from nilm". It will also show in the latter way if you study a dead animal.

I pretty much abandoned the idea for now. I would suggest either using Fred's method or as Gorsy suggested adding the temperature gauge too.
 
It's not buggy. You've just copied the code from this thread (credits to king2k) without even trying to understand it.
It needs a new variable in player_death.sqf which will mark the dead body with a time stamp - that's all.

So I dont understand the code, nice. I just happened to have it working on my server for at least a month on a server which hits 50 people nearly every night. It can on rare situations when the server is under heavy load, fail to register the temp, Not had that issue since moving to a dedi

The code i posted there, was just what changes I made to my study_body after adding freds thing in, for players who already have the temp and wanted to keep it

I did not at any time claim it wud work for players who hadnt followed the tut, and ive not had the time to constantly check on posts while setting up a dedi and rewriting PBO's

My reply was in response to the fact that it dosnt always work 100% when it is installed. If he dosnt see it on any body at all then yeh he does need to check the post for the other changes, as he never had it installed in the first place
 
The temp doesn't display for me, just says "unknown" on any body. Strange! The journal works though.
 
Back
Top