Script do Vodkart, ele autorizou o post.
O script consiste em quando comprar a pot ao invés de vir com 1 carga, irá vir com 5 cargas.
potregenera.lua (data/actions/scripts)
function onUse(cid, item, fromPos, itemEx, toPos) local function doRegeneration(cid, formula, count) doCreatureAddHealth(cid, formula.health) doCreatureAddMana(cid, formula.mana) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA) if (count ~= 1) then addEvent(doRegeneration, 1000, cid, formula, count - 1) end return TRUE end local tempo = 30 -- tempo que a potion ira ficar healando (tempo em segundos) local storage = 11148 -- nao mexa aqui local exhaust = 30 -- Tempo para player poder usar o item novamente! (tempo em segundos) local form = {health = getCreatureMaxHealth(cid) * 0.2 + 50, mana = getCreatureMaxMana(cid) * 0.15 + 40} if (getPlayerStorageValue(cid, storage) <= os.time()) then doRegeneration(cid, form, tempo) doChangeTypeItem(item.uid, item.type - 1) setPlayerStorageValue(cid, storage, os.time()+exhaust) else doPlayerSendCancel(cid, "Desculpe, voce so vai poder usar novamente em "..exhaust.." segundos.") end return TRUE end
actions.xml
<action itemid="7443" event="script" value="potregenera.lua" override="yes"/>
Em items.xml, substitua:
<item id="7443" article="a" name="bullseye potion"> <attribute key="weight" value="200" /> <attribute key="description" value="Drinking this potion increases temporarily your distance skill while decreasing your defense." /> </item>
por:
<item id="7443" article="a" name="Regeneração Potion" override="yes"> <attribute key="description" value="Poçao de regenerar sua vida e mana em um determinado tempo."/> <attribute key="decayTo" value="7636"/> <attribute key="charges" value="5"/> <attribute key="showcharges" value="1"/> <attribute key="weight" value="300"/> </item>