1.8.7 Kill Messages?

HospitalChair

Well-Known Member
I was wondering if anyone had an update for this last patch (Dayzmod cherno 1.8.7). I attempted to use my old script taking from this:

http://opendayz.net/threads/kill-messages-1-8-2.20957/

I had a scripter tweak it for 1.8.6.1 for me but he has since disappeared on me and i havent been able to debug. This is one of the few scripts that my players are desperately wanting and I'm willing to compensate someone for their time.

Thanks
 

Inkko

Valued Member!
I was wondering if anyone had an update for this last patch (Dayzmod cherno 1.8.7). I attempted to use my old script taking from this:

http://opendayz.net/threads/kill-messages-1-8-2.20957/

I had a scripter tweak it for 1.8.6.1 for me but he has since disappeared on me and i havent been able to debug. This is one of the few scripts that my players are desperately wanting and I'm willing to compensate someone for their time.

Thanks

I have my own kill messages that I made cause I couldn't get any other variants to work. It's a lil buggy but seems to work fairly well most of the time.
 

Inkko

Valued Member!
Can probably update mine to have weapon images or improve the look of it but this is what I threw together.

Server Side:

server_monitor.sqf at the very bottom change the PVDZ_sec_atp PVEH to this:
Code:
"PVDZ_sec_atp" addPublicVariableEventHandler {
    _x = _this select 1;
    switch (1==1) do {
        case (typeName _x == "STRING") : { // just some logs from the client
            diag_log _x;
        };
        case (count _x == 2) : { // wrong side
            diag_log Format [ "P1ayer %1 reports possible 'side' hack... Server may be comprised!", (_x select 1) call fa_plr2Str ];
        };
        default { // player hit
            _unit = _x select 0;
            _source = _x select 1;
            if (((!(isNil {_source})) AND {(!(isNull _source))}) AND {((_source isKindOf "CAManBase") AND {(owner _unit != owner _source)})}) then {
                diag_log format ["P1ayer %1 hit by %2 %3 from %4 meters",
                    _unit call fa_plr2Str,  _source call fa_plr2Str, _x select 2, _x select 3];
                if (_unit getVariable["processedDeath", 0] == 0) then {
                    _weapon = (currentWeapon _source);
                    _weapon_dmg = gettext (configFile >> 'cfgWeapons' >> _weapon >> 'displayName');
                    _distance = round (_unit distance _source);
                    _unit setVariable ["AttackedByWeapon", _weapon_dmg, true];
                    _unit setVariable ["AttackedFromDistance", _distance, true];
                    _anonstat = _source getVariable "Anon";
                    if (isnil "_anonstat") then {
                    _anonstat = false;
                    };
                    if (!_anonstat) then {
                    _unit setVariable ["attacker", name _source ];
                    } else {
                    _unit setVariable ["attacker", "Anonymous" ];
                    };
                    _unit setVariable [ "noatlf4", diag_ticktime ]; // server-side "not in combat" test, if player is not already dead
                };
            };
        };
    };
};

At the very bottom of server_playerDied.sqf add this:
Code:
[_newObject] spawn {
    _unit = _this select 0;

    waituntil {!isnil {_unit getVariable "attacker"}};
    _attacker = _unit getVariable "attacker";
    _attackedby = _unit getVariable "AttackedByWeapon";
    _attackdistance = _unit getVariable "AttackedFromDistance";
    //_attacker = _unit getVariable "AttackedByWeaponImg";
    _unitname = name _unit;
    if (isnil "_attackedby") then {
    _message = format["%1 killed by %2 from [%3m]", _unitname, _attacker, _attackdistance];
    CustomMessage = _message;
    } else {
    _message = format["%1 killed by %2 with %3 from [%4m]", _unitname, _attacker, _attackedby, _attackdistance];
    CustomMessage = _message;
    };
    diag_log format["%1",CustomMessage];
    publicVariable "CustomMessage";
};

client side:

client sided publicEH.sqf required but can probably stick this somewhere else.

in publicEH.sqf in the "if (!isDedicated) then {" code chunk add this:
Code:
"CustomMessage" addPublicVariableEventHandler {
        _finaltxt = (_this select 1);
        _text2 = "<t align='left' size='0.5' color='#a41f00'>"+_finaltxt+"</t>";
        systemchat format["%1",_finaltxt];
        [_text2,[safezoneX + 0.01 * safezoneW,2.0],[safezoneY + 0.01 * safezoneH,0.3],30,0.5] spawn BIS_fnc_dynamicText;
    };

