• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action [TFS 1.2] Demon Helmet lever with timer

Lundrial

lundrial:getTitle()
Joined
Apr 15, 2014
Messages
142
Reaction score
104
Location
Chile
I'm releasing stuff im creating for my custom project

lever.lua:
Code:
local timetoreset = 5 -- Time to reset the quest in minutes.
local objectid = xxxx -- Id of the item Blocking the path
local p = {
    Position(x, y, z), -- Position of the item blocking the path
    Position(x, y, z), -- Teleport Creation position
    Position(x, y, z) -- Position where it sends you
}

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local stone = Tile(p[1])
    local tp = Tile(p[2])
    if item.itemid == 1945 then
        cid:sendTextMessage(MESSAGE_EVENT_ORANGE, 'The object in your path has been removed for ' .. timetoreset .. ' minutes.')
        doCreateTeleport(1387, p[3], p[2])
        stone:getItemById(objectid):remove()
        p[1]:sendMagicEffect(CONST_ME_POFF)
        p[2]:sendMagicEffect(CONST_ME_TELEPORT)
        Item(item.uid):transform(1946)
       
        addEvent(function(stonePos)
            Game.createItem(objectid, 1, stonePos)
            stonePos:sendMagicEffect(CONST_ME_TELEPORT)
            p[2]:sendMagicEffect(CONST_ME_POFF)
            tp:getItemById(1387):remove()
            Tile(toPosition):getItemById(1946):transform(1945)            
        end, timetoreset * 60000, stone:getPosition())
       
    elseif item.itemid == 1946 then
        return false
    end
    return true
end

With some simple modifications you can make it seconds instead of minutes in case you want it to work that way.
 
Back
Top