• 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 DoDecay not working on a certain item, another way?

rockseller

Lua & .NET Programmer
Joined
May 10, 2008
Messages
159
Reaction score
9
Location
México
Hello Otland.
I have the following in items.xml

Item 1:
Code:
<item id="10504" article="a" name="tree">
		<attribute key="description" value="Para poder talar este árbol, necesitas ser Leñador." />
	</item>

	<item id="10505" article="a" name="cutted tree">
		<attribute key="decayTo" value="10504" />
		<attribute key="duration" value="30" />
	</item>

Item 2:
Code:
<item id="1290" article="a" name="stone">
		<attribute key="description" value="Para poder talar este árbol, necesitas ser Leñador." />
	</item>

	<item id="1294" article="some" name="picked stones">
		<attribute key="decayTo" value="1290" />
		<attribute key="duration" value="30" />
	</item>


i run the following code on an action OnUse:
Code:
if itemEx.itemid == 1290 then
      RewardDecayTo = 1294
end

if itemEx.itemid == 10504 then
      RewardDecayTo = 10505
end

transformUID = itemEx.uid
Reward = 2222
RewardQty = 1

doPlayerAddItem(cid, Reward, RewardQty)
doTransformItem(transformUID, RewardDecayTo,1)
doDecayItem(itemEx.uid)

I checked for duplicated items on items.xml, there aren't.
Item 1, OnUse:
*Gives Reward
*Transform the item
*30 seconds, it decays back.

Works.

To my surprise:

Item 2 OnUse:
*Gives Reward

That's it.

I've tryed using Transform, then AddEvent with delay of 30 seconds to Transform back but either it doesn't find the uid or nothing happens.

So the question is, are there any hidden properties behind some item ids?

Thanks in advance.
 
It's because of doDecayItem. Looks like it doesn't work well after you transform and unmoveable item to a moveable item.
LUA:
function reset(pos, from, to)
	doTransformItem(getTileItemById(pos, from).uid, to)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isInArray({1290, 10504}, itemEx.itemid) then
		doPlayerAddItem(cid, 2222, 1)
		local new = itemEx.itemid == 1290 and 1294 or 10505
		doTransformItem(itemEx.uid, itemEx.itemid == 1290 and 1294 or 10505)
		addEvent(reset, 30 * 1000, toPosition, new, itemEx.itemid)
		return true
	end
end
 
I tryed with a unmovable item. I also tryed doing "/i Item2Transformed" inside the game, which after 30 seconds actually DecayTo.
Any suggestion?
 
Last edited:
Back
Top