• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Cocoon

Erazma

Banned User
Joined
Sep 3, 2012
Messages
265
Reaction score
4
2uivo7c.jpg


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:
If someone wants a not too complicated to write the script! I'll try to do it! (Only the real map)
 
2uivo7c.jpg


## 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) > 50) then     
doSendMagicEffect(toPosition, 2)
doTransformItem(item.uid, item.itemid - 1)
doSummonCreature("Spider", getCreaturePosition(cid))
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"/>

Nice script, but check this out. It may help you improve that script a bit. :)
Spider Egg/Breaking Statistics - TibiaWiki - Quests, Items, Spells, and more
 
Back
Top