Yo
as the title says
teleport does not disappear after a min for some reasons
addEvent(removeTeleport, 1 * 60 * 1000, position)
means after a minute it should be gone or im wrong?
as the title says
teleport does not disappear after a min for some reasons
Lua:
-- Boss teleport spawn script by mdwilliams.
-- https://otland.net/threads/tfs-1-2-portal-created-on-monster-death.265567/#post-2567024
-- Converted to TFS 1.3 Revscriptsys by Evil Hero.
local teleportToPosition = Position(1041, 663, 7)
local teleportCreatePosition = Position(1020, 681, 7)
local bossName = "wailing widow"
local killMessage = "You have killed Wailing Widow! A teleport has been created but it will disappear in 1 min!"
-- Function that will remove the teleport after a given time
local function removeTeleport(position)
local teleportItem = Tile(position):getItemById(1387)
if teleportItem then
teleportItem:remove()
position:sendMagicEffect(CONST_ME_POFF)
end
end
local event = CreatureEvent("BossKill")
function event.onKill(creature, target)
if target:isPlayer() or target:getMaster() or target:getName():lower() ~= bossName then
return true
end
local position = target:getPosition()
position:sendMagicEffect(CONST_ME_TELEPORT)
local item = Game.createItem(1387, 1, teleportCreatePosition)
if item:isTeleport() then
item:setDestination(teleportToPosition)
end
target:say(killMessage, TALKTYPE_MONSTER_SAY, 0, 0, position)
-- Remove portal after 5 minutes
addEvent(removeTeleport, 1 * 60 * 1000, position)
return true
end
event:register()
local login = CreatureEvent("RegisterBossKill")
function login.onLogin(player)
player:registerEvent("BossKill")
return true
end
login:register()
addEvent(removeTeleport, 1 * 60 * 1000, position)
means after a minute it should be gone or im wrong?