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

Remove Item

Scooty

Enemia.EU
Joined
Jul 24, 2010
Messages
564
Reaction score
14
Location
Kraków
Hi im looking for that script:

-every 2 hours wall with unique id 6666 will be remove
-after 10 min it will spawn at the same location(x,y,z)

i think it is simple globalevent.

can someone help me?
 
XML:
<globalevent name="wall" interval="7200" event="script" value="wall.lua"/>
LUA:
function onThink()
	local id, pos = getThing(6666).itemid, getThingPos(6666)
	doRemoveItem(6666)
	addEvent(doCreateItem, 10 * 60 * 10000, id, 1, pos)
	return true
end
 
ohhh i forgot.....new wall must have unique id 6666 too ;/ can you do it?

or that script can remove item from x,y,z not from unique id ;d
 
Item ID based.
LUA:
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
 
LUA:
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
 
LUA:
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
 
Did you answer and copy code + modify or wrote it Cyko? :D

If item exist now (when onThink execute) there is no reason to check UID when it execute doRemoveItem.
 
Did you answer and copy code + modify or wrote it Cyko? :D

If item exist now (when onThink execute) there is no reason to check UID when it execute doRemoveItem.
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.
 
Back
Top