#Randomly spawn safely

2 messages · Page 1 of 1 (latest)

upbeat temple
#

I have this script that spawns you randomly thousands of blocks away (in addition a mod that forces you to spawn in the Nether), the player keeps spawning in walls/lava and instantly dying, making for a lame gameplay experience...

Is it possible to make it so that, in addition to spawning thousands of blocks away, check to see if the block at the players ~ ~1 ~ is air, and the block at the players ~ ~-1 ~ is any Nether block (netherrack, soul soil, blackstone, basalt, ect.)

Script for reference;


const RESPAWN_RADIUS = 5000

PlayerEvents.respawned(event => {
  const { player, level } = event
  // if (event.endConquered) return

  const getRandomCoord = () =>
    Math.floor((Math.random() * RESPAWN_RADIUS * 2 - 1) - RESPAWN_RADIUS)

  const x = getRandomCoord()
  const z = getRandomCoord()
  const y = 64
  console.log([x, y, z].join(", "))

  player.teleportTo(x, y, z)

})
tulip ibexBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!