I would really like to know if it's possible to track "how high" the player is and link it to another command.
For example, if the player is above or crossed height level of 240, it would trigger a set of commands (
tp ~ ~-100 ~ as an example).
Arqade is a question and answer site for passionate videogamers on all platforms. It only takes a minute to sign up.Sign up to join this community
You must change the origin to that of the player using
/execute and then modify the Y value, while providing a selection limiter such as a radius.
Without the limiter, it will select all players in existence, as an origin change (only modifying
x parameters) does not equate to a limiter. The origin is used to sort targets by distance before running commands affecting them.
/execute, the X and Z coordinates will be that of the command block, which would prevent usage anywhere except at the same X and Z of the command block. For example, given the following command:
/tp @a[y=-64,dy=64] X Y Z
This would only teleport players at the command block's X and Z, but with a modified Y. Example image, where the black square is the command block and the shaded area is where a player must be to match:
/execute, the origin will be that of the targets. This allows usage anywhere in the world since the targets will always match their own X and Z coordinates.
For example, using the following command:
/execute @a ~ 64 ~ /tp @a[y=-64,dy=64] X Y Z
The following image represents where players (represented by circles) need to be to match:
You can either change the Y using
/execute @a ~ 240 ~ /tp @a[r=1,c=1] ~ ~-100 ~
Or change it using the
y parameter of the nested selector:
/execute @a ~ ~ ~ /tp @a[y=240,r=1,c=1] ~ ~-100 ~
Have a command block on a fast clock with
Have a comparator coming out of that command block and into another one. In that new command block put
tp @a ~ ~-100 ~
Of course you can change the values and if you want it only for specific players. As long as they start under 240 y or if they start above and fall to 240 y they will be teleported. If you have any questions, feel free to contact me.