Code:
command /rtp:
trigger:
set {_x} to random integer between -100 and 100
set {_z} to random integer between -100 and 100
set {_y} to random integer between 5 and 150
set {_loc} to location({_x},{_y},{_z})
teleport player to {_loc}
loop 150 times:
if block at {_loc} is not air:
add 1 to {_y}
set {_loc} to location at {_x}, {_y}, {_z}
teleport player to {_loc}
stop
else:
subtract 1 from {_y}
set {_loc} to location at {_x}, {_y}, {_z}
loop 150 times:
if block at {_loc} is dirt or grass_block or bedrock:
add 1 to {_x}
add 1 to {_z}
else:
stop loop
I don't want to teleport on dirt, grass_block and bedrock
and
I want to make it possible to teleport between floors in the building, but I always go to the rooftop. What should I do