TransWikia.com

How to execute a command block once taking hits?

Arqade Asked by user144609 on March 30, 2021

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! 😀

One Answer

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:

SUPER REDSTONE!
(Instead of "door" use "Next Command block")

Answered by RudolfJelin on March 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP