• 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 Custom Decay

miens

Combos and Freedom
Joined
Nov 6, 2016
Messages
61
Reaction score
8
Hi!
In my server when certain monster gets a hit there is a chance he drops an item on his position:
Code:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)

    if math.random(0,100) >50 and primaryDamage+secondaryDamage < Creature(creature):getHealth() then
       Game.createItem(2230,1,creature:getPosition())
    end

    return  primaryDamage, primaryType, secondaryDamage, secondaryType, origin
end
I dont want the exp area to be spammed with those items so I added decayTo attribute in items.xml
Code:
<item id="2230" article="a" name="bone">
        <attribute key="weight" value="950" />
        <attribute key="decayTo" value="0" />
        <attribute key="duration" value="5" />
    </item>
But the item does not decay. I figured that maybe i need to call item:decay() on my own. So I tried to add event that would call this function after some dealy. But as I was passing item:getUniqueId() as parameter later conversion with Item(parameter) returned nil. Even if I added 1 to the unique id. Any thoughts?
 
if i use the function u mentioned - will it decay the item immediately when the funciton is called or will it wait amount of time specified in <attribute key="duration" value="5" />?
 
ok thanks for help. looks like my search skills are retarded, dunno why I didnt found this solution.
 
Back
Top