Cod: Selectaţi tot
quest auto_hp_regen begin
state start begin
function cfg()
local c = {}
c.SEC = 10
c.PCT = 3 -- regen 3% hp
return c
end
when login begin
if pc.getqf("regen_on") != 1 then
pc.setqf("regen_on", 1)
loop_timer("regen_tick", auto_hp_regen.cfg().SEC)
end
end
when regen_tick.timer begin
local pct = auto_hp_regen.cfg().PCT
local maxhp = pc.get_max_hp()
local add = math.floor(maxhp * pct / 100)
if add > 0 then
pc.change_hp(add)
end
end
end
end
