So, I am doing a little Minecraft adventure map and the number one thing I keep getting stuck on is how to execute a command block once a zombie hits you three times. Thanks! :D
It's possible, but not 100% reliable. You want to repeatedly testfor a Zombie in less then 1 block from a Player (hitting distance) 3x:
/execute @e[type=Zombie] ~ ~ ~ testfor @a[r=1]
Or the other way around: /execute @a ~ ~ ~ testfor @e[type=Zombie, r=1]
1) Put one of these commands into a Command block with a Comparator facing out of it.
2) Then, use a Redstone impulse lengthener as shown below to lengthen the signal to like 10 seconds.
3) Add a Piston that allows a clock to repeatedly trigger a Command block.
4) This Command blog should have the same command as above.
5) Repeat this one time more and you got it done.
6) Add a fourth CMD block at the end with you own command.
Redstone signal lengthener: