3

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.

2 Answers 2

1

You 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.

3
  • @user166681 @RudolfL.Jelínek This does not work. You cannot use the @e selector to target dead entities, which happens when their Health is 0.
    – Skylinerw
    Sep 18, 2016 at 16:07
  • Or have an objective that counts deaths, and when it is 1 trigger the command?
    – user166681
    Sep 18, 2016 at 16:09
  • Auto-incrementing objectives do not work for non-player entities.
    – Skylinerw
    Sep 18, 2016 at 16:09
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .