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.
Por digomaciel, 25 de jun. de 2012 em Scripts
addevent
cooldown
spell
ajuda
4
1.1k
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

25 de junho de 2012 às 16:04
Editado Junho 25 por Vodkart
info
Grupo: Campones
Registrado: 08/12/05
Posts: 11
Reputação: 0

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




info
Grupo: Campones
Registrado: 08/12/05
Posts: 11
Reputação: 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.
Editado Junho 25 por digomaciel