[updated]
My mistake, my first reply is for an entity's health, not the player. sorry.
Most of the Players settings are still hardcoded, so we don't have them in lua yet.
So on the stock players health hud image its has
100 | 100
which is represented by...
g_PlayerHealth | Players health value, as set in the players start marker.
Hopefully I have not mislead you again..
I haven't made a player health hud yet, so It looks like ill do it now as well.
Quote: "When I throw out a mob that kills me I respawn with 100 health"
when you respawn the health is set as per the Players health value, as set in the players start marker.
function plyexample_init(e)
--locationImage = LoadImage ( "scriptbank\\images\\Healthbar.png" )
--mySprite = CreateSprite(locationImage)
--SetSpritePosition(mySprite,0,0)
--SetSpriteSize(mySprite,15,3)
SetPlayerHealth(1000)
startingHealth = g_PlayerHealth -- = 1000 as set above only set once on first start up
maxHealth = 1000 -- So you have to manually match this value to the Players health value as set in the players start marker.
end
function plyexample_main(e)
-- player has died, reset his health, workaround
scaleHealth = (g_PlayerHealth / maxHealth)
--SetSpriteSize(mySprite,scaleHealth*15,3)
Prompt("Health= "..scaleHealth)
end
Desktop: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 CPUs), ~3.6GHz, Windows 8.1 64-bit, 16 GB Ram, NVIDIA GeForce GTX 750 Ti, Display Memory: 4018 MB. Resolution 1360x768, Passmark 3528.
Laptop: Pavilion dv6 Notebook, Intel(R) Core(TM) i5-2410M CPU @ 2.30 GHz, Win 7 64 bit, 16 GB Ram, Radeon (TM) HD 6490M, 2336 MB Memory. Resolution 1366x768, Intel(R) HD Graphics 3000. (WEI 5.8)