Page 1 of 2

[Mod]Death Messages[0.1.2 beta][death_messages]

PostPosted: Mon Mar 17, 2014 17:53
by Evergreen
Image

This mod sends a message in chat to everyone when a player dies. (note: there is no reliable way of detecting when a player has died from fall damage in the current api)
For instance:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Foobar melted into a ball of fire.


Depends:
Nothing

License:
GPL v3
Go here for full legal text.

Download
Download as a .zip, or a .tar.gz archive.
Check out the source code at https://github.com/4Evergreen4/death_messages

PostPosted: Mon Mar 17, 2014 19:08
by Krock
Nice mod, unil now there were only random messages.

PostPosted: Mon Mar 17, 2014 19:13
by Evergreen
Krock wrote:Nice mod, unil now there were only random messages.
Thanks! I am adding more stuff in the future, like support for other mods. Also, adding a separate message for falling isn't possible atm. It will be added when it is possible.

PostPosted: Mon Mar 17, 2014 20:11
by deivan
Nice. :D

PostPosted: Mon Mar 17, 2014 20:19
by CraigyDavi
Cool mod. I now use this mod on my server rather than my terrible death messages mod :)

Also does anyone know if this would be possible?
When someone kills someone else it would show as a message:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
player1 killed player2

PostPosted: Mon Mar 17, 2014 21:52
by Evergreen
CraigyDavi wrote:Cool mod. I now use this mod on my server rather than my terrible death messages mod :)

Also does anyone know if this would be possible?
When someone kills someone else it would show as a message:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
player1 killed player2
I might try and see if I can do that. It depends on if there is a way of detecting who killed who, and if it is reliable.

PostPosted: Mon Mar 17, 2014 22:44
by stu
Evergreen wrote:
CraigyDavi wrote:Cool mod. I now use this mod on my server rather than my terrible death messages mod :)

Also does anyone know if this would be possible?
When someone kills someone else it would show as a message:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
player1 killed player2
I might try and see if I can do that. It depends on if there is a way of detecting who killed who, and if it is reliable.


Something I have wanted for a while is a callback when a player is punched, this should provide a reference to player/entity responsible. It would be useful for other things besides this, like better armor wear-out for example.

Another more hacky solution might be to parse the server logs to determine the identity of the culprit. (if there was one)
no lava. no water and no player or entity means you must have fallen (I think)

Nice idea, btw

PostPosted: Tue Mar 18, 2014 00:27
by Evergreen
stu wrote:
Evergreen wrote:
CraigyDavi wrote:Cool mod. I now use this mod on my server rather than my terrible death messages mod :)

Also does anyone know if this would be possible?
When someone kills someone else it would show as a message:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
player1 killed player2
I might try and see if I can do that. It depends on if there is a way of detecting who killed who, and if it is reliable.


Something I have wanted for a while is a callback when a player is punched, this should provide a reference to player/entity responsible. It would be useful for other things besides this, like better armor wear-out for example.

Another more hacky solution might be to parse the server logs to determine the identity of the culprit. (if there was one)
no lava. no water and no player or entity means you must have fallen (I think)

Nice idea, btw
Thanks. While doing this mod, I have run into lots of limitations to the modding api. I was thinking of making an api for this in the future so that mods which kill players can register their own deaths. Also, I was thinking of having a text file full of quips which are randomly selected when the player dies. :P

PostPosted: Tue Mar 18, 2014 05:05
by 4aiman
Nice work :)

It would be even nicer to add random messages functionality here, so instead of the same one message there would be lots of commentaries why someone decided to swim in a lava :)

Could be easily done by picking random messages from tables with those messages.
Several tables - one per death cause should do the trick :)

PostPosted: Tue Mar 18, 2014 12:01
by Evergreen
4aiman wrote:Nice work :)

It would be even nicer to add random messages functionality here, so instead of the same one message there would be lots of commentaries why someone decided to swim in a lava :)

Could be easily done by picking random messages from tables with those messages.
Several tables - one per death cause should do the trick :)
That's what I was thinking of doing. Also, thank you. :-)

PostPosted: Tue Mar 18, 2014 12:04
by Sokomine
With regard to that other thread which asked for most common cause of death (in my case it would be suicide through falling - in order to prevent death through falling at a less convenient time :-)), multiple messages for that most common cause of death might indeed be helpful.

Intresting way how you solved the shortcommings of the api. At least that does take care of some situations. For other ones, it would really be great if the lua api could be extended. That's something still missing in the game. Especially when it comes to entities trying to kill each other. Playerkills, amount of monsters killed, amount of death by each type of monster - that'd all be very intresting for a variety of mods.

