Kill messages 1.8.2?

there is ALWAYS an error. its probably in the description.ext if it prevents loading
pay attention to the two files and look at your description.ext to see if it has a class rsctitles already defined. IF so then #include "dm_display_rsctitle.hpp" INSIDE the existing rsctitle class. If you do NOT have a rsctitles class defined then add #include "dm_display.hpp" at the top (or bottom) of your description.ext file.
 
You want to make your death message box look unique?
Killzone kid has a little page that will allow you to put in the familiar hex value and it will give you the rgba code to use in the dm_display
http://killzonekid.com/hex-2-arma-gui-colour-converter/

n86oK9g.png
 
Ok, it doesn't work. It registers the pHit, but everytime it goes through the death message, it sees the killer as nill
 
You didn't add the eventhandler in player setup to make this work

//Add MPHit event handler
diag_log("Adding MPHit EH for " + str(_playerObj));
_playerObj addMPEventHandler ["MPHit", {_this spawn fnc_plyrHit;}];
 
You mean the part that says !server? how is that ever going to run on server?? Unless i'm misreading it.

What I added made it work great now
 
you are correct .. I was trying to consolidate the code and it looked like we could just call that from the init.sqf file but the player is client only and the fnc_playerhit.sqf is server only which is why it has to be in setup using playerobj.
I will edit the instructions as follows.

init.sqf should read
Code:
if (!isServer) then {
    "death_message" addPublicVariableEventHandler {
        5 cutRsc ["dm_disp","PLAIN"];
        ((uiNamespace getVariable "dm_control") displayCtrl 1) ctrlSetText death_message;
        };
};

and add into dayz_server/compiles/player_setup.sqf
Code:
_playerObj addMPEventHandler ["MPHit", {_this spawn fnc_plyrHit;}];
 
just read what i typed, I think i came off as rude. Sorry.

Thank you for the great work.

Question. Is there a way to make the message linger longer? It goes by pretty fast.

I also added a else statement to show player died even if no killer. Thought it was a nice effect.

I've never done this, but have you ever played with nearby towns? Any way to make it say near Balata or such?
 
Yes, yes and yes.
The time is set by these two variables in the dm_display.hpp (or dm_display_rsctitle.hpp)
fadeout = .5;
duration = 10;
The town would need another variable to be passed (i had this at the top of my debug monitor telling players what is the closest town)
_closestTown = (nearestLocations [getpos player,["NameCity","NameVillage"],5000]) select 0;
_town_name = text _closestTown;

edit deathmessage.sqf to this
Code:
fnc_deathmessage = {
    private ["_killer", "_victim", "_weapon","_distance"];
    _killer = _this select 0;
    _victim = _this select 1;
    _weapon = _this select 2;
    _distance = _this select 3;
    _closesttown = _this select 4;
   
    _handle = CreateDialog "DEATHMESSAGE_DIALOG";

   
    };
player addMPEventHandler ["MPKilled",{_this spawn MyTag_Function;}];
"deathmessage" addPublicVariableEventHandler {(_this select 1) call fnc_deathmessage;};

and change the player_died.sqf to this
Code:
//---------------------------------------- DEATH MESSAGES --------------------------------------------
_victim removeAllEventHandlers "MPHit";

_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"];
    _closestTown = (nearestLocations [getpos player,["NameCity","NameVillage"],5000]) select 0;
    _town_name = text _closestTown;

    _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\nNear: %5",_killername,_victim,_weapon,_distance,_closesttown];
    // 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];
   
};
// -----------------------------------------------------------------------------------------------------------
 
Last edited:
**** For some reason your above message only partly showed so the code wasn't there. I did this before seeing what you typed ****

I changed to 2 and 30 to test.

Changed the text creation to something like


_weapon = _victim getVariable["AttackedByWeapon", "nil"];
_distance = _victim getVariable["AttackedFromDistance", "nil"];

_closestTown = (nearestLocations [getPos _victim,["NameCity","NameVillage"],5000]) select 0;
_town_name = text _closestTown;

_loc_message = format["PKILL: %1 was killed by %2 with weapon %3 from %4m near %5", _victimName, _killerName, _weapon, _distance, _town_name];
diag_log _loc_message;
death_message = format["%1 killed %2\nWeapon: %3\nDistance: %4\nNear %5",_killername,_victimName,_weapon,_distance,_town_name];


That work?
 
By the way what does the show death message locally thing do? Is that if you are running a server on a monitor you can watch?
 
I was looking at the code and thought it needed some changes, but then dephi said that it doesn't, it works as-is. But here is what it might need ...
In review, you will see the message when you die, but others won't see it.
The deathmessage.sqf file needs to be updated to
Code:
fnc_deathmessage = {
    private ["_killer", "_victim", "_weapon","_distance"];
    _handle = CreateDialog "DEATHMESSAGE_DIALOG";
    ((uiNamespace getVariable "dm_control") displayCtrl 1) ctrlSetText death_message;
    };
player addMPEventHandler ["MPKilled",{_this spawn MyTag_Function;}];
"deathmessage" addPublicVariableEventHandler {(_this select 1) call fnc_deathmessage;};
 
Last edited:
By the way what does the show death message locally thing do? Is that if you are running a server on a monitor you can watch?

the publicvariableeventhandler does not execute on the computer that makes that call. So for the player who died to see who killed him, we need special code to run that. But my previous post you see I forgot to add that into the deathmessage.sqf code that sets the death message itself.
((uiNamespace getVariable "dm_control") displayCtrl 1) ctrlSetText death_message;

I think ..., its 2:30am and I have been fooling with arma all day, I am getting foggy.
 
To be honest, i think you need to delete the previous 2 posts. I believe they are wrong.

You don't need that. It works.

All your code to send the public variable is on the server, it marks the publicvariable that then goes to all the clients. Each client has its stuff, and BAM.

If you were doing this client side to detect the kill, the previous 2 posts would make sense.

I confirm it works PERFECTLY without the previous 2 posts.
 
Back
Top