I made a simple HUD script to replace the default one, but don't know where to add it so it shows wherever you are in the level/game.
The script itself works fine if I attach it to an object at the start of the level, but as soon as I move out of range of the object the script stops and disappears. The LUA itself is quite simple (see below)
So, is there a 'global' object I can attach this to, so it shows everywhere on the level, or do I need to place it in a particular initiation script?
Any help would be appreciated.
LUA:
function custommarshud_init(e)
HideHuds()
CO2 = 102
O2 = 0
end
function custommarshud_main(e)
Panel(1,1,20,17)
Text(3,2,6,"Health")
Text(3,7,6,"CO2")
Text(3,11,6,"O2")
Text(11,2,6,": "..math.floor(g_PlayerHealth).."%")
Text(11,7,6,": "..math.floor(CO2).."%")
Text(11,11,6,": "..math.floor(O2).."%")
if CO2 >= 0 then
CO2 = CO2 - .005
else
HurtPlayer(e,g_PlayerHealth)
CO2 = 100
O2 = 0
end
if math.floor(g_PlayerHealth) <= 90 then
O2 = O2 + .015
if O2 >= 100 then
HurtPlayer(e,g_PlayerHealth)
CO2 = 100
O2 = 0
end
end
end
The author of this post has marked a post as an answer.
Go to answer