local positions = { -- add the room tiles here
{x=1349, y=826, z=13},
{x=1350, y=826, z=13},
}
local tp = {x=1359, y=825, z=13} -- where the teleport is created
local tpto = {x=1350, y=807, z=13} -- where you tp to
function isPositionInArray(haystack, needle)
for i = 1, #haystack do
if haystack[i].x == needle.x and haystack[i].y == needle.y and haystack[i].z == needle.z then
return true
end
end
end
function onKill(cid, target, flags)
if getCreatureName(target):lower() == "YOUR MONSTER NAME HERE" then
local myPos = getThingPos(cid)
if isPositionInArray(positions, myPos) then
doCreateTeleport(1387, tpto, tp)
doBroadcastMessage("You got 1 minute to enter the portal before it dissapears.")
addEvent(onRemove, 1 * 60 * 1000)
end
end
return true
end
function onRemove()
doRemoveItem(getTileItemById(tp, 1387).uid)
doSendMagicEffect(tp, CONST_ME_POFF)
return true
end