• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua TP not dissapearing after bosskill

JackP3

New Member
Joined
Aug 6, 2014
Messages
12
Reaction score
0
The TP spawns, but doesnt disappear after 60 sec :s Anyone know why?


Code:
local config = {
    message = "Go into the teleport in 60 seconds, else it will disappear.",
    timeToRemove = 60, -- seconds
    teleportId = 1387,
    bosses = { -- Monster Name, Teleport To Position, Teleport Position
        ["Eternal Oblivion"] = { { x = 1047, y = 346, z = 5, stackpos = 1 }, { x = 1129, y = 297, z = 11 }},           
        ["Ryze"] = { { x = 776, y = 934, z = 4, stackpos = 1 }, { x = 777, y = 916, z = 4 }}       
    }
}

local function removal(position)
    if getThingfromPos(position).itemid == config.teleportId then
        doRemoveItem(getThingfromPos(position).uid)
    end
    return TRUE
end

function onKill(cid, target, lastHit)
    for name, pos in pairs(config.bosses) do
        if name == getCreatureName(target) then
            teleport = doCreateTeleport(config.teleportId, pos[1], pos[2])
            if teleport == FALSE then
                print("Create teleport failed. Check ID, position1 and position2")
                return TRUE
            end
            doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
            addEvent(removal, config.timeToRemove * 1000, pos[1], pos[2])
        end
    end
    return TRUE
end
 
Change function removal to this
Code:
local function removal(position)
     local thing = getTileItemById(position, config.teleportId).uid
     if thing > 0 then
           doRemoveItem(thing)
     end
     return true
end

And the addEvent line to this
Code:
addEvent(removal, config.timeToRemove * 1000, pos[2])
 
Change function removal to this
Code:
local function removal(position)
     local thing = getTileItemById(position, config.teleportId).uid
     if thing > 0 then
           doRemoveItem(thing)
     end
     return true
end

And the addEvent line to this
Code:
addEvent(removal, config.timeToRemove * 1000, pos[2])
Thanks for answer! :)
 
Back
Top