I am making a boss battle, and the boss has a few different stages already implemented, I just need a detector to tell the stages when to activate. To activate the final stage, I want the mob to have less than 20 half hearts, and I try to test that with this command:

/testfor @e[type=Zombie,name=Joe,score_bossHealth_min=1,score_bossHealth_max=20]

However it does not seem to find the mob. In case I'm changing the wrong thing, this post refers to the only other variable that could be affected/affect the mob. Did I make an error in the syntax?

  • What is the type of the bossHealth objective? Jul 7 '16 at 11:59
  • It is dummy type @CommandFox
    – David
    Jul 7 '16 at 15:39
  • Then the problem is that the the type has to be health not dummy. Jul 7 '16 at 16:38

First of all, to detect health the type of the objective should be health and not dummy.

Second of all, there is an error in the syntax. You cannot use score_bossHealth_max in your selector arguments, it is invalid. To select something by a maximum score just use score_bossHealth and don't add _min or _max:

/testfor @e[type=Zombie,name=Joe,score_bossHealth_min=1,score_bossHealth=20]
  • The testfor command is not working, and Joe's health is not being displayed on the scoreboard, do I have to set it manually?
    – David
    Jul 7 '16 at 18:24
  • Note I changed bossHealth to type health
    – David
    Jul 7 '16 at 18:25
  • @DavidCole-GrammarPolice If Joe's health is not displayed on the scoreboard, it means his health is full, I think. Jul 8 '16 at 7:12
  • Even after dealing damage joes health did not appear @CommandFox
    – David
    Jul 8 '16 at 14:44

Yes, you made an error in the syntax. score_health_max in an invalid argument. Use score_health instead:

/testfor @e[type=Zombie,name=Joe,score_bossHealth_min=1,score_bossHealth=20]

That should work.
Also, you can (if you don't have another Joe) remove the type=Zombie.

  • I'm using a wither called Joe to make a custom mob bar, so type=Zombie is needed ;)
    – David
    Jul 7 '16 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.