<globalevent name="wall" interval="7200" event="script" value="wall.lua"/>
function onThink()
local id, pos = getThing(6666).itemid, getThingPos(6666)
doRemoveItem(6666)
addEvent(doCreateItem, 10 * 60 * 10000, id, 1, pos)
return true
end
local pos = {x=1,y=1,z=1}
local item_id = 1234
function onThink()
local item = getTileItemById(pos, item_id)
doRemoveItem(item.uid)
addEvent(doCreateItem, 10 * 60 * 1000, item_id, 1, pos)
return true
end
local pos = {x=1,y=1,z=1}
local item_id = 1234
function onThink()
doBroadcast("10 min left")
addEvent(doBroadcast, 5 * 60 * 1000, "5 min left")
addEvent(doRemoveItem, 10 * 60 * 1000, getTileItemById(pos, item_id).uid)
addEvent(doCreateItem, 20 * 60 * 1000, item_id, 1, pos)
return true
end
local pos = {x=1,y=1,z=1}
local id = 1234
function onThink()
doBroadcast('10 min left')
addEvent(doBroadcastMessage, 5 * 60 * 1000, '5 min left')
addEvent(function() doRemoveItem(getTileItemById(pos, id).uid) end, 10 * 60 * 1000)
addEvent(doCreateItem, 20 * 60 * 1000, id, 1, pos)
return true
end
I've modified it, because you can't reuse item uids between function calls. They change between script callbacks, which happens when addEvent is used.Did you answer and copy code + modify or wrote it Cyko?
If item exist now (when onThink execute) there is no reason to check UID when it execute doRemoveItem.