• 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 I need to add decay

wevertonvrb

New Member
Joined
Oct 9, 2016
Messages
5
Reaction score
0
the decay does not work


function onUse(cid, item, fromPosition, itemEx, toPosition)
local rand = math.random(1, 100)
if(rand >= 1 and rand <= 5) then
doCreateItem(15464, 1, toPosition)
doDecayItem(item.uid)
elseif (rand >= 6 ) then
doCreateItem(15466, 1, toPosition)
doDecayItem(item.uid)
return true
end
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local rand = math.random(100)
    if rand <= 5 then
        local thing1 = doCreateItem(15464, 1, toPosition)
        doDecayItem(thing1)
    elseif rand >= 6 then
        local thing2 = doCreateItem(15466, 1, toPosition)
        doDecayItem(thing2)
    end
    return true
end

-- Edit --
Some explanation..

By creating the object attached to a local object, you can assign different modifiers to it.
.uid is not required, since by making the local, it automatically collects/assigns the uid to that object.

Note: in Items.xml, this item requires a decay timer already designated. Other you will have to add your own decay timer to it.
 
Last edited:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local rand = math.random(100)
    if rand <= 5 then
        local thing1 = doCreateItem(15464, 1, toPosition)
        doDecayItem(thing1)
    elseif rand >= 6 then
        local thing2 = doCreateItem(15466, 1, toPosition)
        doDecayItem(thing2)
    end
    return true
end

-- Edit --
Some explanation..

By creating the object attached to a local object, you can assign different modifiers to it.
.uid is not required, since by making the local, it automatically collects/assigns the uid to that object.

Note: in Items.xml, this item requires a decay timer already designated. Other you will have to add your own decay timer to it.
<br class="Apple-interchange-newline"><div id="inner-editor"></div>


thank you so much
muito obrigado
 

Similar threads

Back
Top