hi, I'm currently learning how to replace the game HUD with my own custom HUD using flash scaleform.
here's MyGameInfo.uc :
Here's my PTGameHUD.uc :
and here's my PTSTGFxHUD.uc :
when I compiled it, no errors at all. But, when I changed the WorldInfo to MyGameInfo and play in editor, the HUD won't show up.
When I remove these lines :
, The HUD shows....
I'm stuck here and I can't move anywhere without solving this problem. THX before for any help
here's MyGameInfo.uc :
Code:
class MyGameInfo extends UTGame; DefaultProperties { PlayerControllerClass=class'PT3rdPersonController' DefaultPawnClass=class'PT3rdPersonView' HUDType=class'PTGameHUD' bUseClassicHUD=true bScoreDeaths=false; }
Code:
class PTGameHUDextends UTHUDBase; /*reference to the swf file*/ var PTSTGFxHUD HUDMovie; singular event Destroyed() { if (HUDMovie != none) { HUDMovie.Close(true); HUDMovie = none; } Destroy(); } simulated function PostBeginPlay() { super.PostBeginPlay(); `log("initiating HUDmovie !!"); HUDMovie = new class'PTSTGFxHUD'; HUDMovie.SetTimingMode(TM_Real); HUDMovie.Init(); } event PostRender() { HUDMovie.TickHUD(); }
Code:
class PTSTGFxHUD extends GFxMoviePlayer; var float LastHealth, MaxHealthBarWidth; var GFxObject HealthBarMC, HealthPercent, Crosshair; function int RoundNum(float num) { local int iNum; local float fNum; fNum = num; iNum = int(fNum); fNum -= iNum; 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 Init(optional LocalPlayer LP) { Start(); Advance(0.f); LastHealth = -1337; HealthBarMC = GetVariableObject("_root").GetObject("HealthBar"); MaxHealthBarWidth = HealthBarMC.GetFloat("_width"); Crosshair = GetVariableObject("_root").GetObject("Crosshair"); `log("HUD:"@HealthBarMC@Crosshair@MaxHealthBarWidth); } function TickHUD() { local PT3rdPersonController PC; local PT3rdPersonView ThePawn; PC = PT3rdPersonController(GetPC()); ThePawn = PT3rdPersonView(PC.Pawn); if (ThePawn == none) { `log("no pawn found !!"); return; } `log("pawn found!!"); if (LastHealth != GetPercentage(ThePawn.Health, ThePawn.HealthMax)) { LastHealth = GetPercentage(ThePawn.Health, ThePawn.HealthMax); HealthBarMC.SetFloat("_width", LastHealth/100.0f * MaxHealthBarWidth); } } defaultproperties { bAutoPlay=true bDisplayWithHudOff=false MovieInfo=SwfMovie'ProtoTrainerUI.Sample_GameHUD.PT_Sample_GameHUD' }
When I remove these lines :
Code:
PlayerControllerClass=class'PT3rdPersonController' DefaultPawnClass=class'PT3rdPersonView'
I'm stuck here and I can't move anywhere without solving this problem. THX before for any help
Comment