also I added an additional feature for players to show as anonymous. So instead of "Player1 killed by player2 with M4 from [#m]" players could turn a feature on to make it "Player1 killed by Anonymous with M4 from [#m]".

The code for that can be tied into a scroll menu easily I just have it tied into my player menu dialog so I can only supply the code for it:
Code for anonymous status toggle:
Code:
_anonstat = profileNamespace getVariable 'Anon';
if (isnil '_anonstat') then {
    player setVariable ['Anon',false,true];
};
if (player getvariable 'Anon') then {
    profileNamespace setVariable ['Anon',false];
    player setVariable ['Anon',false,true];
    systemchat 'Your name will show up in kill messages now...';
} else {
    profileNamespace setVariable ['Anon',true];
    player setVariable ['Anon',true,true];
    systemchat 'You will now be anonymous in kill messages.';
};
saveProfileNamespace;

init.sqf in the !isDedicated portion add this for anonym:
Code:
_anonstat = profileNamespace getVariable "Anon";
    if (isnil "_anonstat") then {
        player setVariable ["Anon",false,true];
        profileNamespace setVariable ["Anon",false];
        saveProfileNamespace;
    } else {
        if (_anonstat) then {
            player setVariable ["Anon",true,true];
        } else {
            player setVariable ["Anon",false,true];
        };
    };

NOTE:

only issues I've seen with the way I've done it is that sometimes if you get shot by someone and run off and die it'll count the last person to shoot you as killing you since they were the last player to hit you. Never got around to adding a fix for it.
 

HospitalChair

Well-Known Member
Doesn't appear to be working. Just logged into the server and after a couple of kills (kill messages seem to be notorious for not working 100% of the time) it's still just showing the standard "Player was killed" message.

Just for clarification when you say client side you dont actually mean that they have to tweak their own file for that, it can just be called in the mpmission folder, correct?
 

Inkko

Valued Member!
Doesn't appear to be working. Just logged into the server and after a couple of kills (kill messages seem to be notorious for not working 100% of the time) it's still just showing the standard "Player was killed" message.

Just for clarification when you say client side you dont actually mean that they have to tweak their own file for that, it can just be called in the mpmission folder, correct?

Here is a dropbox folder I made to show the structure. You can kinda see how I added it in.

https://www.dropbox.com/sh/kkhvpk288rh4e4d/AAB1gY8JwYCYdtI0vnhjVBV1a?dl=0
 
Last edited:

HospitalChair

Well-Known Member
I was. Not sure why the edits i made originally didnt work but the files you uploaded did. The only thing and it's relatively minor is that it shows the kill message in the top left in red and again in the chat feed...It's a little redundant but a minor gripe for a script i've been trying to get to work for a while. Much appreciated! Oh and i dont suppose you know how to add a picture of the gun in message. Not a big deal just some flare.

Thanks again, you've been a great help! Glad to have another go to guy on these forums.
 

Inkko

Valued Member!
I was. Not sure why the edits i made originally didnt work but the files you uploaded did. The only thing and it's relatively minor is that it shows the kill message in the top left in red and again in the chat feed...It's a little redundant but a minor gripe for a script i've been trying to get to work for a while. Much appreciated! Oh and i dont suppose you know how to add a picture of the gun in message. Not a big deal just some flare.

Thanks again, you've been a great help! Glad to have another go to guy on these forums.

I remember why I did the repetitive messages with systemchat and the top left message as well.... It was for if 2 players died at once since the top left message will get overwritten with each new kill. So it was more in the chat area to show all since the top left sometimes will skip some with multiple deaths. As for the picture part I think I had that working at one point but changed it for some reason.
 

HospitalChair

Well-Known Member
Good call on the duplicated message, i do remember that being an issue with the last script i had. Thanks again for your help. Do you mind if i PM you if i hit any other roadblocks in the future?
 

Inkko

Valued Member!
Good call on the duplicated message, i do remember that being an issue with the last script i had. Thanks again for your help. Do you mind if i PM you if i hit any other roadblocks in the future?

fine with me, may not be able to do everything but I can help with some things.
 
Top