HyperScript
Docs

← All scripts

DeathMessages.hs

Instead of "Steve fell from a high place" everybody sees one of a handful of lines for that kind of death, picked at random each time: falling, burning, drowning, blowing up, the void, lightning, being squashed, cactus, potions, freezing, mobs, and being killed by another player.

by HyperScript TeamHyperScript 1.7.3+1 command1 event handler241 linesdeathmessageschatfunnyserver template
In the script list

Put the file in plugins/HyperScript/scripts and it is live. Or type /hyperscript install deathmessages on your server.

# ==============================================================
#  DeathMessages.hs - death messages that do not take it seriously
# ==============================================================
#
# Requires: 1.7.3
# Author: HyperScript Team
# Tags: death, messages, chat, funny, server template
#
# Instead of "Steve fell from a high place" everybody sees one
# of a handful of lines for that kind of death, picked at random
# each time: falling, burning, drowning, blowing up, the void,
# lightning, being squashed, cactus, potions, freezing, mobs,
# and being killed by another player.
#
# /deaths    how often you have died
#
# Notes
#  - The lines are in the functions below, one function for each
#    kind of death. Add your own, take some out, or leave one:
#    with one line it is always that line. %player.name% is
#    whoever died, and %{_killer}% in slain() is who did it.
#  - A death that fits none of the kinds gets a line from
#    other().
#  - "sign" is what stands in front of every line.
#  - Put false after "show_deaths" to say nothing at all when
#    somebody dies.
#  - With "tell_place" the player who died is told where it
#    happened, and nobody else is.
#  - With "count_deaths" deaths are counted, in
#    {%player%.deaths}, and whoever died is told which one that
#    was. Every "milestone" deaths, everybody is.
#  - Changing death messages needs a Paper server.

options:
    name: "MY SERVER"
    # What stands in front of every death message.
    sign: "&8[&cRIP&8] "
    show_deaths: true
    # Tell whoever died where it happened. Only they see it.
    tell_place: true
    # Count deaths, tell whoever died which one it was, and let them ask with /deaths.
    count_deaths: true
    # Everybody is told when somebody's deaths get to a multiple of this. 0 never tells.
    milestone: 50

# Killed by another player.
local function slain({_killer}):
    return ["&f%player.name% &7got absolutely folded by &c%{_killer}%&7.", \
            "&c%{_killer}% &7sent &f%player.name% &7back to the lobby of life.", \
            "&f%player.name% &7brought fists to a &c%{_killer}% &7fight.", \
            "&c%{_killer}% &7deleted &f%player.name%&7. No refunds.", \
            "&f%player.name% &7was turned into loot by &c%{_killer}%&7.", \
            "&7Somebody check on &f%player.name%&7. &c%{_killer}% &7did not hold back.", \
            "&f%player.name% &7lost a staring contest with &c%{_killer}%&7's sword.", \
            "&c%{_killer}% &7pressed the off switch on &f%player.name%&7.", \
            "&f%player.name% &7was an easy win for &c%{_killer}%&7.", \
            "&c%{_killer}% &7taught &f%player.name% &7a lesson. The lesson was pain.", \
            "&f%player.name% &7picked a fight with &c%{_killer}% &7and regretted it at once.", \
            "&7Thank you for your items, &f%player.name%&7. Signed, &c%{_killer}%&7."]

# Fell too far.
local function fell():
    return ["&f%player.name% &7forgot that gravity is always on.", \
            "&f%player.name% &7believed they could fly. They could not.", \
            "&f%player.name% &7found the ground. Quickly.", \
            "&f%player.name% &7skipped the stairs.", \
            "&7The floor says hi, &f%player.name%&7.", \
            "&f%player.name% &7tried the water bucket trick without the bucket.", \
            "&f%player.name% &7took the fast way down.", \
            "&f%player.name% &7misjudged that jump by a lot.", \
            "&7Ten out of ten for the dive, &f%player.name%&7. Zero for the landing.", \
            "&f%player.name% &7left their legs at the bottom."]

