25.12.2012
Update! Today I updated this code.
I've added 2 new monsters such as the tibia wiki writing. I tried to reproduce percent chance and changed the appearance of monsters items. From now on, they do not appear only in the form of a cocoon.
## ACTION.xml ##
Code:
<action itemid="7537" event="script" value="cocoon.lua"/>
## COCOON.lua ##
Code:
-- ### onUse
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- ### COCOON
if itemEx.itemid == 7537 and (math.random(0, 100) < 41) then
doSendMagicEffect(toPosition, 2)
doTransformItem(item.uid, item.itemid - 1)
doSummonCreature("Spider", fromPosition)
elseif itemEx.itemid == 7537 and (math.random(0, 100) < 11) then
doSendMagicEffect(toPosition, 2)
doTransformItem(item.uid, item.itemid - 1)
doSummonCreature("Poison Spider", fromPosition)
elseif itemEx.itemid == 7537 and (math.random(0, 100) < 1) then
doSendMagicEffect(toPosition, 2)
doTransformItem(item.uid, item.itemid - 1)
doSummonCreature("Tarantula", fromPosition)
else
doSendMagicEffect(toPosition,2)
doTransformItem(item.uid, item.itemid - 1)
end
-- ### END
end
## ITEMS.xml ##
Code:
<item id="7536" article="a" name="destroyed cocoon">
<attribute key="decayTo" value="7537"/>
<attribute key="duration" value="600"/>
</item>
<item id="7537" article="a" name="cocoon"/>
Last edited: