Assistance needed Converting kill messages to 1.8.6.1

HospitalChair

Well-Known Member
The original thread is located here.

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

It was labeled 1.8.2 so I thought I would make a new post to keep things clear. So i loaded this script up and test it out for 18.6.1 and I am getting this error in my rpt and obviously no kill message.

10:26:37 Error in expression <ct 3;
_playerName = name _newObject;


_victim removeAllEventHandlers "MPHit";
>
10:26:37 Error position: <_victim removeAllEventHandlers "MPHit";
>
10:26:37 Error Undefined variable in expression: _victim
10:26:37 File z\addons\dayz_server\compile\server_playerDied.sqf, line 13


I'm including my playerdied.sqf

Server_PlayerDied.sqf
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"

private ["_characterID","_minutes","_newObject","_playerID","_key", "_pos"];
//[unit, weapon, muzzle, mode, ammo, magazine, projectile]

_characterID = _this select 0;
_minutes = _this select 1;
_newObject = _this select 2;
_playerID = _this select 3;
_playerName = name _newObject;

//---------------------------------------- DEATH MESSAGES --------------------------------------------

_victim removeAllEventHandlers "MPHit"; <-----The error in question

_victim = _this select 2;
_victimName = _playerName;

_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"];


_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;
death_message = format["%1 killed %2\nWeapon: %3\nDistance: %4",_killername,_victim,_weapon,_distance];
// show death_message locally
5 cutRsc ["dm_disp","PLAIN"];
((uiNamespace getVariable "dm_control") displayCtrl 1) ctrlSetText death_message;
//show deathmessage globally
publicVariable "death_message";

_victim setVariable["Killedby", _killername, true];
_victim setVariable["Killedwith", _weapon, true];
_victim setVariable["KilledDistance", _distance, true];

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

};
// -----------------------------------------------------------------------------------------------------------

//diag_log format["CID: %1, PID: %2",_characterID,_playerID];

//Mark player as dead so we bypass the ghost system
dayz_died set [count dayz_died, _playerID];

_newObject setVariable["processedDeath",diag_tickTime];
_newObject setVariable ["bodyName", _playerName, true];
_pos = getPosATL _newObject;
if (_pos select 2 < 0.1) then { _pos set [2,0]; }; // force to follow the terrain slope in sched_corpses.sqf
_newObject setVariable [ "deathPos", _pos];

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;
};

#ifdef PLAYER_DEBUG
diag_log format ["Player UID#%3 CID#%4 %1 as %5 died at %2",
_newObject call fa_plr2str, (getPosATL _newObject) call fa_coor2str,
getPlayerUID _newObject,_characterID,
typeOf _newObject
];
#endif
_newObject setDamage 1;
_newObject setOwner 0;
//dead_bodyCleanup set [count dead_bodyCleanup,_newObject];



I'm not sure if something has changed with the 1.8.6.1 patch so I'm deferring this to some guys a bit more savvy than myself.
 
Tried to install it on my local 1.8.6.1 Server, the only error i got so far is that BE is kicking me everytime im connecting:

03.08.2015 23:32:29: Horvath Alteisen (XXX.XXX.XXX.XX:XXXX) 46e70430ba8eeeb6f2c021bbc2d6d78f - #0 "Hit" 3:10 Survivor2_DZ - "_this spawn fnc_plyrHit;"

Tried to set this: 2 _this spawn fnc_plyrHit; in mpeventhandler.txt with no success so far.

If anybody got some suggestions go ahead...

[EDIT]

Okay after a few tweaks here and there, I can proudly announce: IT WORKS!!!
 
Last edited:
Tried to install it on my local 1.8.6.1 Server, the only error i got so far is that BE is kicking me everytime im connecting:

03.08.2015 23:32:29: Horvath Alteisen (XXX.XXX.XXX.XX:XXXX) 46e70430ba8eeeb6f2c021bbc2d6d78f - #0 "Hit" 3:10 Survivor2_DZ - "_this spawn fnc_plyrHit;"

Tried to set this: 2 _this spawn fnc_plyrHit; in mpeventhandler.txt with no success so far.

If anybody got some suggestions go ahead...

[EDIT]

Okay after a few tweaks here and there, I can proudly announce: IT WORKS!!!
mind sharing how yo udid it to helps others
 
There is really not much to change, I inserted everything like in the tutorial, the only difference I made was:

