• 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 [ACTION] DECAY ITEM if AID=?

Dibis

Member
Joined
Dec 1, 2022
Messages
73
Reaction score
16
Location
POLAND
Hello Otland!

I need decay script for tree. I can't change in items.xml "decay to" and time.
I need full action script etc:

If itemEx.action.id == 2700 and getPlayerStorageValue(cid,2700) < 1 then
Item ID 2700 decay to ID2968
(But decay time = 30 second. When time end i need in this position ID2700)

-[SORRY FOR MY BAD ENG]-
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.actionId == 2700 and getPlayerStorageValue(cid, 2700) < 1 then
        doTransformItem(itemEx.uid, 2968)
        doDecayItem(itemEx.uid)
    end
end
Post automatically merged:

XML:
<item id="2968" article="a" name="tree">
    <attribute key="decayTo" value="TREE'S_ID" />
    <attribute key="duration" value="1800" /> <!-- 1800 = 30 min -->
</item>
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.actionId == 2700 and getPlayerStorageValue(cid, 2700) < 1 then
        doTransformItem(itemEx.uid, 2968)
        doDecayItem(itemEx.uid)
    end
end
Post automatically merged:

XML:
<item id="2968" article="a" name="tree">
    <attribute key="decayTo" value="TREE'S_ID" />
    <attribute key="duration" value="1800" /> <!-- 1800 = 30 min -->
</item>

Ok, but when I add this:

XML:
<item id="2968" article="a" name="tree">
    <attribute key="decayTo" value="TREE'S_ID" />
    <attribute key="duration" value="1800" /> <!-- 1800 = 30 min -->
</item>
My all trees ID2968 on map not decay to new ID?
 
Lua:
local transformToItem = 2968
local previousItem = 2700

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.actionid == 2700 and getPlayerStorageValue(cid, 2700) < 1 then
        doTransformItem(itemEx.uid, transformToItem)
        addEvent(
            function()
                doTransformItem(getThingfromPos(toPosition).uid, previousItem)
            end,
            30 * 1000
        )
    end
    return true
end
 
Last edited:
Back
Top