1

Help: /testfor radius

EdFi 6/9/15 1:59 pm
439
6/11/2015 8:43 pm
I'm making a map on which I have to add a command block as player detector. I want the command block to be turned on when a player stands within an area of 4x4 blocks. I've tried to find posts and videos about this, but nothing has been any help.
Posted by
EdFi
Level 6 : Apprentice Explorer
4

  Have something to say?

JoinSign in

6

Jmal116
06/11/2015 8:43 pm
Level 34 : Artisan System
If you want a 4x4 area, you'll want to format your radius a bit differently. Doing [r=4] will search in a sphere with a radius of 4, which would allow the player to stand up to 8 blocks away from where you want. You could get a little bit closer with [r=2], but then you might cut off the corners of the area.

The best way to do this would be to use slightly different parameters to define a box. Something like the following:testfor @a[x=#,y=#,z=#,dx=4,dy=1,dz=4]That would actually create a 4x4 box, with the coordinates you put in for x y and z as the bottom corner.
1
umarku
06/09/2015 4:30 pm
Level 23 : Expert Network
Yea no problem, if you need any more help. Feel free to ask or PM me
1
EdFi
06/09/2015 4:27 pm
Level 6 : Apprentice Explorer
Alright. Thanks
1
umarku
06/09/2015 4:25 pm
Level 23 : Expert Network
You need to have a clock pulsing to update it for the Cmd block to check. Then to get if a player is in that radius you use a Comparator connected to the Cmd block
1
EdFi
06/09/2015 4:20 pm
Level 6 : Apprentice Explorer
The problem is that I want the command block to activate when a player comes within the radius and turn off when a player leaves. Right now, I have to put out a block when I'm within 4 blocks and then it works... I don't know if I'm doing anything wrong, but I've done exactly as people have done in videos
1
umarku
06/09/2015 4:15 pm
Level 23 : Expert Network
This should be what your looking for

Testfor @p[r=4]
1

Welcome