create 3 items next to the player
if the player does not pass over the item a monster will spawn
after 5 minutes remove the monster that was created
if the player does not pass over the item a monster will spawn
after 5 minutes remove the monster that was created
Lua:
local area = {
fromPos = {x = 32363, y = 32138, z = 7},
toPos = {x = 32371, y = 32145, z = 7}
}
local function getPlayerFromArea()
for x = area.fromPos.x, area.toPos.x do
for y = area.fromPos.y, area.toPos.y do
for z = area.fromPos.z, area.toPos.z do
local t = Tile(x,y,z)
if t and t:getTopCreature() and t:getTopCreature():isPlayer() then
return t:getTopCreature()
end
end
end
end
return nil
end
local test = GlobalEvent("test")
function test.onThink(interval)
local p = getPlayerFromArea()
p:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
return true
end
test:interval(1000)
test:register()