U need to insert this (Taken from: dm_display_rsctitle.hpp):
PHP:
    class dm_disp {
        idd = -1;
        onLoad = "uiNamespace setVariable ['dm_control', _this select 0]";
        fadein = 0;
        fadeout = .5;
        duration = 10;
        controlsBackground[] = {};
        objects[] = {};
        class controls {
            class dm_txt {
                idc = 1;
                x = 0.00683707 * safezoneW + safezoneX;
                y = 0.0104715 * safezoneH + safezoneY;
                w = 0.25 * safezoneW;
                h = 0.106246 * safezoneH;
                shadow = 2;
                class Attributes
                {
                    font = "zeppelin32";
                    color = "#ffffff";
                    align = "left"; // put "center" here if you want some background
                    valign = "middle";
                    shadow = 2;
                };
                colorBackground[] = { 1, 0.3, 0, 0 };  // uncomment and increase 4th number to have a background
                font = "zeppelin32";
                size = 0.025*safeZoneH;
                type = 13;
                style = 0;
                text="";
            };
        };
    };

Into your description.hpp, into the following class: RscTitles .
So it looks something like this:
(WARNING DO NOT COPY THIS CLASS, I MADE SOME CHANGES TO IT, U HAVE BEEN WARNED!!!):

PHP:
class RscTitles {
    class wm_disp {
        idd = -1;
        onLoad = "uiNamespace setVariable ['wm_disp', _this select 0]";
        fadein = 0;
        fadeout = 0;
        duration = 10e10;
        controlsBackground[] = {};
        objects[] = {};
        class controls {
            class wm_text2 {
                idc = 1;
                x = safeZoneX+0.027;//safeZoneW*0.01;
                y = safeZoneY+safeZoneH-0.16;
                w = 0.151*safeZoneH;
                h = 0.057*safeZoneH;
                shadow = 2;
                class Attributes
                {
                    font = "EtelkaNarrowMediumPro";
                    color = "#24a81e13";
                    align = "left"; // put "center" here if you want some background
                    valign = "middle";
                    shadow = 2;
                };
                colorBackground[] = { 1, 0.3, 0, 0 };  // uncomment and increase 4th number to have a background
                font = "EtelkaNarrowMediumPro";
                size = 0.06*safeZoneH;
                type = 13;
                style = 0;
                text="";
            };
        };
    };
    class dm_disp {
        idd = -1;
        onLoad = "uiNamespace setVariable ['dm_control', _this select 0]";
        fadein = 0;
        fadeout = .5;
        duration = 10;
        controlsBackground[] = {};
        objects[] = {};
        class controls {
            class dm_txt {
                idc = 1;
                x = 0.00683707 * safezoneW + safezoneX;
                y = 0.0104715 * safezoneH + safezoneY;
                w = 0.25 * safezoneW;
                h = 0.106246 * safezoneH;
                shadow = 2;
                class Attributes
                {
                    font = "zeppelin32";
                    color = "#ffffff";
                    align = "left"; // put "center" here if you want some background
                    valign = "middle";
                    shadow = 2;
                };
                colorBackground[] = { 1, 0.3, 0, 0 };  // uncomment and increase 4th number to have a background
                font = "zeppelin32";
                size = 0.025*safeZoneH;
                type = 13;
                style = 0;
                text="";
            };
        };
    };
};

To finally connect to your own Server u need to edit some BE configs, or you will get kicked everytime you connect.

Open the mpeventhandler.txt

Before:
PHP:
5  !="this enableSimulation false;this allowDammage false;this disableAI 'FSM';this disableAI 'ANIM';this disableAI 'MOVE';" !="this enableSimulation false;this allowDammage false;this disableAI'FSM';this disableAI'ANIM';this disableAI'MOVE';" !="this setVectorUp .0,0,1.;"

After:
PHP:
5  !="this enableSimulation false;this allowDammage false;this disableAI 'FSM';this disableAI 'ANIM';this disableAI 'MOVE';" !="this enableSimulation false;this allowDammage false;this disableAI'FSM';this disableAI'ANIM';this disableAI'MOVE';" !="this setVectorUp .0,0,1.;" !="_this spawn fnc_plyrHit;"

Next, open the remoteexec.txt

Before:
PHP:
5  !="this enableSimulation false;this allowDammage false;this disableAI 'FSM';this disableAI 'ANIM';this disableAI 'MOVE';" !="this enableSimulation false;this allowDammage false;this disableAI'FSM';this disableAI'ANIM';this disableAI'MOVE';" !="this setVectorUp .0,0,1.;"

After:
PHP:
5  !="this enableSimulation false;this allowDammage false;this disableAI 'FSM';this disableAI 'ANIM';this disableAI 'MOVE';" !="this enableSimulation false;this allowDammage false;this disableAI'FSM';this disableAI'ANIM';this disableAI'MOVE';" !="this setVectorUp .0,0,1.;" !="_this spawn fnc_plyrHit;"


If you made all changes that are listed above, the script should work perfectly fine.
 
Back
Top