I have the command:

execute @e[type=Villager] ~ ~ ~ effect @a[r=!4] 19 5 2

It should give poison to all players that are not in the radius of 4 blocks around my villager, but it does not work.

Is there an issue with [r=!4]?

  • 2
    Instead of using @a[r=!4], that apparently does not work because you can't negate 4 (it will generate some negative number, probably around -2^31), use @a[rm=5]. rm means minimum radius, so that everyone who is 5 or more (more than 4) blocks away from your villager gets affected by the command. – GiantTree Jul 3 '15 at 12:59
  • 1
    @GiantTree, That's correct! You should post it as an answer. – Nick B. Jul 3 '15 at 13:29

Replace the @a[r=!4] with @a[rm=5]. The rm stands for minimum radius, so everyone with a minimum radius of 5 will be affected, but everyone with a radius that is less than 5 will not be affected. Your final command should then be:

execute @e[type=Villager] ~ ~ ~ effect @a[rm=5] 19 5 2

EDIT: I saw afterwards that @GiantTree also said this, sorry if it is seen as a copy, but I didn't see it there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.