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

Problem with doRemoveItem (Solved)

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,857
Reaction score
96
Location
Brazil
I have this script to brake Bamboo Wall of Dworcs but the wall are not being created again.
LUA:
...
        elseif item2.itemid == 3798 then
                if rand == 1 then
                doRemoveItem(item2.uid)
                doSendMagicEffect(topos,3)
                elseif rand >= 2 then
                doSendMagicEffect(topos,2)
else
end
...

The big problem is: If I add an Event I have to set coords, but if I set coords I have to make lot of scripts, because there are a lot of bamboo walls that can be removed.
How can I set then to be created again?
 
Last edited:
Why set pos?
LUA:
addEvent(doRemoveItem, delay, getThingfromPos(topos).uid, 1)
won't work, uid becomes invalidated.

This is the proper way:
LUA:
local bamboo = {[3798] = 3959, [3799] = 3958}
function ( ... )
(...)
	elseif bamboo[itemEx.itemid] then
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		if math.random(4) == 1 then
			doTransformItem(itemEx.uid, bamboo[itemEx.itemid])
			doDecayItem(itemEx.uid)
		end
(...)
items.xml:
XML:
-
	<item id="3958" name="trashed wooden bars">
		<attribute key="decayTo" value="3799"/>
		<attribute key="duration" value="300"/>
	</item>
	<item id="3959" name="trashed wooden bars">
		<attribute key="decayTo" value="3798"/>
		<attribute key="duration" value="300"/>
	</item>
XML:
-
	<item fromid="3798" toid="3799" name="wooden bars">
		<attribute key="description" value="They already have some cracks and look rather fragile."/>
	</item>
 
Back
Top