How do make a redstone signal select a random set of command blocks [duplicate]

How do make a redstone signal select a random set of command blocks [duplicate] - Set of domino on wooden table

I want to make a minigame world where you press a button and it has 3 command blocks behind it that teleport you to different areas. But I don't know how to make it select one random command block



Best Answer

I have a possible answer, there is just one problem... it has four outputs and not three.

I have it build with dropper, hopper and a comperator. The first comperator random selects the secound path and the secound comperator selects the output. I build that thing on my offline map:

OverviewRightclick on the picture and press show picture to enlarge the image.

I have put commandblocks to the output fields. The black wool is the input. To get the best result you should put the commandblocks at the red wool. Furthermore it is important that you use the command with selector commands (I use range)!

On my world I tested it with the command gamemode /gamemode 1 @p[r=3,rm=1].

r is the max radius, rm is the min radius

If you don't do that, there is the possibility that up to 3 other player who not pressed the button are selected for the teleport. The r=3 is calibrated to the red wool and the red sand.

You also have to add a delay with Repeaters to the commandblocks so the block farthest away is always executed as first (the before last as third and so on). Keep in mind that I forgot that in the picture above!

To get the high complex random working you have to put in every hopper a tool and a block or a item.

HopperRightclick on the picture and press show picture to enlarge the image.

Keep in mind that I use the original Minecraft without a server neither plugins. If you use warps or other commands you have to try out if the selector argument is working.


The solution with the range is not perfect because the radius could select a other player too if he is in the radius. If you do not want that you should use the argument @a[x=100,y=60,z=-80,dx=4,dy=2,dz=5]. With that all people in the cube are selected. So you should enter the coordinates above the red sand so only the one player wich is standing on the red sand is selected for the teleport.




Pictures about "How do make a redstone signal select a random set of command blocks [duplicate]"

How do make a redstone signal select a random set of command blocks [duplicate] - Tampons and daily liner on white surface
How do make a redstone signal select a random set of command blocks [duplicate] - Board game with wooden blocks dropped and scattered on table chaotically after playing
How do make a redstone signal select a random set of command blocks [duplicate] - Set of small wooden blocks scattered on table chaotically after playing tower game



How do you make a command block randomizer?

A repeat command block executes its command once every one game tick (or more\u200c [BEonly]) until no longer activated.

How do you make a repeating Redstone command Block?

To copy the entirety of a certain Command block or Text press Ctrl+A to select it all then Ctrl+C to copy it. Might be quicker than pressing shift and going over 280 characters. Oh and after you hit Ctrl+A you can use shift+Left or Right Arrow Key to adjust what is selected.



[1.15-1.18] Minecraft Randomizer | Command Blocks




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: jovan curayag, Karolina Grabowska, Joshua Miranda, Joshua Miranda