Is there a way to testfor a mob's health? I know you can do the health criteriaType scoreboard, but that's only for players. I need it specifically for mobs.
HealF and Health are the tags that contain the health of any entity. You are much better off only testing Health as HealF is a float and it will be very hard to catch at the exact precise health. Health is a type short so you would do like "Health:20s" to detect a player with full health.
For entities: /scoreboard objectives add Health dummy
/scoreboard players set @e[type=!Player] Health 0
/scoreboard players set @e[type=!Player] Health 20 {Health:20s}
Now if the entity has a score_Health_min=20 it has full health and if it is score_Health=0 then it has taken damage. You can add more to this to get the entities exact health:
/scoreboard players set @e[type=!Player] Health 19 {Health:19s}
/scoreboard players set @e[type=!Player] Health 18 {Health:18s}
And so on..
To do something to an entity that has taken damage you would target them with @e[type=!Player,score_Health=0].
If you want to test a player's health, use scoreboard objective type "health": /scoreboard objectives add playerHealth health
Is there a way to testfor a mob's health? I know you can do the health criteriaType scoreboard, but that's only for players. I need it specifically for mobs.
You might be able to testfor @e with the tag {Attributes:[{Name:generic.maxHealth,Base:HEALTH}]}
Lindoan.com
HealF and Health are the tags that contain the health of any entity. You are much better off only testing Health as HealF is a float and it will be very hard to catch at the exact precise health. Health is a type short so you would do like "Health:20s" to detect a player with full health.
I too was curious as to how to do this, how would you implement the "Health:20s"? Would it be: /testfor @e[Health:20s] ?
Yes can someone just give a comand? And also... I wonder if you can get an output when a spesific mob lose health?
For entities: /scoreboard objectives add Health dummy
/scoreboard players set @e[type=!Player] Health 0
/scoreboard players set @e[type=!Player] Health 20 {Health:20s}
Now if the entity has a score_Health_min=20 it has full health and if it is score_Health=0 then it has taken damage. You can add more to this to get the entities exact health:
/scoreboard players set @e[type=!Player] Health 19 {Health:19s}
/scoreboard players set @e[type=!Player] Health 18 {Health:18s}
And so on..
To do something to an entity that has taken damage you would target them with @e[type=!Player,score_Health=0].
If you want to test a player's health, use scoreboard objective type "health": /scoreboard objectives add playerHealth health
Thx!
no /testfor @e {Health:20s}
go to my youtube where I do advanced command tutorials and show off my maps and one commands
go to my website where all my one commands and maps can be found
and check out my demonic magic vanilla mod
No you are wrong. It does nothing.
EDIT:You need to change "20s"
to "20.0f" for 1.9+