9

Is it possible to construct something that will run automatically whenever a player is nearby, say within a chunk's range, without that player having to trigger something like a pressure pad or detector rail ?

What I'm trying to do is get some pistons to move in this situation, so for example if someone was walking along something might light up on a distant hill

The only way I can think of doing this is to have a cavern underground with a load of pressure plates wired up to pistons on the surface, and an army of snow golems down there to wander around and hit the pressure plates. But they don't seem to spawn until you're pretty near.

3
  • 2
    It can be done with the craft bukkin plugin for SMP servers (signs can detect when player is nearby), no way other than pressure plates, or other redstone triggers
    – Domocus
    Commented Dec 14, 2011 at 16:11
  • 1
    You should be able to do something with a minecart and powered rail, though I can't do a test of my idea right now.
    – thedaian
    Commented Dec 14, 2011 at 16:45
  • Tripwire can be 40 blocks long, so you can use it to check quite a bit of area for passers-by.
    – SF.
    Commented Jul 10, 2013 at 20:52

8 Answers 8

0

I stumbled on this trying to figure out how to do this, and I found out NONE OF THEM WORK! So I figured it out instead. Place a repeating redstone curcuit going into a command block, and type in the command block this:

/effect @p[r=(number)] 13 1 0 

with a comparotor coming out of it.

Then, hook up whatever you want to the comparotor! Now, here's how to know what number to put: the number you put = how many blocks away a player has to be before the redstone comparotor turns on. Also, if you put "m" after r, so "rm" it will work only if the player has LEFT the number of blocks put.

Don't you use ANY () in your command! JUST []

2
  • 1
    While this technically works, so would a simple testfor which is actually designed to do this.
    – MrLemon
    Commented Nov 13, 2015 at 18:18
  • 1.13 syntax: /effect give @p[r=(number}] <effect name> 1 0
    – pppery
    Commented Jun 10, 2020 at 18:00
12

You can use mob spanners to create sensors that only activate within 16 blocks of them. An example construction is shown here:

3

If you are in creative, run a clock wired up to a command block that has the command /testfor @p[r=some number] with a comparator output to the pistons.

2

IF you're using Bukkit, there's a wonderful plugin called PailStone that has sign proximity sensors. You define a volume, and when a player enters that volume, the sign provides power. I used it along with a few other mods to make an enormous airbase with huge doors that automatically opened when a player approached them.

1

Run a clock with a command block attached to it with the command:

/testfor @a[x=X,y=Y,z=Z,r=Radius] 

and put a comparator coming out of the command block with output leading to pistons.

1
  • This will work now with these new-fangled command blocks all the youngsters are crazy about.
    – Alan B
    Commented Mar 19, 2015 at 8:41
1

Pufferfish expand when a player goes near them. By putting them in a small hole and putting a tripwire hook above them, you can trigger a redstone signal when they get near. Warning, this can poison them if they get too close.

0

You can use command blocks proximity detector command.
Just stuff the command blocks away.
Here is a example:

-=redstone  
|-|=powered rail  
c= command block  

c----|-|
0

You can have a redstone ore with a snow quarter block on top of it, when the ore is stood on it emits a signal, use that then hook it up to your lantern over on the hill

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.