VGUI Health bar: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(Rewrite Template:Lang to Template:LanguageBar. This action was performed by a bot.)
 
(30 intermediate revisions by 15 users not shown)
Line 1: Line 1:
==VGUI health bar==
{{LanguageBar}}
Well the VGUI Image Progress bar didn't help me mutch because i had problems with updating the Health bar.Buti found on a one russian website a Russian tutorial on how to make a VGUI Health Bar.This tutorial is purely a '''Copy N Paste''' tutorial.And it works on both EP1 and OB engines.
 
[[File:Health Bar.png|thumb]]
==Overview==
This tutorial will show you how to make a [[VGUI]] [[Health]] Bar implementation. This is a simple copy and paste tutorial that works out of the box for the 2013 SDK


==Code==
==Code==
First create a '''hud_hull.cpp''' in your CLIENT part your code.And paste this to hud_hull.cpp
First create '''hud_healthbar.cpp''' and '''hud_healthbar.h''' in your CLIENT project then paste this stuff into them:
<code>
# include "cbase.h"
 
#include "hud.h" # include "hud.h"
 
#include " hud_hull .h" # include "hud_hull. h"
 
#include "hud_macros.h" # include "hud_macros.h"
 
#include "c_sdk_player.h" # include "c_sdk_player.h"
 
#include "iclientmode.h" # include "iclientmode.h"
 
#include # include #include # include #include # include using namespace vgui; using namespace vgui;
 
#include "tier0/memdbgon.h" # include "tier0/memdbgon.h"
 
DECLARE_HUDELEMENT( CHudHull ); DECLARE_HUDELEMENT (CHudHull);
 
#define HULL_INIT 80 # define HULL_INIT 80
 
//------------------------------------------------------------------------ //------------------------------------------------ ------------------------
 
// Purpose: Constructor / / Purpose: Constructor
 
//------------------------------------------------------------------------ //------------------------------------------------ ------------------------
 
CHudHull::CHudHull( const char *pElementName ) : CHudElement( pElementName ), BaseClass( NULL, "HudHull" ) CHudHull:: CHudHull (const char * pElementName): CHudElement (pElementName), BaseClass (NULL, "HudHull")
 
{ (
 
vgui::Panel *pParent = g_pClientMode->GetViewport(); vgui:: Panel * pParent = g_pClientMode-> GetViewport ();
 
SetParent( pParent ); SetParent (pParent);
 
SetHiddenBits( HIDEHUD_HEALTH | HIDEHUD_PLAYERDEAD | HIDEHUD_NEEDSUIT ); SetHiddenBits (HIDEHUD_HEALTH | HIDEHUD_PLAYERDEAD | HIDEHUD_NEEDSUIT);
 
} )
 
//------------------------------------------------------------------------ //------------------------------------------------ ------------------------
 
// Purpose: / / Purpose:
 
//------------------------------------------------------------------------ //------------------------------------------------ ------------------------
 
void CHudHull::Init( void ) void CHudHull:: Init (void)
 
{ (
 
m_flHull = HULL_INIT; m_flHull = HULL_INIT;
 
m_nHullLow = -1; m_nHullLow = -1;
 
SetBgColor(Color(0,0,0,128)); SetBgColor (Color (0,0,0,128));
 
} )
 
//------------------------------------------------------------------------ //------------------------------------------------ ------------------------
 
// Purpose: / / Purpose:
 
//----------------------------------------------------------------------- //------------------------------------------------ -----------------------
 
void CHudHull::Reset( void ) void CHudHull:: Reset (void)
 
{ (
 
Init(); Init ();
 
} )
 
 
//------------------------------------------------------------------------ //------------------------------------------------ ------------------------
 
// Purpose: / / Purpose:
 
//------------------------------------------------------------------------ //------------------------------------------------ ------------------------
 
void CHudHull::OnThink( void ) void CHudHull:: OnThink (void)
 
{ (
 
float newHull = 0; float newHull = 0;
 
C_BasePlayer *local = C_BasePlayer::GetLocalPlayer(); C_BasePlayer * local = C_BasePlayer:: GetLocalPlayer ();
 
if ( !local ) if (! local)
 
return;
 
// Never below zero / / Never below zero
 
// newHull = local->GetHull(); / / NewHull = local-> GetHull ();
newHull = local->GetHealth(); newHull = local-> GetHealth ();
 
//DevMsg("Sheild at is at: %f\n",newShield); / / DevMsg ( "Sheild at is at:% f \ n", newShield);
 
// Only update the fade if we've changed health / / Only update the fade if we've changed health
 
if ( newHull == m_flHull ) if (newHull == m_flHull)
 
{ (
 
return;
 
} )
 
m_flHull = newHull; m_flHull = newHull;
 
} )
 
 
 
//------------------------------------------------------------------------ //------------------------------------------------ ------------------------
 
// Purpose: draws the power bar / / Purpose: draws the power bar
 
//------------------------------------------------------------------------ //------------------------------------------------ ------------------------
 
void CHudHull::Paint() void CHudHull:: Paint ()
 
{ (
 
// get bar chunks / / Get bar chunks
 
int chunkCount = m_flBarWidth / (m_flBarChunkWidth + m_flBarChunkGap); int chunkCount = m_flBarWidth / (m_flBarChunkWidth + m_flBarChunkGap);
 
int enabledChunks = (int)((float)chunkCount * (m_flHull / 100.0f) + 0.5f ); int enabledChunks = (int) ((float) chunkCount * (m_flHull / 100.0f) + 0.5f);
 
// draw the suit power bar / / Draw the suit power bar
 
surface()->DrawSetColor( m_HullColor ); surface () -> DrawSetColor (m_HullColor);
 
int xpos = m_flBarInsetX, ypos = m_flBarInsetY; int xpos = m_flBarInsetX, ypos = m_flBarInsetY;
 
{for (int i = 0; i < enabledChunks; i++) (for (int i = 0; i <enabledChunks; i + +)
 
{ (
 
surface()->DrawFilledRect( xpos, ypos, xpos + m_flBarChunkWidth, ypos + m_flBarHeight ); surface () -> DrawFilledRect (xpos, ypos, xpos + m_flBarChunkWidth, ypos + m_flBarHeight);
 
xpos += (m_flBarChunkWidth + m_flBarChunkGap); xpos + = (m_flBarChunkWidth + m_flBarChunkGap);
 
}} ))
 
// draw the exhausted portion of the bar. / / Draw the exhausted portion of the bar.
 
surface()->DrawSetColor( Color( m_HullColor[0], m_HullColor[1], m_HullColor[2], m_iHullDisabledAlpha ) ); surface () -> DrawSetColor (Color (m_HullColor [0], m_HullColor [1], m_HullColor [2], m_iHullDisabledAlpha));
 
{for (int i = enabledChunks; i < chunkCount; i++) (for (int i = enabledChunks; i <chunkCount; i + +)
 
{ (
 
surface()->DrawFilledRect( xpos, ypos, xpos + m_flBarChunkWidth, ypos + m_flBarHeight ); surface () -> DrawFilledRect (xpos, ypos, xpos + m_flBarChunkWidth, ypos + m_flBarHeight);
 
xpos += (m_flBarChunkWidth + m_flBarChunkGap); xpos + = (m_flBarChunkWidth + m_flBarChunkGap);
 
}} ))
 
// draw our name / / Draw our name
 
surface()->DrawSetTextFont(m_hTextFont); surface () -> DrawSetTextFont (m_hTextFont);
 
surface()->DrawSetTextColor(m_HullColor); surface () -> DrawSetTextColor (m_HullColor);
 
surface()->DrawSetTextPos(text_xpos, text_ypos); surface () -> DrawSetTextPos (text_xpos, text_ypos);
 
//wchar_t *tempString = vgui::localize()->Find("#Valve_Hud_AUX_POWER"); / / wchar_t * tempString = vgui:: localize () -> Find ( "# Valve_Hud_AUX_POWER");
 
 
surface()->DrawPrintText(L"HULL", wcslen(L"HULL")); surface () -> DrawPrintText (L "HULL", wcslen (L "HULL"));
 
} )
</code>
 
==Then make a hud_hull.h file and put this in it==
<code>
# if! defined (HUD_HULL_H)
 
#define HUD_HULL_H # define HUD_HULL_H
 
#ifdef _WIN32 # ifdef _WIN32
 
#pragma once # pragma once
 
#endif # endif
 
#include "hudelement.h" # include "hudelement.h"
 
#include "hud_numericdisplay.h" # include "hud_numericdisplay.h"


#include # include //----------------------------------------------------------------------------- //------------------------------------------------ -----------------------------
==hudhealthbar.cpp==
<source lang="cpp">
#include "cbase.h"
#include "hud.h"
#include "hud_macros.h"
#include "c_baseplayer.h"
#include "hudhealthbar.h"
#include "iclientmode.h"
#include "vgui/ISurface.h"


// Purpose: Shows the hull bar / / Purpose: Shows the hull bar
using namespace vgui;


//----------------------------------------------------------------------------- //------------------------------------------------ -----------------------------
#include "tier0/memdbgon.h"


class CHudHull : public CHudElement, public vgui::Panel class CHudHull: public CHudElement, public vgui:: Panel
DECLARE_HUDELEMENT (CHudHealthbar);


{ (
# define HULL_INIT 80


DECLARE_CLASS_SIMPLE( CHudHull, vgui::Panel ); DECLARE_CLASS_SIMPLE (CHudHull, vgui:: Panel);
//------------------------------------------------------------------------
// Purpose: Constructor
//------------------------------------------------------------------------


public:  
CHudHealthbar:: CHudHealthbar (const char * pElementName) :
CHudElement (pElementName), BaseClass (NULL, "HudHealthbar")
{
vgui:: Panel * pParent = g_pClientMode-> GetViewport ();
SetParent (pParent);


CHudHull( const char *pElementName ); CHudHull (const char * pElementName);  
SetHiddenBits (HIDEHUD_HEALTH | HIDEHUD_PLAYERDEAD | HIDEHUD_NEEDSUIT);
}


virtual void Init( void ); virtual void Init (void);
//------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------


virtual void Reset( void ); virtual void Reset (void);  
void CHudHealthbar:: Init()
{
Reset();
}


virtual void OnThink( void ); virtual void OnThink (void);
//------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------


protected:  
void CHudHealthbar:: Reset (void)
{
m_flHull = HULL_INIT;
m_nHullLow = -1;
SetBgColor (Color (0,0,0,128));
}


virtual void Paint(); virtual void Paint ();


private:  
//------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------


CPanelAnimationVar( Color, m_HullColor, "HullColor", "255 0 0 255" ); CPanelAnimationVar (Color, m_HullColor, "HullColor", "255 0 0 255");  
void CHudHealthbar:: OnThink (void)
{
float newHull = 0;
C_BasePlayer * local = C_BasePlayer:: GetLocalPlayer ();


CPanelAnimationVar( int, m_iHullDisabledAlpha, "HullDisabledAlpha", "50" ); CPanelAnimationVar (int, m_iHullDisabledAlpha, "HullDisabledAlpha", "50");  
if (!local)
return;


CPanelAnimationVarAliasType( float, m_flBarInsetX, "BarInsetX", "26", "proportional_float" ); CPanelAnimationVarAliasType (float, m_flBarInsetX, "BarInsetX", "26", "proportional_float");  
// Never below zero
newHull = max(local->GetHealth(), 0);


CPanelAnimationVarAliasType( float, m_flBarInsetY, "BarInsetY", "3", "proportional_float" ); CPanelAnimationVarAliasType (float, m_flBarInsetY, "BarInsetY", "3", "proportional_float");  
// DevMsg("Sheild at is at: %f\n",newShield);
// Only update the fade if we've changed health
if (newHull == m_flHull)
return;


CPanelAnimationVarAliasType( float, m_flBarWidth, "BarWidth", "84", "proportional_float" ); CPanelAnimationVarAliasType (float, m_flBarWidth, "BarWidth", "84", "proportional_float");  
m_flHull = newHull;
}


CPanelAnimationVarAliasType( float, m_flBarHeight, "BarHeight", "4", "proportional_float" ); CPanelAnimationVarAliasType (float, m_flBarHeight, "BarHeight", "4", "proportional_float");


CPanelAnimationVarAliasType( float, m_flBarChunkWidth, "BarChunkWidth", "2", "proportional_float" ); CPanelAnimationVarAliasType (float, m_flBarChunkWidth, "BarChunkWidth", "2", "proportional_float");
//------------------------------------------------------------------------
// Purpose: draws the power bar
//------------------------------------------------------------------------


CPanelAnimationVarAliasType( float, m_flBarChunkGap, "BarChunkGap", "1", "proportional_float" ); CPanelAnimationVarAliasType (float, m_flBarChunkGap, "BarChunkGap", "1", "proportional_float");
void CHudHealthbar::Paint()
{
// Get bar chunks


CPanelAnimationVar( vgui::HFont, m_hTextFont, "TextFont", "HUDBarText" ); CPanelAnimationVar (vgui:: HFont, m_hTextFont, "TextFont", "HUDBarText");  
int chunkCount = m_flBarWidth / (m_flBarChunkWidth + m_flBarChunkGap);
int enabledChunks = (int)((float)chunkCount * (m_flHull / 100.0f) + 0.5f );


CPanelAnimationVarAliasType( float, text_xpos, "text_xpos", "2", "proportional_float" ); CPanelAnimationVarAliasType (float, text_xpos, "text_xpos", "2", "proportional_float");  
// Draw the suit power bar
surface()->DrawSetColor (m_HullColor);


CPanelAnimationVarAliasType( float, text_ypos, "text_ypos", "2", "proportional_float" ); CPanelAnimationVarAliasType (float, text_ypos, "text_ypos", "2", "proportional_float");  
int xpos = m_flBarInsetX, ypos = m_flBarInsetY;


CPanelAnimationVarAliasType( float, text2_xpos, "text2_xpos", "8", "proportional_float" ); CPanelAnimationVarAliasType (float, text2_xpos, "text2_xpos", "8", "proportional_float");  
for (int i = 0; i < enabledChunks; i++)
{
surface()->DrawFilledRect(xpos, ypos, xpos + m_flBarChunkWidth, ypos + m_flBarHeight);
xpos += (m_flBarChunkWidth + m_flBarChunkGap);
}


CPanelAnimationVarAliasType( float, text2_ypos, "text2_ypos", "40", "proportional_float" ); CPanelAnimationVarAliasType (float, text2_ypos, "text2_ypos", "40", "proportional_float");  
// Draw the exhausted portion of the bar.
surface()->DrawSetColor(Color(m_HullColor [0], m_HullColor [1], m_HullColor [2], m_iHullDisabledAlpha));


CPanelAnimationVarAliasType( float, text2_gap, "text2_gap", "10", "proportional_float" ); CPanelAnimationVarAliasType (float, text2_gap, "text2_gap", "10", "proportional_float");  
for (int i = enabledChunks; i < chunkCount; i++)
{
surface()->DrawFilledRect(xpos, ypos, xpos + m_flBarChunkWidth, ypos + m_flBarHeight);
xpos += (m_flBarChunkWidth + m_flBarChunkGap);
}


float m_flHull; float m_flHull;
// Draw our name


int m_nHullLow; int m_nHullLow;  
surface()->DrawSetTextFont(m_hTextFont);
surface()->DrawSetTextColor(m_HullColor);
surface()->DrawSetTextPos(text_xpos, text_ypos);


}; );  
//wchar_t *tempString = vgui::localize()->Find("#Valve_Hud_AUX_POWER");


#endif // HUD_SUITPOWER_H # endif / / HUD_SUITPOWER_H
surface()->DrawPrintText(L"HULL", wcslen(L"HULL"));
</code>
}
</source>


==Then put this in HudLayout.res==
==hudhealthbar.h==
<source lang="cpp">
#if !defined HUD_HULL_H
#define HUD_HULL_H


HudHull
#ifdef _WIN32
#pragma once
#endif


{ (
#include "hudelement.h"
#include "hud_numericdisplay.h"


"fieldName" "HudHull" "fieldName" "HudHull"
//-----------------------------------------------------------------------------
// Purpose: Shows the hull bar
//-----------------------------------------------------------------------------


"visible" "1" "visible" "1"
class CHudHealthbar : public CHudElement, public vgui::Panel
{


"enabled" "1" "enabled" "1"
DECLARE_CLASS_SIMPLE(CHudHealthbar, vgui::Panel);


"xpos" "12" "xpos" "12"
public:
CHudHealthbar(const char * pElementName);


"ypos" "420" "ypos" "420"
virtual void Init(void);
virtual void Reset(void);
virtual void OnThink(void);


"wide" "120" "wide" "120"
protected:
virtual void Paint();


"tall" "10" "tall" "10"  
private:
CPanelAnimationVar(Color, m_HullColor, "HullColor", "255 0 0 255");
CPanelAnimationVar(int, m_iHullDisabledAlpha, "HullDisabledAlpha", "50");
CPanelAnimationVarAliasType(float, m_flBarInsetX, "BarInsetX", "26", "proportional_float");
CPanelAnimationVarAliasType(float, m_flBarInsetY, "BarInsetY", "3", "proportional_float");
CPanelAnimationVarAliasType(float, m_flBarWidth, "BarWidth", "84", "proportional_float");
CPanelAnimationVarAliasType(float, m_flBarHeight, "BarHeight", "4", "proportional_float");
CPanelAnimationVarAliasType(float, m_flBarChunkWidth, "BarChunkWidth", "2", "proportional_float");
CPanelAnimationVarAliasType(float, m_flBarChunkGap, "BarChunkGap", "1", "proportional_float");
CPanelAnimationVar(vgui::HFont, m_hTextFont, "TextFont", "HUDBarText");
CPanelAnimationVarAliasType(float, text_xpos, "text_xpos", "2", "proportional_float");
CPanelAnimationVarAliasType(float, text_ypos, "text_ypos", "2", "proportional_float");
CPanelAnimationVarAliasType(float, text2_xpos, "text2_xpos", "8", "proportional_float");
CPanelAnimationVarAliasType(float, text2_ypos, "text2_ypos", "40", "proportional_float");
CPanelAnimationVarAliasType(float, text2_gap, "text2_gap", "10", "proportional_float");
float m_flHull;
int m_nHullLow;


"text_xpos" "5" "text_xpos" "5"
};


"text_ypos" "2" "text_ypos" "2"
#endif // HUD_SUITPOWER_H
</source>


"TextColor" "0 255 0 80" "TextColor" "0 255 0 80"
==HudLayout.res==
Now add this to your '''HudLayout.res''' file in the '''scripts''' folder, located in your mod directory, at the bottom of all the other entries:
<pre>
    HudHealthbar
    {


"PaintBackgroundType" "2" "PaintBackgroundType" "2"  
    "fieldName" "CHudHealthBar"
    "visible" "1"
    "enabled" "1"
    "xpos" "12"
    "ypos" "420"
    "wide" "120"
    "tall" "10"
    "text_xpos" "5"
    "text_ypos" "2"
    "TextColor" "0 255 0 80"
    "PaintBackgroundType" "2"


} )
    }
[[Category:Programming]] [[Category:VGUI]]
</pre>

Latest revision as of 17:42, 18 July 2025

English (en)Español (es)Русский (ru)Українська (uk)Translate (Translate)
Health Bar.png

Overview

This tutorial will show you how to make a VGUI Health Bar implementation. This is a simple copy and paste tutorial that works out of the box for the 2013 SDK

Code

First create hud_healthbar.cpp and hud_healthbar.h in your CLIENT project then paste this stuff into them:

hudhealthbar.cpp

#include "cbase.h" 
#include "hud.h" 
#include "hud_macros.h" 
#include "c_baseplayer.h" 
#include "hudhealthbar.h" 
#include "iclientmode.h" 
#include "vgui/ISurface.h"

using namespace vgui;

#include "tier0/memdbgon.h" 

DECLARE_HUDELEMENT (CHudHealthbar);

# define HULL_INIT 80 

//------------------------------------------------------------------------
// Purpose: Constructor
//------------------------------------------------------------------------

CHudHealthbar:: CHudHealthbar (const char * pElementName) : 
	CHudElement (pElementName), BaseClass (NULL, "HudHealthbar")
{
	vgui:: Panel * pParent = g_pClientMode-> GetViewport ();
	SetParent (pParent);

	SetHiddenBits (HIDEHUD_HEALTH | HIDEHUD_PLAYERDEAD | HIDEHUD_NEEDSUIT);
}

//------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------

void CHudHealthbar:: Init()
{
	Reset();
}

//------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------

void CHudHealthbar:: Reset (void)
{
	m_flHull = HULL_INIT;
	m_nHullLow = -1;
	SetBgColor (Color (0,0,0,128));
}


//------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------

void CHudHealthbar:: OnThink (void)
{
	float newHull = 0;
	C_BasePlayer * local = C_BasePlayer:: GetLocalPlayer ();

	if (!local)
		return;

	// Never below zero 
	newHull = max(local->GetHealth(), 0);

	// DevMsg("Sheild at is at: %f\n",newShield);
	// Only update the fade if we've changed health
	if (newHull == m_flHull)
		return;

	m_flHull = newHull;
}


//------------------------------------------------------------------------
// Purpose: draws the power bar
//------------------------------------------------------------------------

void CHudHealthbar::Paint()
{
	// Get bar chunks

	int chunkCount = m_flBarWidth / (m_flBarChunkWidth + m_flBarChunkGap);
	int enabledChunks = (int)((float)chunkCount * (m_flHull / 100.0f) + 0.5f );

	// Draw the suit power bar
	surface()->DrawSetColor (m_HullColor);

	int xpos = m_flBarInsetX, ypos = m_flBarInsetY;

	for (int i = 0; i < enabledChunks; i++)
	{
		surface()->DrawFilledRect(xpos, ypos, xpos + m_flBarChunkWidth, ypos + m_flBarHeight);
		xpos += (m_flBarChunkWidth + m_flBarChunkGap);
	}

	// Draw the exhausted portion of the bar.
	surface()->DrawSetColor(Color(m_HullColor [0], m_HullColor [1], m_HullColor [2], m_iHullDisabledAlpha));

	for (int i = enabledChunks; i < chunkCount; i++)
	{
		surface()->DrawFilledRect(xpos, ypos, xpos + m_flBarChunkWidth, ypos + m_flBarHeight);
		xpos += (m_flBarChunkWidth + m_flBarChunkGap);
	}

	// Draw our name

	surface()->DrawSetTextFont(m_hTextFont);
	surface()->DrawSetTextColor(m_HullColor);
	surface()->DrawSetTextPos(text_xpos, text_ypos);

	//wchar_t *tempString = vgui::localize()->Find("#Valve_Hud_AUX_POWER");

	surface()->DrawPrintText(L"HULL", wcslen(L"HULL"));
}

hudhealthbar.h

#if !defined HUD_HULL_H
#define HUD_HULL_H 

#ifdef _WIN32
#pragma once
#endif

#include "hudelement.h"
#include "hud_numericdisplay.h"

//-----------------------------------------------------------------------------
// Purpose: Shows the hull bar
//-----------------------------------------------------------------------------

class CHudHealthbar : public CHudElement, public vgui::Panel
{

	DECLARE_CLASS_SIMPLE(CHudHealthbar, vgui::Panel);

public:
	CHudHealthbar(const char * pElementName);

	virtual void Init(void);
	virtual void Reset(void);
	virtual void OnThink(void);

protected:
	virtual void Paint();

private:
	CPanelAnimationVar(Color, m_HullColor, "HullColor", "255 0 0 255");
	CPanelAnimationVar(int, m_iHullDisabledAlpha, "HullDisabledAlpha", "50");
	CPanelAnimationVarAliasType(float, m_flBarInsetX, "BarInsetX", "26", "proportional_float");
	CPanelAnimationVarAliasType(float, m_flBarInsetY, "BarInsetY", "3", "proportional_float");
	CPanelAnimationVarAliasType(float, m_flBarWidth, "BarWidth", "84", "proportional_float");
	CPanelAnimationVarAliasType(float, m_flBarHeight, "BarHeight", "4", "proportional_float");
	CPanelAnimationVarAliasType(float, m_flBarChunkWidth, "BarChunkWidth", "2", "proportional_float");
	CPanelAnimationVarAliasType(float, m_flBarChunkGap, "BarChunkGap", "1", "proportional_float");
	CPanelAnimationVar(vgui::HFont, m_hTextFont, "TextFont", "HUDBarText");
	CPanelAnimationVarAliasType(float, text_xpos, "text_xpos", "2", "proportional_float");
	CPanelAnimationVarAliasType(float, text_ypos, "text_ypos", "2", "proportional_float");
	CPanelAnimationVarAliasType(float, text2_xpos, "text2_xpos", "8", "proportional_float");
	CPanelAnimationVarAliasType(float, text2_ypos, "text2_ypos", "40", "proportional_float");
	CPanelAnimationVarAliasType(float, text2_gap, "text2_gap", "10", "proportional_float");
	float m_flHull;
	int m_nHullLow;

};

#endif // HUD_SUITPOWER_H

HudLayout.res

Now add this to your HudLayout.res file in the scripts folder, located in your mod directory, at the bottom of all the other entries:

    HudHealthbar
    {

    "fieldName" "CHudHealthBar"
    "visible" "1"
    "enabled" "1"
    "xpos" "12"
    "ypos" "420"
    "wide" "120"
    "tall" "10"
    "text_xpos" "5"
    "text_ypos" "2"
    "TextColor" "0 255 0 80"
    "PaintBackgroundType" "2"

    }