Can I make a death chat say a different name then the person who killed them?
Solution 1:
First, you will need to turn off death messages: /gamerule showDeathMessages false
Then you will use command blocks to make your own death messages. The easiest way I can think of to do it, is to first make a kill player score and a death score: /scoreboard objectives add killPlayer playerKillCount
and /scoreboard objectives add deaths deathCount
.
Then you will need four command blocks:
- Repeating Command Block:
/execute @a[score_deaths_min=1] ~ ~ ~ /execute @p[score_killPlayer_min=1,tag=!mafia] ~ ~ ~ /tellraw @a ["",{"selector":"@a[score_deaths_min=1]"},{"text":" was slain by "},{"selector":"@p"}]
- Chain Command Block:
/execute @a[score_deaths_min=1] ~ ~ ~ /execute @p[score_killPlayer_min=1,tag=mafia] ~ ~ ~ /tellraw @a ["",{"selector":"@a[score_deaths_min=1]"},{"text":" was slain by the Mafia"}]
- Chain Command Block:
/scoreboard players reset @a killPlayer
- Chain Command Block:
/scoreboard players reset @a deaths
By the way, the @a[c=1]
is necessary because @p does not select dead players. The first command will do death messages for non-mafia players, the second for mafia players, then the last two reset the scores so the message only displays once. Make sure to change tag=mafia
and tag=!mafia
to whatever you are using to identify the mafia players.
Hope this helps! :D