- Games, Toys, and Hobbies»
- Computer & Video Games
Proximity Messages for Adventure Maps in Minecraft
What's a Proximity Detector?
A proximity detector will trigger one or more designated commands when you get close to a certain block. My original line of thinking was to use this to deliver messages and progress the story-line in an adventure map, however I learned the same setup allows for many more cool things as well!
As I'm brand new to Minecraft, it took me nearly two hours to figure out how to utilize the various components required to set this up correctly.
What's your favorite type of adventure map?
The detector and message are triggered through command blocks, which aren't available in creative mode unless you type /give <player> 137 into the command prompt, where <player> is you.
This setup has two command blocks and a little redstone mechanism to power them.
One block has the /testfor command to output when the closest player is within 3 blocks. Ultimately I should be able to put this mechanism anywhere on the map and use exact coordinates to "testfor" or trigger the positive output, but I'll test that out another day. For now, I have the mechanism behind the wall of my test tunnel, so being in proximity to the block works just fine.
The other block uses the /say command to deliver the message. Possibly the /tell command would be better to use here, since I believe /say will broadcast to all players in the map, not just the player that triggered the message.
For now, I'm only concerned with one person at a time going through the map, so it's not that important a distinction.
In order to conditionally transfer signal from the /testfor command block to the /say command block, a redstone comparator is needed. This acts like an if/then operator with a boolean (true/false) switch if you think of it like a program.
IF the nearest player is in a 3 block radius
THEN trigger the /say command, sending a message to the player.
You can't directly power the /testfor command block, however, because once the comparator is triggered, it will stay powered even if the conditions aren't true. Likewise, a switch, button or pressure plate won't work for this purpose because it'd be reliant upon a user to turn it on and off to activate the message, making the automation pointless.
Note about Redstone Clocks
The delay on the repeaters needs to be set to 2-4 ticks, otherwise it'll burn itself out due to blinking too fast.
The only choice for powering the /testfor block is a redstone clock, or infinite timer loop. This clock is ultimately a self-powered circuit depending on the redstone repeater, flipping itself on and off according to the delay that's set. This briefly removes the power from the command block, allowing the comparator to be reset to cancel the output when the conditions are no longer true.
The clock was a bitch for me to figure out, mostly because there are so many terrible tutorials out there on how to create it. Why does it seem like 98% of all Minecraft tutorials are video in nature? Doesn't anyone write anything down anymore? All I needed was a simple little picture with three or four notes on it. Ultimately the video at the bottom of this post did the best job of helping me figure out a small, simple redstone clock, which was handy as it also did the best job of helping me figure out this proximity detector.
A Message From the Evil Overlord
I came across this trick of using the anvil to rename the command block, which can make it seem like an NPC is delivering the message, as shown in the first photo of this post.
It would be truly awesome if each block could be named individually, but it appears that they're tied together by type. So, in this case, all command blocks are named Evil Overlord. Possibly useful, but limiting.
Putting it All Together
This video lays it all out, although there are a plethora of additional possibilities other than using this configuration as a proximity detector to spit out a message.
You could set the conditions to test for when a player reaches a certain level or a certain number of players meet the criteria. You could reset mobs, change the time of day, teleport, change the difficulty level, give players items, spawn mobs, play a sound, give a player an achievement, give out XP, set up trap doors, allow access to the next level or pretty much any other command or redstone-triggered item or device.
With the vast array of possibilities, I'm very excited to figure out applications and test them for use in building my own adventure map!