Help with HUD
Posted: Mon Nov 12, 2007 1:13 pm
Hi guys, trying to get a a working health bar for my player pawn. Sorry for the repost, but doesn't like anyone's reading or responding to my older thread anymore. I took Juutis's advice and used the built in players health bar. I sinchronised the player pawn and built in players health with the following bit of code, and set the health attribute to the same as my pawns in player.ini. However, if my player pawn gets hit once, he is still alive, but the health bar is reduced to 0. Any ideas on how to correct this?
HEALTHATTRIB [healthgood]
PAWNHEALTH [self.health]
if(self.in_pain)
{
self.think="Pain";
}
}]
Pain[()
{
SetAttribute(HEALTHATTRIB,PAWNHEALTH,"Player");
self.think="Fight";
}
}]
Here's a copy of the health attribute code in the player.ini
[healthgood]
type = horizontal
frame = hud\hud_health_oxygen.bmp
framealpha = hud\a_hud_health.bmp
indicator = hud\hud_health_oxygeni.bmp
indicatoralpha = hud\a_hud_healthi.bmp
framex = 10
framey = 10
indicatoroffsetx = 75
indicatoroffsety = 0
indicatorwidth = 160
active = true
HEALTHATTRIB [healthgood]
PAWNHEALTH [self.health]
if(self.in_pain)
{
self.think="Pain";
}
}]
Pain[()
{
SetAttribute(HEALTHATTRIB,PAWNHEALTH,"Player");
self.think="Fight";
}
}]
Here's a copy of the health attribute code in the player.ini
[healthgood]
type = horizontal
frame = hud\hud_health_oxygen.bmp
framealpha = hud\a_hud_health.bmp
indicator = hud\hud_health_oxygeni.bmp
indicatoralpha = hud\a_hud_healthi.bmp
framex = 10
framey = 10
indicatoroffsetx = 75
indicatoroffsety = 0
indicatorwidth = 160
active = true