Olá Boa noite.
Queria que esses potions recuperassem instantaneamente e tivessem um delay de 10 segundos de uso. Se alguém puder me ajudar ><
Citarfunction doHealOverTime(cid, div, turn, effect) --alterado v2.6 peguem o script todo!!
if not isCreature(cid) then return true endif turn <= 0 or (getCreatureHealth(cid) == getCreatureMaxHealth(cid)) or getPlayerStorageValue(cid, 173) <= 0 then
setPlayerStorageValue(cid, 173, -1)
return true
endlocal d = div / 10000
local amount = math.floor(getCreatureMaxHealth(cid) * d)
doCreatureAddHealth(cid, amount)
if math.floor(turn/10) == turn/10 then
doSendMagicEffect(getThingPos(cid), effect)
end
addEvent(doHealOverTime, 100, cid, div, turn - 1, effect)
endlocal potions = {
[12347] = {effect = 13, div = 15}, --Small Recovery
[12348] = {effect = 13, div = 30}, --Medium Recovery
[12346] = {effect = 12, div = 60}, --Large Recovery
[12345] = {effect = 14, div = 100}, --Super Recovery
}function onUse(cid, item, frompos, item2, topos)
local pid = getThingFromPosWithProtect(topos)if getCreatureMaster(pid) ~= cid then
return doPlayerSendCancel(cid, "Recovery e compativel apenas com o Digimon!")
endif getCreatureHealth(pid) == getCreatureMaxHealth(pid) then
return doPlayerSendCancel(cid, "Este Digimon ja esta com a vida totalmente cheia.")
endif getPlayerStorageValue(pid, 173) >= 1 then
return doPlayerSendCancel(cid, "Este Digimon ja esta sob uso do Recovery.")
endif getPlayerStorageValue(cid, 52481) >= 1 then
return doPlayerSendCancel(cid, "Voce nao pode usar Potion quando estiver no duelo.")
end
doCreatureSay(cid, ""..getCreatureName(pid)..", Pegue o Recovery!", TALKTYPE_SAY)
doSendMagicEffect(getThingPos(pid), 0)
setPlayerStorageValue(pid, 173, 1)
doRemoveItem(item.uid, 1)local a = potions[item.itemid]
doHealOverTime(pid, a.div, 100, a.effect)
doSendAnimatedText(getThingPos(item2.uid), "RECOVERY!", 205)return true
end