# Lava and fire.
local function burned():
    return ["&f%player.name% &7is now extra crispy.", \
            "&f%player.name% &7thought the lava was orange juice.", \
            "&f%player.name% &7went for a swim in the wrong liquid.", \
            "&7Medium rare: &f%player.name%&7.", \
            "&f%player.name% &7found out that fire is hot.", \
            "&f%player.name% &7became a campfire story.", \
            "&f%player.name% &7is toast. Actual toast.", \
            "&f%player.name% &7stood a little too close to the grill.", \
            "&7Somebody bring a bucket for &f%player.name%&7. Too late.", \
            "&f%player.name% &7tested whether the floor was lava. It was."]

# Ran out of air.
local function drowned():
    return ["&f%player.name% &7forgot how to breathe.", \
            "&f%player.name% &7tried to become a fish.", \
            "&f%player.name% &7stayed down there to look at one more thing.", \
            "&7Blub. &f%player.name% &7is with the squid now.", \
            "&f%player.name% &7held their breath for almost long enough.", \
            "&f%player.name% &7found out that the bubbles mean something.", \
            "&f%player.name% &7went looking for Atlantis. It is not there."]

# Creepers, TNT and everything else that goes boom.
local function exploded():
    return ["&f%player.name% &7went out with a bang.", \
            "&f%player.name% &7hugged a creeper. It hugged back.", \
            "&f%player.name% &7is now in several places at once.", \
            "&7Tssss... &f%player.name% &7did not hear it coming.", \
            "&f%player.name% &7stood next to the TNT to see what it does.", \
            "&f%player.name% &7was redecorated across the landscape.", \
            "&7Boom. &f%player.name% &7is confetti now."]

# Fell out of the world.
local function into_void():
    return ["&f%player.name% &7fell out of the world. Impressive.", \
            "&f%player.name% &7went looking for the bottom. There is none.", \
            "&7The void now owns everything &f%player.name% &7was carrying.", \
            "&f%player.name% &7is still falling, somewhere.", \
            "&f%player.name% &7stepped off the edge of the map."]

# Struck by lightning.
local function struck():
    return ["&f%player.name% &7was picked out by the sky itself.", \
            "&f%player.name% &7held the trident up in a storm.", \
            "&7One in a million, &f%player.name%&7. Unlucky.", \
            "&f%player.name% &7is fully charged."]

# Stuck in a block, under an anvil or sand, or in a crowd that was too big.
local function squashed():
    return ["&f%player.name% &7is now two blocks wide and none high.", \
            "&f%player.name% &7became part of the wall.", \
            "&f%player.name% &7did not look up.", \
            "&7It got a bit tight for &f%player.name%&7.", \
            "&f%player.name% &7was flattened. Paper thin."]

# Cactus, berry bushes and thorns.
local function pricked():
    return ["&f%player.name% &7hugged a cactus.", \
            "&f%player.name% &7lost to a plant.", \
            "&f%player.name% &7found out what the spikes are for.", \
            "&7Ouch. &f%player.name% &7got the point."]

# Potions, poison, the wither effect and dragon's breath.
local function by_magic():
    return ["&f%player.name% &7drank the wrong bottle.", \
            "&f%player.name% &7was magicked out of existence.", \
            "&f%player.name% &7withered away.", \
            "&7That potion was not for drinking, &f%player.name%&7.", \
            "&f%player.name% &7angered somebody with a wand."]

# Powder snow.
local function froze():
    return ["&f%player.name% &7is an ice cube now.", \
            "&f%player.name% &7chilled a little too hard.", \
            "&f%player.name% &7forgot their leather boots."]

# Killed by a mob, an arrow or anything else alive that is not a player.
local function by_mob():
    return ["&f%player.name% &7lost a fight with the local wildlife.", \
            "&f%player.name% &7was not the main character after all.", \
            "&7The mobs send their regards, &f%player.name%&7.", \
            "&f%player.name% &7got bullied by something with no brain.", \
            "&f%player.name% &7should have slept last night.", \
            "&f%player.name% &7forgot to light up the place.", \
            "&f%player.name% &7was outplayed by a monster.", \
            "&7Something in the dark says thanks for the items, &f%player.name%&7.", \
            "&f%player.name% &7ran, but not fast enough."]

