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

Teleport does not disappear ( tfs 1.3 )

Marko999x

999x era
Premium User
Joined
Dec 14, 2017
Messages
2,821
Solutions
82
Reaction score
1,943
Location
Germany
Yo
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?
 
change
addEvent(removeTeleport, 1 * 60 * 1000, position)
to
addEvent(removeTeleport, 1 * 60 * 1000, teleportCreatePosition)
 
Solution
Back
Top