local config = {
eff = 35,
chance = 50, --50% chance spawn the monster
breakchance = 5, -- 5% chance to break
monster = 'Hydra', --monster which will spawn
msg = "Sorry...", --msg that will be sent to the player IF the egg 'fails'
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(fromPosition.x == CONTAINER_POSITION) then
return doPlayerSendCancel(cid, "Please, first put your egg on the floor.")
end
if math.random(100) <= config.breakchance then
doPlayerSendTextMessage(cid, 27, config.msg)
doRemoveItem(item.uid, 1)
end
if math.random(100) <= config.chance then
doSendMagicEffect(fromPosition, config.eff)
doSummonCreature(config.monster, fromPosition)
doRemoveItem(item.uid, 1)
else
doSendMagicEffect(fromPosition, CONST_ME_POFF)
end
return true
end