--[[
<movevent event="StepIn" actionid="45001" script="teleportTiles.lua" />
]]--
local config = {
{tilePosition = Position(1000, 1000, 7), destination = Position(1000, 1000, 7), levelRequirement = 2000},
{tilePosition = Position(1000, 1000, 7), destination = Position(1000, 1000, 7), levelRequirement = 1500},
{tilePosition = Position(1000, 1000, 7), destination = Position(1000, 1000, 7), levelRequirement = 8000}
}
function onStepIn(creature, item, position, fromPosition)
player = Player(player)
if not player then
return true
end
local index = 0
for i == 1, #config do
if position == config[i].tilePosition then
index = i
break
end
end
if index == 0 then
player:teleportTo(fromPosition)
print("Error in teleportTiles. Position not found in table. Position(" .. position.x .. ", " .. position.y .. ", " .. position.z .. ")")
return true
end
index = config[index]
local teleportDestination = index.destination
if player:getLevel() < index.levelRequirement then
player:say("Requires level " .. index.levelRequirement, TALKTYPE_MONSTER_SAY)
teleportDestination = fromPosition
end
player:teleportTo(teleportDestination)
return true
end