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.
6
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:
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.Yea no problem, if you need any more help. Feel free to ask or PM me
Alright. Thanks
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
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
This should be what your looking for
Testfor @p[r=4]
Testfor @p[r=4]
