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

Lua addevent small problem

Hernest

New Member
Joined
Jul 26, 2010
Messages
152
Reaction score
3
Location
poland
I want to remove item from a tile after x seconds.
Code:
function onAddItem(moveitem, tileitem, position)
    local uidd = moveitem.uid
    addEvent(doRemoveItem, 3*1000, uidd)
end

Code:
[21:47:56.373] [Error - MoveEvents Interface]
[21:47:56.373] In a timer event called from:
[21:47:56.373] data/movements/scripts/kratka_arena.lua:onAddItem
[21:47:56.373] Description:
[21:47:56.373] (luaDoRemoveItem) Item not found

When I made:
Code:
function onAddItem(moveitem, tileitem, position)
    doRemoveItem(moveitem.uid)
end
it worked fine but w/o any delay.

Any ideas how to fix it?
 
Code:
function removeItem()
local tile = Tile(Position(x,y,z))
    if tile then
    local item = tile:getItemById(item_id)
        if item then
            item:remove()
        end
    end
    return false
end

Code:
addEvent(removeItem, 3*1000)
 
Back
Top