PostPosted: Tue Mar 18, 2014 12:17
by Evergreen
Sokomine wrote:With regard to that other thread which asked for most common cause of death (in my case it would be suicide through falling - in order to prevent death through falling at a less convenient time :-)), multiple messages for that most common cause of death might indeed be helpful.

Intresting way how you solved the shortcommings of the api. At least that does take care of some situations. For other ones, it would really be great if the lua api could be extended. That's something still missing in the game. Especially when it comes to entities trying to kill each other. Playerkills, amount of monsters killed, amount of death by each type of monster - that'd all be very intresting for a variety of mods.
I could make the message after "else" in the code say "broke his/her legs." However, that is assuming there is no other way of dying.

PostPosted: Tue Mar 18, 2014 16:44
by rubenwardy
I ran across this limitation when making the achievements mod.

PostPosted: Tue Mar 18, 2014 17:25
by 4aiman
1st things 1st:
pll =player:get_player_name()

Death caused by a fall is one when
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.get_node(player:getpos()).name == air

for greater than several seconds.
So we can check for distance a player has walked since last check (lagproof) and a node at the pos I mentioned above (this however isn't lag proof).

But if a player is dead (player.get_hp()==0) and he was in air for too long, I guess it's normal to send smth like "pll hits the ground too hard!" (e.g. avoid the word "fall").

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

As for monsters - we can use check for health (actually we need track it on every tick) and if a player dies we can get his pos and find the nearest mob. Distance should be checked, a mob has to be in 0..1 meters away.

Fireballs of DM, arrows and any entities thrown at the player can bear inside them the name of the one who has released them.

Also if there are several mobs in a distance (0..1) we can send smth like "pll was killed by the anonymous group of sandmen". (Well, you know... alcoholics... anonymity... groups... sand monsters should be very thirsty... ... sorry, my imagination is on it's top these days )

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

What else?
Death, caused by another player?
We can't do it yet, but what if we send_all only potential killers?

Example:
Someone killed someone.
In such circumstances the killer wouldn't be able to teleport momentarily after the kill.
So: our killer should be nearby.

If there's NO other things to die of - we can send all that "killer might have seen or heard who just killed pll". So we don't blame anyone, but make people suspicious. Later the killed one can clear possible killer's name. On PVP servers that may be treated like a joke - everyone would know what does it mean "might have seen". Yeah... ;) "I might have seen... and might not" ;)

Note:
If there's lava or fire or the killed one was falling while fighting - I assume it's "ok" to show the message that smth natural has killed him/her.

But if there's a player nearby we also can add that he/she just might have seen how did pll die.

Also, imagine that someone want to kill someone but wants to do it unnoticed. The killer may lure pll to a group of monsters and kill pll with a distance.

We have 2 options: to add possible killer's name or not.
First option will approve some skilled assassination.
The 2nd one will tell everyone who might've been responsible (arrows are entities that are nearby the player when he dies and if they contain someone's name...)

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

Do we have suffocation yet? Drowning is for water. Suffocation is for sending smth like "pll has tried to pretend he's a worm" or "pll failed to prove he can do better than regular worms".

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

'pll was blasted with TNT!' - this may be done likewise the arrows. TNT's particles of smoke should fill the entire radius of a blast. On_collision with a player we can check his HP.

----------------------------------------------------------------------------------
Regards!

PostPosted: Tue Mar 18, 2014 17:33
by Sokomine
I'd really prefer this to be solved by the lua api rather than guesswork about who might have been close enough. That might be a workaround for now, but if players are concerned, we need to know who did it - to avoid accidently blaming and banning the wrong player.

PostPosted: Tue Mar 18, 2014 20:15
by Krock
Sokomine wrote:I'd really prefer this to be solved by the lua api rather than guesswork about who might have been close enough. That might be a workaround for now, but if players are concerned, we need to know who did it - to avoid accidently blaming and banning the wrong player.

Yes, myself I ran into this problem too. Sometimes it wasn't clear who killed who, therefore should it be possible to get the name of the player who killed "dummy".

PostPosted: Tue Mar 18, 2014 21:17
by Evergreen
4aiman wrote:1st things 1st:
pll =player:get_player_name()

Death caused by a fall is one when
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.get_node(player:getpos()).name == air

for greater than several seconds.
So we can check for distance a player has walked since last check (lagproof) and a node at the pos I mentioned above (this however isn't lag proof).

But if a player is dead (player.get_hp()==0) and he was in air for too long, I guess it's normal to send smth like "pll hits the ground too hard!" (e.g. avoid the word "fall").

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

As for monsters - we can use check for health (actually we need track it on every tick) and if a player dies we can get his pos and find the nearest mob. Distance should be checked, a mob has to be in 0..1 meters away.

Fireballs of DM, arrows and any entities thrown at the player can bear inside them the name of the one who has released them.

Also if there are several mobs in a distance (0..1) we can send smth like "pll was killed by the anonymous group of sandmen". (Well, you know... alcoholics... anonymity... groups... sand monsters should be very thirsty... ... sorry, my imagination is on it's top these days )

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

What else?
Death, caused by another player?
We can't do it yet, but what if we send_all only potential killers?

Example:
Someone killed someone.
In such circumstances the killer wouldn't be able to teleport momentarily after the kill.
So: our killer should be nearby.

If there's NO other things to die of - we can send all that "killer might have seen or heard who just killed pll". So we don't blame anyone, but make people suspicious. Later the killed one can clear possible killer's name. On PVP servers that may be treated like a joke - everyone would know what does it mean "might have seen". Yeah... ;) "I might have seen... and might not" ;)

Note:
If there's lava or fire or the killed one was falling while fighting - I assume it's "ok" to show the message that smth natural has killed him/her.

But if there's a player nearby we also can add that he/she just might have seen how did pll die.

Also, imagine that someone want to kill someone but wants to do it unnoticed. The killer may lure pll to a group of monsters and kill pll with a distance.

We have 2 options: to add possible killer's name or not.
First option will approve some skilled assassination.
The 2nd one will tell everyone who might've been responsible (arrows are entities that are nearby the player when he dies and if they contain someone's name...)

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

Do we have suffocation yet? Drowning is for water. Suffocation is for sending smth like "pll has tried to pretend he's a worm" or "pll failed to prove he can do better than regular worms".

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

'pll was blasted with TNT!' - this may be done likewise the arrows. TNT's particles of smoke should fill the entire radius of a blast. On_collision with a player we can check his HP.

----------------------------------------------------------------------------------
Regards!
I prefer to do stuff within the api, it is much more stable. Those are some good ideas though.
EDIT: Sokomine answered perfectly, that would be my response.

PostPosted: Tue Mar 18, 2014 23:18
by stu
Evergreen wrote: Also, I was thinking of having a text file full of quips which are randomly selected when the player dies. :P

That reminds me of a mmorpg I once played called eternal lands, they had daft death messages like that, some were quite funny iirc.
Perhaps you could add a 'random' setting as an option.

PostPosted: Wed Mar 19, 2014 01:04
by Evergreen
New version
[spoiler=updates for 0.1.1]
[/spoiler]

Feel free to leave your quips in this topic. (I might make it a setting to have random death messages)

PostPosted: Wed Mar 19, 2014 05:19
by John1
Evergreen wrote:Feel free to leave your quips in this topic. (I might make it a setting to have random death messages)


Lava deaths:
[player] went for a closer look at lava.
[player] dug straight down too long.
[player] didn't know lava was hot.

Drowning:
[player] forgot he wasn't a fish.
[player] blew one too many bubbles.

Burning:
[player] roasted himself - hotdog style.
[player] set himself aflame. More light that way.

Falling:

[player] took a tumble.
[player]'s superman cape didn't work.
[player] thought he could fly.
[player]'s parachute didn't open.
[player] jumped off a cliff.

PostPosted: Wed Mar 19, 2014 05:54
by 4aiman
It would be great if there were API callbacks, but there aren't ATM.
So, basically, I agree that it's a workaround that isn't even 80% precise.

But c'mon... banning pll just because some stupid mod has blamed someone?
Even if there was a player who kicked another player by accident/on purpose, how can we distinguish whether his punch was the final one? After the death player is not teleported momentarily and there's a chance for a nearby mob/another player to punch the corpse by accident/on purpose. And who we are to blame now? Are we going to ban both?

Further, because of lags the victim could be punched but lua wouldn't know about this for some time. During that time anything can harm/kill/punch the corpse and change the name of a killer.

Image

Moreover: if you've a mod that heals a player over time, then even dead players can be revived after they've died on the same spot.

Situation:
- pll has died;
- death screen appeared;
- pll didn't touch the "proceed" button but waits till his HP refills;
- pll presses the "proceed" button and don't get teleported anywhere.

This all was possible due to a single bug in a mod, but that's what we are talking about here - the problem of a mod being precise.

I don't think that in a situation like this the killer should be banned.

This also maybe a feature (KO instead of death+respawn)

PostPosted: Wed Mar 19, 2014 12:09
by Evergreen
John1 wrote:
Evergreen wrote:Feel free to leave your quips in this topic. (I might make it a setting to have random death messages)


Lava deaths:
[player] went for a closer look at lava.
[player] dug straight down too long.
[player] didn't know lava was hot.

Drowning:
[player] forgot he wasn't a fish.
[player] blew one too many bubbles.

Burning:
[player] roasted himself - hotdog style.
[player] set himself aflame. More light that way.

Falling:

[player] took a tumble.
[player]'s superman cape didn't work.
[player] thought he could fly.
[player]'s parachute didn't open.
[player] jumped off a cliff.
Thanks! I paste those in a text file so I remember them.

PostPosted: Wed Mar 19, 2014 14:56
by Evergreen
New version
[spoiler=updates for 0.1.2]
[/spoiler]

PostPosted: Thu Mar 20, 2014 12:11
by Sokomine
4aiman wrote:I don't think that in a situation like this the killer should be banned.

Based on that limited amount of information, a ban does not seem justified, that's right. And even if it is certain that that particular player was the culprit, it might still be an accident. Yet if the player repeats the killing, a ban might be necessary in order to allow the rest of the players on the server to play undisturbed. We really need a better API for that.

PostPosted: Thu Mar 20, 2014 14:54
by Evergreen
Sokomine wrote:
4aiman wrote:I don't think that in a situation like this the killer should be banned.

Based on that limited amount of information, a ban does not seem justified, that's right. And even if it is certain that that particular player was the culprit, it might still be an accident. Yet if the player repeats the killing, a ban might be necessary in order to allow the rest of the players on the server to play undisturbed. We really need a better API for that.
I agree. Also, minor change in detecting drowning. Instead of looking for the node the player is in, it now uses player:get_breath.

PostPosted: Thu Mar 20, 2014 18:13
by 4aiman
get_breath is good :)
Better API is good too. (Have never said it's not, actually ;)

Re: [Mod]Death Messages[0.1.2 beta][death_messages]

PostPosted: Wed Mar 02, 2016 21:04
by SaKeL
would be nice to check if is player already dead.... now when player dies from hunger and afk, death messages will loop and spam the chat :)

Re: [Mod]Death Messages[0.1.2 beta][death_messages]

PostPosted: Sat Aug 13, 2016 19:05
by bark
I love this mod! Adds a lot of fun to dying.

Deathmessages spamming the chat when player is taking damage would be nice to see fixed, as SaKeL mentions. The spam loop also occurs when dying in lava.

Also, I wrote some more death messages (most of the original ones are included in this list) that can be implemented in the mod if you like
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all

-- Other death messages
messages.other = {
        " died.",
        " died trying.",
        " didn't survive that final blow.",
        " did not survive.",
        " failed at staying alive.",
        " had a meeting with destiny.",
        " died and resurrected.",
        " made a deadly decision.",
        " is no more.",
        " was being reckless.",
        " did something fatal.",
        " gave up on life.",
        " is somewhat dead now.",
        " flatlined.",
        " took a fatal beating.",
        " is a pile of bones.",
        " is in need of a funeral service.",
        " passed out permanently.",
        " is knocking at the gates.",
        " tried to survive, but didn't.",
        " had an appointment with fate."
}

-- Lava death messages
messages.lava = {
        " melted into a ball of fire.",
        " thought lava was cool.",
        " melted into a ball of fire.",
        " dug straight down and landed in lava.",
        " didn't know lava was hot.",
        " tried swimming in lava and failed at it.",
        " got stuck in lava and stayed there.",
        " can't swim in lava."
}

-- Drowning death messages
messages.water = {
        " drowned.",
        " ran out of air.",
        " failed at swimming lessons.",
        " tried to impersonate an anchor.",
        " forgot he wasn't a fish.",
        " blew one too many bubbles.",
        " couldn't reach the surface in time.",
        " was lost at sea."
}


Re: [Mod]Death Messages[0.1.2 beta][death_messages]

PostPosted: Sat Aug 20, 2016 08:51
by wilkgr76
[player] became a pancake (Fall)
[player] is now medium to well-roasted. (Lava/fire)
A [mob] finds [player] delicious. (Mob)
[killer] won't be bothered by [player] for some time... (PvP)
[killer] sent [player] as a tribute to Hades (PvP)
[player] popped in to visit Hades. (Anything really)
<[player]> THE FALL WAS OVER 9000!!! (i.e. looks like a chat message xD) (Fall)
[player] was walking and texting (Lava/fire/fall)
[killer]'s [weapon] wasn't very polite to [player] (PvP)
[player] breathed his last.

More coming in another post ;)

Re: [Mod]Death Messages[0.1.2 beta][death_messages]

PostPosted: Wed Oct 19, 2016 00:46
by bigfoot547
So, I whipped up some code that you can use for detecting if a player was killed by another player or a mod. I which case, it will say the mobname (e.g. "mobs:dungeon_master").
Death messages:
[player] was killed by [player].
[player] was killed by [mobname]

+ So, here's the code!

Oh! By the way, you can use this freely. You have my permission.