4

Im trying to make a wave spawn kind of thing and i would like a command block to activate its comparator redstone signal when the command blocks command is negative.

I tried this using /testfor @e[type=!Zombie] but that does not work as it detects the player or any other mob. any way to do this without a redstone torch ?

1 Answer 1

8

One way to do this is to have a second command block testing if the previous one failed:

Chain command block leading off of an impulse command block

The impulse command block would have your current command (/testfor @e[type=Zombie]).

The chain command block, which is the one you should run comparators/conditionals off of, would then have:

/testforblock X Y Z command_block -1 {SuccessCount:0}

X Y Z should be the coordinates of the impulse command block.

This makes the chain block succeed when the impulse block fails.

3
  • On some of the Command blocks i get the error " ~ ~ ~ did not have the required NBT key if you know how to fix this. I cant find a tutorial for a fix on this on a command block. only chests and hoppers.
    – Reflexive
    Commented Nov 25, 2016 at 15:19
  • @CaolanMC That error means that the testforblock failed, ie: the command block the testforblock is targeting succeeded. The error does not indicate that anything is wrong with the system. Your coordinates should be pointing to the impulse block though, not to the chain block (~ ~ ~) that's running the testforblock.
    – SirBenet
    Commented Nov 25, 2016 at 18:31
  • im sure the coordinates are right. I dont see how i could have messed up hard enough to make a chain block try and detect itself.
    – Reflexive
    Commented Nov 25, 2016 at 19:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .