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:
I dont want the exp area to be spammed with those items so I added decayTo attribute in items.xml
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?
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
Code:
<item id="2230" article="a" name="bone">
<attribute key="weight" value="950" />
<attribute key="decayTo" value="0" />
<attribute key="duration" value="5" />
</item>