local config = {
seconds = 30,
HpPercent = 3, -- 3%
storage = 98762,
exausted = 30
}
function doRefilSecond(cid, Hp, delay) -- function by vodka
if not isCreature(cid) then return LUA_ERROR end
doCreatureAddHealth(cid, Hp)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
if delay ~= 1 then addEvent(doRefilSecond, 1000, cid, Hp, delay -1) end
return nil end
function onCastSpell(cid, var)
if getPlayerStorageValue(cid, config.storage) >= os.time() then
doPlayerSendCancel(cid, "wait " .. getPlayerStorageValue(cid, config.storage) - os.time() .. " seconds to use this spell again.") return false
end
doRefilSecond(cid, math.ceil(((config.HpPercent*getCreatureMaxHealth(cid))/100)), config.seconds)
return setPlayerStorageValue(cid, config.storage, os.time()+config.exausted)
end
DI
dúvida
[Ajuda] Regeneração Por Segundo Baseado Em Porcentagem Da Vida.
By digomaciel, 25 de jun. de 2012 in Scripts
addevent
cooldown
spell
ajuda
4
1.2k
info
Group: Herói
Joined: 20/05/10
Posts: 3.4k
Reputation: +1.5k
Gender: Masculino

25 de junho de 2012 às 16:04
Edited Junho 25 by Vodkart
info
Group: Campones
Joined: 08/12/05
Posts: 11
Reputation: 0

25 de junho de 2012 às 16:21
Funcionou perfeitamente, muito obrigado!




info
Group: Campones
Joined: 08/12/05
Posts: 11
Reputation: 0
Gostaria de criar uma magia que regenera-se 3% da vida do personagem por segundo. A magia so pode ser usada por Knights e Elite Knights. Duração de 30 segundos e a cada segundo piscar azul nele (CONST_ME_MAGIC_BLUE)
Grato.
Edited Junho 25 by digomaciel