Health Points LUA


(Kaco123) #1

Hello,
So I want to set hp for eng,cvops,field,soldier and medics.
When new player join on the server he has 100 HP but when he get 3 or 4 medics lvl his HP is 115. I want to set 140 HP from begining to the end :smiley: I have some script like this but itā€™s not working properly.

function et_InitGame(levelTime, randomSeed, restart)
	et.RegisterModName("NQ health")
end

function et_ClientSpawn(clientNum, revived)

	et.gentity_set(clientNum, "health", 140)
	
end

After one death HP is 100 or 115 it depends from med lvl. When you are playing eng, or field it doesnt matter just not a med health points decline from 140 to 100 or 115. Can you help me guys with that?


(Micha) #2

et.gentity_set(clientNum, ā€œps.statsā€, 4, 140)
Is to set the maximal healthpoints possible.

Here is a lua you could checkout:
http://mnwa.bplaced.net/ftpfiles/Lua/hpboost.lua


(Kaco123) #3

Ok itā€™s working.
Thnaks


(Crytiqal) #4

I thought you wanted to have someones health be 140HP if there are 4 medics on the team ^^

Is this possible?


(Micha) #5

Yes it is, you need to set the ps.stats to a different value.
I use this in my infected mod (part of it):

			if checkclass(cno) == 1 then
				et.gentity_set(cno, "ps.stats", 4, humans_medic_max_hp - (humans_medic_max_hp/10))

(Crytiqal) #6

This is the greatest game ever


(Kaco123) #7

Hello, I have this one

local MAX_HEALTH = 140 -- Change your max health here.

function et_ClientSpawn( clientNum, revived, teamChange, restoreHealth )
    et.gentity_set( clientNum , "ps.stats" , 4 , MAX_HEALTH )
end

Itā€™s working all classes could have 140 HP but eng, or other classes (except med) when they are respawing they have 100 HP, when they take med pack of course they have 140 HP.

I want to set 140 HP from beginingā€¦I mean when ppl is respawning he has immediately 140 HP.


(Micha) #8

local MAX_HEALTH = 140 -- Change your max health here.

function et_ClientSpawn( clientNum, revived, teamChange, restoreHealth )
    et.gentity_set( clientNum , "ps.stats" , 4 , MAX_HEALTH )
et.gentity_set( clientNum , "health" , MAX_HEALTH )
end


(Kaco123) #9

Itā€™s working. Thanks