# Nothing to eat.
local function starved():
    return ["&f%player.name% &7forgot that food exists.", \
            "&f%player.name% &7was too busy to eat. For a week.", \
            "&f%player.name% &7had a whole inventory and no bread in it.", \
            "&7The stomach of &f%player.name% &7has filed a complaint."]

# Everything else.
local function other():
    return ["&f%player.name% &7died. Nobody is quite sure how.", \
            "&f%player.name% &7has left this mortal block.", \
            "&7Press F for &f%player.name%&7.", \
            "&f%player.name% &7respawned with fewer items and more regret.", \
            "&f%player.name% &7speedran dying.", \
            "&7Skill issue, &f%player.name%&7.", \
            "&f%player.name% &7ran out of hearts.", \
            "&f%player.name% &7is taking a short break from being alive.", \
            "&7And that was the end of &f%player.name%&7. For now."]

on player death:
    if {@count_deaths} is true:
        add 1 to {%player%.deaths}
    if {@show_deaths} is false:
        hide death message
        stop
    set {_cause} to event.cause
    set {_lines} to other()
    if killer is set:
        set {_killer} to event.killer
        set {_lines} to slain({_killer})
    else if {_cause} is "FALL" or {_cause} is "FLY_INTO_WALL":
        set {_lines} to fell()
    else if {_cause} is "LAVA" or {_cause} is "FIRE" or {_cause} is "FIRE_TICK" or {_cause} is "HOT_FLOOR":
        set {_lines} to burned()
    else if {_cause} is "DROWNING":
        set {_lines} to drowned()
    else if {_cause} is "ENTITY_EXPLOSION" or {_cause} is "BLOCK_EXPLOSION":
        set {_lines} to exploded()
    else if {_cause} is "VOID":
        set {_lines} to into_void()
    else if {_cause} is "LIGHTNING":
        set {_lines} to struck()
    else if {_cause} is "SUFFOCATION" or {_cause} is "FALLING_BLOCK" or {_cause} is "CRAMMING":
        set {_lines} to squashed()
    else if {_cause} is "CONTACT" or {_cause} is "THORNS":
        set {_lines} to pricked()
    else if {_cause} is "MAGIC" or {_cause} is "POISON" or {_cause} is "WITHER" or {_cause} is "DRAGON_BREATH":
        set {_lines} to by_magic()
    else if {_cause} is "FREEZE":
        set {_lines} to froze()
    else if {_cause} is "ENTITY_ATTACK" or {_cause} is "ENTITY_SWEEP_ATTACK" or {_cause} is "PROJECTILE" or {_cause} is "SONIC_BOOM":
        set {_lines} to by_mob()
    else if {_cause} is "STARVATION":
        set {_lines} to starved()
    set {_line} to random item of {_lines}
    set death message to "{@sign}%{_line}%"
    if {@tell_place} is true:
        set {_x} to round(x of event's location)
        set {_y} to round(y of event's location)
        set {_z} to round(z of event's location)
        send "&7You died at &f%{_x}%, %{_y}%, %{_z}%&7 on &f{@name}&7."
    if {@count_deaths} is true:
        set {_deaths} to {%player%.deaths}
        send "&7That was death number &f%{_deaths}%&7."
        if {@milestone} > 0:
            # A whole number of milestones: 50, 100, 150 and so on.
            set {_times} to {_deaths} / {@milestone}
            if {_times} is round({_times}):
                broadcast "{@sign}&f%player.name% &7has now died &c%{_deaths}% &7times. A round of applause."

command /deaths:
    description: How often you have died
    trigger:
        set {_deaths} to {%player%.deaths}
        if {_deaths} is not set:
            send "&7You have not died yet. &8(Or nobody was counting.)"
            stop
        send "&7You have died &f%{_deaths}% &7times on &f{@name}&7."