How to detect if a mob has been hit in minecraft with command blocks? 1.8

Ok so is there any way of detecting if mob takes damage. I found this thread but it was for 1.9 How to detect if a mob has been hit in minecraft with command blocks?


Solution 1:

The "tagging" feature for /scoreboard used in the other answer was introduced in 1.9, but the process is still the same. You will instead need to use a score:

/scoreboard objectives add Hit dummy

And then on a clock, ensuring correct activation order, you would cycle the score between 1 and 0 depending on the value of the HurtTime tag:

/scoreboard players set @e[type=Creeper] Hit 1 {HurtTime:10s}
/scoreboard players set @e[type=Creeper] Hit 0 {HurtTime:9s}
/execute @e[type=Creeper,score_Hit_min=1] ~ ~ ~ /say I am a creeper that was hit.