Having issues with my Base Hud. Can't get it to pull the players health, and so far I keep getting a scriptwarning: accessed none 'PlayerOwner'
Anyone any ideas? This has been driving me mental the last 3 hours.
GGJHud.uc
GGJMoviePlayer
Cheers,
- Sythen.
Anyone any ideas? This has been driving me mental the last 3 hours.
GGJHud.uc
Code:
class GGJHud extends HUD; var GGJMoviePlayer HudMovie; var GGJPlayerController myPC; simulated function PostBeginPlay() { myPC = GGJPlayerController(PlayerOwner); HudMovie = new class'GGJMoviePlayer'; HudMovie.SetTimingMode(TM_Real); HudMovie.Initialize(myPC); } defaultproperties { }
Code:
class GGJMoviePlayer extends GFxMoviePlayer; var float LastHealthpc; var GFxObject HealthTF; function int roundNum(float NumIn) { local int iNum; local float fNum; fNum = NumIn; iNuM = int(fNum); if(fNum >= 0.5f) { return (iNum + 1); } else { return iNum; } } function int getPercentage(int val, int max) { return roundNum((float(val) / float(max)) * 100.0f); } function bool Initialize(optional GGJPlayerController PC) { Start(); Advance(0.f); LastHealthpc = -1337; HealthTF = GetVariableObject("_root.healthTF"); return true; } function TickHUD() { local GGJPawn UTP; UTP = GGJPawn(GetPC().Pawn); if(UTP == None) return; if(LastHealthpc != getPercentage(UTP.Health,UTP.HealthMax)) { LastHealthpc = getPercentage(UTP.Health,UTP.HealthMax); HealthTF.SetString("text", round(LastHealthpc)$"%"); } } defaultproperties { MovieInfo=SwfMovie'GGJ-Hud.GGJHud' }
- Sythen.
Comment