Arqade Asked by MarioTimeWhoa - Nathan on March 10, 2021
I want a redstone block to be placed when the player is in a certain location. The redstone block will power multiple command blocks which will display a conversation the player is supposed to "overhear."
I’ve tried the following command to no avail:
/execute @a x y z /fill x y z x y z redstone_block
/execute @a x y z /fill x y z x y z redstone_block
Here was your old trials. I'm assuming you were testing for players on coordinates (1, 2, 3) by doing:
/execute @a 1 2 3
But no. What exactly are the coordinates after @a
doing? Let's take a look.
From the Minecraft Wiki:
Syntax
execute <origin: target> <position: x y z> <command: command>
And what does the coordinates do?
Specifies the position from which to run the command. Coordinates specified with tilde and caret notation are relative to the target, not to the position of the command's execution.
Your command is telling Minecraft to do this:
Tell all players to execute the following command at x, y, z: fill x1 y1 z1 x2 y2 z2 redstone_block
.
Obviously not what you want.
To filter players based on position, properties, distance, etc., you have to modify @a
to include arguments, which will filter your selection to the correct players.
Arguments go in the (optional) square brackets after @a
. For example: @a[ARGS]
We'll use the x
, y
, and z
arguments to select a position, and the r
argument to dictate how close the player must be.
/testfor @a[x=1,y=2,z=3,r=5]
For example, this command will succeed if a player is detected within 5 blocks of (1, 2, 3).
All you need to do is place a chain command block after that set to conditional mode, with the command you want to run, like your /fill
or a /setblock
.
Correct answer by ExpertCoder14 on March 10, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP