-1

I have this problem where when I use a command to select a player outside a cubic area, the command doesn’t work. I’ve tried many ways, including

/effect @a[x=!-32,y=!0,z=!-42,dx=!75,dy=!256,dz=!75] poison 1 0

/effect @a[x=!-32,y=!0,z=!-42,dx=75,dy=256,dz=75] poison 1 0

and

/effect @a[x=-32,y=0,z=-42,dx=!75,dy=!256,dz=!75] poison 1 0

but none of them work. Nothing on YouTube had any good answers to that, either. Is there a way to fix this problem? Thanks

1 Answer 1

1

Your best bet is to probably to tag everyone within the area, and then apply the effect to everyone without the tag. You're going to have to use basic scoreboards, since you're on Pocket Edition, so set that up:

/scoreboard objectives add Unpoisoned dummy

Next, every time you want the effect to run, use these three commands:

/scoreboard players set @a Unpoisoned 0
/scoreboard players set @a[x=-32,y=0,z=-42,dx=75,dy=256,dz=75] Unpoisoned 1
/effect @a[score_Unpoisoned=0] poison 1 0

That should poison everyone with an Unpoisoned score of 0, which should be everyone outside the box.

2
  • but then wouldn't it still poison players within the area? Because it would be an on-off cycle between the first 2 commands.
    – villager1
    Commented Mar 29, 2019 at 19:55
  • Nope, you're should be able to run those all in a single tick
    – MBraedley
    Commented Mar 30, 2019 at 1:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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