
Originally Posted by
DjTranceFire
Are you sure this menu part is from cod4?
Or did i have to add it to hud.menu?
If yes, what is the right place to add it?
I think it has to be inside a menudef?
Yes: I am sure it is for COD4. It is code from a mod I did. And yes: you have to add it to a menu item in hud.menu. Pick one that places it in more-or-less the right place, and then tweak the positioning. I placed mine in the low health menu item:
Code:
// Low health overlay
menuDef
{
name "Low Health"
rect 0 0 640 480 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN
fullScreen 0
visible 1
itemDef
{
name "healthoverlay"
rect 0 0 640 480
forecolor 1 1 1 1
background "overlay_low_health"
ownerdraw CG_PLAYER_LOW_HEALTH_OVERLAY
visible 1
decoration
}
// HEALTH BAR
itemDef
{
name "healthbarback"
rect 6 471 124 6
forecolor 0.7 0.7 0.7 0.3
background "white"
ownerdraw CG_PLAYER_BAR_HEALTH_BACK
visible when( !dvarInt( "wideScreen" ) && !flashbanged() && !ui_active() && NOT_SPECTATING && team( name ) != "TEAM_SPECTATOR" );
decoration
}
itemDef
{
name "healthbar"
rect 7 472 122 4
forecolor 0.7 0.4 0.0 0.3
background "white"
ownerdraw CG_PLAYER_BAR_HEALTH
visible when( !dvarInt( "wideScreen" ) && !flashbanged() && !ui_active() && NOT_SPECTATING && team( name ) != "TEAM_SPECTATOR" );
decoration
}
itemDef
{
name "healthbarcross"
rect 132 467 12 12
forecolor 1.0 1.0 1.0 0.3
background "hud_healthbar_cross"
ownerdraw CG_PLAYER_BAR_HEALTH_BACK
visible when( !dvarInt( "wideScreen" ) && !flashbanged() && !ui_active() && NOT_SPECTATING && team( name ) != "TEAM_SPECTATOR" );
decoration
}
// HEALTH BAR WIDESCREEN
itemDef
{
name "healthbarback"
rect 5 471 93 6
forecolor 0.7 0.7 0.7 0.3
background "white"
ownerdraw CG_PLAYER_BAR_HEALTH_BACK
visible when( dvarInt( "wideScreen" ) && !flashbanged() && !ui_active() && NOT_SPECTATING && team( name ) != "TEAM_SPECTATOR" );
decoration
}
itemDef
{
name "healthbar"
rect 6 472 91 4
forecolor 0.7 0.4 0.0 0.3
background "white"
ownerdraw CG_PLAYER_BAR_HEALTH
visible when( dvarInt( "wideScreen" ) && !flashbanged() && !ui_active() && NOT_SPECTATING && team( name ) != "TEAM_SPECTATOR" );
decoration
}
itemDef
{
name "healthbarcross"
rect 99 467 9 12
forecolor 1.0 1.0 1.0 0.3
background "hud_healthbar_cross"
ownerdraw CG_PLAYER_BAR_HEALTH_BACK
visible when( dvarInt( "wideScreen" ) && !flashbanged() && !ui_active() && NOT_SPECTATING && team( name ) != "TEAM_SPECTATOR" );
decoration
}
}
The health bar has been in all COD games. It is just that it isn't used from COD2 onwards. But the engine facilities to make it work are in there, and always have been. There is no point creating complex hud elements when all it takes is a couple of lines of code in the right menu.