• 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!

block sqm in temple

vexler222

Active Member
Joined
Apr 22, 2012
Messages
714
Solutions
15
Reaction score
47
Hi, i need script for block sqm in temple, if player got teleport to temple he's teleported +1 sqm from temple pos in random pos

TP NW | TP N | TP NE
TP W | SQM 0 | TP E
TP SW | TP S | TP SE
 
LUA:
local teleportPosition = player:getTown():getTemplePosition()
teleportPosition.x = teleportPosition.x + math.random(-1, 1)
teleportPosition.y = teleportPosition.y + math.random(-1, 1)
player:teleportTo(teleportPosition)
 
LUA:
local teleportPosition = player:getTown():getTemplePosition()
teleportPosition.x = teleportPosition.x + math.random(-1, 1)
teleportPosition.y = teleportPosition.y + math.random(-1, 1)
player:teleportTo(teleportPosition)
There would still be 11% chance of player teleporting to center.

LUA:
local teleportPosition = player:getTown():getTemplePosition()
local maxRange = 1
teleportPosition .x = teleportPosition .x + (math.random(2) == 1 and math.random(maxRange) or -math.random(maxRange) )
teleportPosition .y = teleportPosition .y + (math.random(2) == 1 and math.random(maxRange) or -math.random(maxRange) )
player:teleportTo(teleportPos)
This should make so it won't be teleported to center. Also added a bonus, if you want to change the range the player can be teleported just change the variable maxRange
 
Back
Top