Realistic Study Body Function - Somebody Needs To Start This :)

unkinhead

Member
*Saw the following quoted thread posted by another, and was fascinated by the idea. I think its fair to say it would REALLY increase eeriness to the game to really understand how someone died, and use that knowledge to help you in the game.

IE: Temperature: Warm ; death via gunshot wound --- Proper Reaction - OH SHIT! HIDE!

Anyways here is the thread post, i personally think its a great idea, so i thought i would re surface the topic, if everyone whos familiar with php that wants to give this project a shot, i would appreciate it and so would many others, i would suggest looking at PlayerDeathAction , or StudyBody sqfs. Anyways here is the post::::

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

"


is there anyway to add a cause of death or make it more advanced when you study a body?

example;

This is player_name, he died by a bullet wound. - gun
This is player_name, he died by a sharp object. - axe / crowbar / crossbow
This is player_name, he died by being infected. - zombies
This is player_name, he died by being fatigued. - starving / thirst

or an option like "check temperature"

player_name's body feels warm. - indicating a recent death. (five minutes)
player_name's body feels slightly warm. - indicating a semi-recent death. (fifteen minutes)
player_name's body feels cold. - indicating a death within thirty minutes to an hour.
player_name's body feels freezing. - indicating the death happened a long time ago.

"

 
Aye something like this would be nice. Increase the time it takes the server to clean up bodies and having this... I can see it being interesting gameplay. I mean the death message already can give you person/gun/distance, rather than have that displayed to all, I'd rather the gun/distance/type of death be linked into the body itself.
 
I looked into it after I read the post yesterday. The cause of death I havent looked into, but the time of death is not that hard to implement.

I did a "proof of concept" implementation on my test server.

3 dayz_code files need to be put into the root of your mission file:
player_death.sqf
study_body.sqf
fn_selfActions.sqf

In init.sqf add this after call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf;
Code:
//Player only
if (!isDedicated) then {
    fnc_usec_selfActions =    compile preprocessFileLineNumbers "fn_selfActions.sqf";
    player_death =        compile preprocessFileLineNumbers "player_death.sqf";
};


in player_death.sqf add this after the line: _body setVariable ["deathType",_method,true];
Code:
    _dateDeath = (DateToNumber date);
    _body setVariable ["deathTime",_dateDeath,true];
and change the first line to:
Code:
private["_dateDeath","_array","_source","_kills","_killsV","_humanity","_wait","_myKills"];



in study_body.sqf change it to this:
Code:
private["_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["His name was %1 It appears he died from %2. %3",_name,_methodStr,_temp], "PLAIN DOWN"];
Notice I removed the localization of the cutText (had to as I can't change the .xml file in the dayzcode). This means that it will be displayed in english on all clients.


in fn_selfActions.sqf find the studybody line and change to:
Code:
s_player_studybody = player addAction [localize "str_action_studybody", "study_body.sqf",cursorTarget, 0, false, true, "",""];


This is just an example of how it can be done. Tested it briefly and it seems to work. I'll leave it to someone else to polish up the code and fine tune it :)
 
+ compile lines in init.sqf

This will add a timestamp to the body (remember to add _dateDeath to private variable list also..)

I did everything you said apart from this two things wich i am not sure about.

What should i add in the compile lines?

And i do not know where to add the datedeath in "private variable list"

Thanks alot, it would be amazing to get this to work!
 
If i was to put this on a live server i would have changed the study_body code a little, like:
Code:
if (_deathTime < 0) then {
    _temp = ""; // empty if no time of death
} else {
    _dateNow = (DateToNumber date);
    _diff = (_dateNow - _deathTime) * 525948;
 
    _temp = "The body is freezing (>30)";
 
    if ( _diff < 30 ) then {
        _temp = "The body is cold (<30)";
    };
 
    if ( _diff < 15 ) then {
        _temp = "The body is slightly warm (<15)";
    };
 
    if ( _diff < 5 ) then {
        _temp = "The body is still warm (<5)";
    };
};

Suggested changes:
_temp = ""

If no timestamp on body then dont display anything.

Added time on each state. This way you wont be bother by every new player about what is the limit is for each stage.
 
_body setVariable ["deathType",_method,true]; - There's 2 of these in the player_death.sqf


So which one does this part go under?

Code:
    _dateDeath = (DateToNumber date);
    _body setVariable ["deathTime",_dateDeath,true];

Also i'm already using a heavily modified compiles.sqf

so can i skip adding this part to the init.sqf and instead change the lines their correspond to in the compiles.sqf?

Code:
//Player only
if (!isDedicated) then {
    fnc_usec_selfActions =    compile preprocessFileLineNumbers "fn_selfActions.sqf";
    player_death =        compile preprocessFileLineNumbers "player_death.sqf";
};
 
** Add to this with the gut (human / animal) functions **

If temperature is cold or freezing, meat = stale or bad... gives 1/2 hit points and possibly an infection, even if cooked.

Just a thought :)
 
Back
Top