Study Body function

sobber67

New Member
Hey guys,

I'm currently working to get this damn study body funtion to work. I think I'm pretty close to it:

dayz_code -> actions -> study_body.sqf

There are the variables, which should display the playername and the deathreason. The playername works, but not the deathreason. The variable, which should display the reason is the _methodStr. It gets this string out of the stringtable.xml. If we watch into

dayz_code -> stringtable.xml

The deathreasons are written here. (gunshot to the head etc.) However. The _methodStr calls a String out of the stringtable, but not a specific one, it calls "str_death_%1". If you change this to for example "str_death_shothead" it says ingame "His name was [insert name here], it appears he died from a gunshot to the head". Now the question is, what does this "%1" mean and where is written what it should call.
 
Ok update: The only thing that I'm missing is the file where the deathreasons are decleared. Xou know, if it was bloodloss or a gunshot etc. All other things make sense. But I don't seem to find it. Does nobody have at least suggestions to finally solve this?
 
Another Update: When I edit the study_body.sqf like this:

Code:
private["_body","_name","_method","_methodStr"];
_body =    _this select 3;
_name =    _body getVariable["bodyName","unknown"];
_method =    _body getVariable["deathType","unknown"];
 
switch (_method) do
{
        case "shothead":
        {
          _methodStr = localize "str_death_shothead";
        };
        case "shotheavy":
        {
          _methodStr = localize "str_death_shotheavy";
        };
//etc.
 
 
cutText [format[(localize  "str_player_studybody"),_name,_methodStr], "PLAIN DOWN"];

It shows ingame "His name was [insert name here], it appears he died from any". It doesnt matter why the player dies he always shows this 'any'. The question now is, where does he get that from?.
 
maybe something from the death messages would work.

Code:
_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 took the easy way out",_victimName];
        _loc_message = format["PKILL: %1 killed himself", _victimName];
    }
    else
    {
        _message = format["I killed %1 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;
    [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];
};
 
Yeah thought that too, but I don't seee deathreasons there. Just who shot who from which distance and weapon.
 
well if you take a look in the stringable.xml file you will see this

Code:
<Key ID="str_player_studybody">
            <Original>His name was %1, it appears he died from %2</Original>
            <English>His name was %1, it appears he died from %2</English>
            <German>%1 wurde von %2 getötet</German>
            <Russian>Его звали %1, похоже что он умер от %2</Russian>
        </Key>
        <Key ID="str_death_shothead">
            <Original>a gunshot to the head</Original>
            <English>a gunshot to the head</English>
            <German>ein schuss auf den Kopf</German>
            <Russian>попадания пули в голову</Russian>
        </Key>
        <Key ID="str_death_shotheavy">
            <Original>a high calibre gunshot</Original>
            <English>a high calibre gunshot</English>
            <German>eine Großkalibrige Schrotflinte</German>
            <Russian>попадания пули большого калибра</Russian>
        </Key>
        <Key ID="str_death_bled">
            <Original>blood loss</Original>
            <English>blood loss</English>
            <German>blutverlust</German>
            <Russian>потери крови</Russian>
        </Key>
        <Key ID="str_death_dehyd">
            <Original>dehydration</Original>
            <English>dehydration</English>
            <German>dehydration</German>
            <Russian>обезвоживания</Russian>
        </Key>
        <Key ID="str_death_starve">
            <Original>starvation</Original>
            <English>starvation</English>
            <German>verhungern</German>
            <Russian>голода</Russian>
        </Key>
        <Key ID="str_death_combatlog">
            <Original>combat logging</Original>
            <English>combat logging</English>
            <German>combat logging</German>
            <Russian>выхода из игры в режиме боя</Russian>
        </Key>
        <Key ID="str_death_unknown">
            <Original>an unknown cause</Original>
            <English>an unknown cause</English>
            <German>ein unbekannter Grund</German>
            <Russian>неизвестной причины</Russian>
        </Key>

but i can not find where anything above unknown is tracked
 
That's what I mentioned in my startpost. The existing study_body.sqf should work. I don't know why it doesn't.
If you look:

Code:
_method =    _body getVariable["deathType","unknown"];

There it gets the deathType, which should return a value like shotheavy, shothead etc.and this will be saved in the variable '_method'.

I think here is the error. It doesn't return the deathtype correctly. So my question is, where are the deathTypes declared? This would also explain, why my study_body.sqf with the switch-statement doesn't work: It doesn't show one of the str_death-strings, instead it shows 'any'. That means it doesn't return the deathType correctly.
 
Back
Top