#Custom death message

8 messages · Page 1 of 1 (latest)

jovial sinew
#

Can I somehow add custom death messages in chat but also on the death screen? I am making a custom hp system and I want to make a death message like {player} ran out of hp

unkempt dawnBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

limber portalBOT
#

[Quote ➤](#1157915798183096420 message) ```js
const $EntityDamageSource = Java.loadClass(net.minecraft.world.damagesource.EntityDamageSource)

ItemEvents.rightClicked(event => {
let damageSource = new $EntityDamageSource("kubejs_test_damage_source",event.player) // (damage source name, damage source entity)
event.player.attack(damageSource, 10)
})


Lang file for death message `assets/kubejs/lang/en_us.json`
```json
{
    "death.attack.kubejs_test_damage_source": "%1$s died from death and it possibly hurt"
}

Use %1$s for the player that died and %2$s for the attacker

jovial sinew
#

I found this but I would do a /kill when the player runs out of hp, so this wouldn't work?

lucid cloud
#

thats all what /kill does, it damages you 2.147b with the damage source "outofworld"

#
event.player.attack(damageSource, 2147483647)```
jovial sinew
#

Ah ok thanks a lot, I'll do that