Forum

> > CS2D > Scripts > regen health? lua
Forums overviewCS2D overview Scripts overviewLog in to reply

English regen health? lua

4 replies
To the start Previous 1 Next To the start

moved regen health? lua

Vennece
User Off Offline

Quote
those anyone have a regaining health with changeable
regen health please...

old Re: regen health? lua

Ace Howl
User Off Offline

Quote
If you want to regenerate health each second:
1
2
3
4
5
6
addhook("second","second")
function second()
	for _, id in pairs(player(0, "tableliving")) do
		parse("sethealth "..id.." "..(player(id,"health") + 1))
	end
end
Note: after +, there is number 1, change the value for amount of regeneration each second.

Another tip:
If you want to regen health faster, change hook and function to ms100. If you want it to regen much faster, use always.

old Re: regen health? lua

Alistaire
User Off Offline

Quote
If you want regen on a custom interval and custom health returned, use;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
interval = 250 --time in milliseconds between each health regen
amount = 2 --amount of health regenerated each regen

function customTimer()
	regen()
	timer(interval, 'customTimer')
end

customTimer()

function regen()
	for _,id in pairs(player(0, 'tableliving')) do
		parse('sethealth '..id..' '..(player(id, 'health') + amount)
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview