My question is as simple as it sounds; is there a way to check if a mob (and perhaps of a custom named mob) has x amount of health left. Example: Im making a skeleton boss, and when he hits half health, I want him to summon some "skeleton warriors" to assist him in battle. Any ideas?
32 Answers
You can do something like this.
/testfor @e[x,y,z,r,type=Skeleton] {Health:10s}
If you want the name in it do this. (Correct me if I'm wrong.)
/testfor @e[x,y,z,r,type=Skeleton,name=Jimmy] {Health:10s}
Yes you can test for a mob with a specific amount of health and a custom name.
For example:
/testfor @e[x,y,z,r,type=Creeper,name=George] {Health:10s}would test for a creeper within a radius of the target coordinates named George with 10 health. This should be placed on a loop to continually test the parameters.
Also, note that the {Health:10s} tag is separate from the entity tags. That is because health can only be stored in an NBT tag for mobs. As an added note, health can only be tested for exact values, not ranges.