Random teleport position

I’m trying to do a PVE where the bots teleport to a position near the player. So far, I use the following functions :

  • Ray cast from a random Living player to a position
  • Nearest walkable position of this vector

But, even if I use the “Nearest walkable position” the bots teleports inside weird places.

Also, since I use ray cast, they always spawn in the same direction instead of all around the players. Do you guys know if there is a way to generate a random position near a player (between 8m and 15m). It would be an interesting factor since I’m trying to create the PVE for different maps and you don’t have to change the coordinate every time.

Thank you

Try doing teleport to nearest walkable position of add(position of event player, vector(random integer(-4,4), 0, random integer(-4,4))

It’s working! Thank you very much, you made my day :smiley:

1 Like