• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Teleport to random locations

Exedras

New Member
Joined
Jun 1, 2009
Messages
12
Reaction score
0
Hello, i have a question. It is possible to make a teleport which teleport to random location? For example first person goes to location x, second to y, another to z etc. If yes i need script for this :D Thanks you
 
Hello, i have a question. It is possible to make a teleport which teleport to random location? For example first person goes to location x, second to y, another to z etc. If yes i need script for this :D Thanks you
which tfs do you use?
which version of the game?
I still can't see it in my crystal ball.
 
Tfs 1.3. For this you need to specify rectangle or square area to where players can be teleported and must be filled with tiles
Lua:
local xRange = {x1, x2}
local yRange ...
local zRange ...

function teleportToRandomPosition(player)
local isWalkable = false
local x = 0
local y = 0
local z = 0
repeat
 x = math.random(xRange[1], xRange[2])
 y = math.random(yRange[1], yRange[2])
 z = math.random(zRange[1], zRange[2])
 isWalkable = Tile(x, y, z):isWalkable()
until isWalkable
 player:teleportTo(Position(x, y, z))
 return true
end

I'm away from PC so haven't tested it. Write in case of any issues
 
Back
Top