I am creating a custom map in which I have a command block but I don't know how to make it display a message when a Zombie dies.
If anyone knows how to do that, it'd be great if you told me.
Arqade is a question and answer site for passionate videogamers on all platforms. It only takes a minute to sign up.
Sign up to join this communityYou might want to do
/scoreboard objectives add Death dummy
Then run a repeat command block with this command:
/scoreboard players set @e[type=Zombie] Death 1 {Health:0.0f}
And another repeat command block with
/testfor @e[type=Zombie,score_Death=1]
pointing into a conditional chain always active command block with
/tellraw @a ["",{"text":"A Zombie Has died!","color":"white"}]
or whatever you want the death message to be.
@e
selector to target dead entities, which happens when their Health
is 0.
Sep 18, 2016 at 16:07
I believe that it's impossible to do using just the vanilla Minecraft and a command block. However, you can count the number of zombies killed by each players by using the Scoreboard. It is a very complicated and complex tool to use and might be what you needed in the end.
For example, scoreboard objectives add killZombie stat.killEntity.Zombie Zombies Killed
then scoreboard objectives setdisplay sidebar killZombie
will show to everyone, to the right of their screen, the number of zombies killed by every players. Then, in a command block, you can use /testfor @p[score_killZombie_min=10]
to see if a player killed at least 10 zombies.