Minecraft – How to generate a redstone signal when players are near

minecraft-java-editionminecraft-redstone

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.

Best Answer

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 []