creditos: jestemPolakiem
Explicação:
está Potion contem 5 cargas,que quando usada ela durante 30 segundos regenera do player Mana e Hp.
em NPC poderá vir mais carga.
actions\script crie um arquivo.lua e renomeie para
regenera.lua
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 -- não 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, "Sorry, you only can again use this item after "..exhaust.." seconds.")
end
return TRUE
end
actions.xml adicione a tag:
<action itemid="7443" event="script" value="regenera.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ção 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>