D
Deleted member 5824
Hi, I am trying to make a /wild command, and I don't want the player to spawn in mid air, or in lava/water. So I thought about making a while-loop to check for the block below the player. And if that block is air, check for the block underneath, until it's solid ground. Here is what I have so far: (And I know that I should randomize a new location if the block is lava or water, but I haven't gotten that far yet)
code_language.skript:
options:
min.x: -15000
max.x: 15000
min.z: -15000
max.z: 15000
Cooldown: 5 minutes
ForbiddenBlocks: "Lava" or "Water" or "Air"
command /wild:
trigger:
set {_waited} to difference between {wild.%player%.lastused} and now
if {_waited} is less than {@Cooldown}:
send "&cYou must wait %difference between {@Cooldown} and {_waited}%"
stop
set {_x} to a random number between {@min.x} and {@max.x}
set {_z} to a random number between {@min.z} and {@max.z}
set {_y} to 100
set {_loc} to location at {_x}, {_y}, {_z} in world "wild"
while block below the location of {_loc} is {@ForbiddenBlocks}:
set {_loc} to location at {_x}, {_y}-1, {_z} in world "wild"
teleport player to {_loc}