So i have been trying to get a GFx HUD to work for two or three months now. I've watched all of the Scaleform tutorial videos a few times now and I am just not sure what I am doing wrong. The HUD shows up but it does not update to my current health or display the ammount of I have ammo.
Code:class ZomHUD_Base extends UDKHUD; var ZomHUD HudMovie; //Handles death singular event Destroyed() { if (HudMovie != none) { HudMovie.Close(true); HudMovie = none; } super.Destroyed(); } simulated function PostBeginPlay() { super.PostBeginPlay(); CreateHUD(); } function CreateHUD() { HudMovie = new class'ZomHUD'; HudMovie.SetTimingMode(TM_Real); HudMovie.Init(class'Engine'.static.GetEngine().GamePlayers[HudMovie.LocalPlayerOwnerIndex]); HudMovie.SetViewScaleMode(SM_ExactFit); HudMovie.SetAlignment(Align_TopLeft); } DefaultProperties { }I probably made a stupid mistake somewhere. Any help would be nice. Thank you.Code:class ZomHUD extends GFxMoviePlayer; var float lastHealthPC; var float lastAmmoPC; var GFxObject HUDHealthBAR, HUDHealthBOX, HUDAmmoBOX; var GFxObject ammo, clips; var GFXObject crosshair; function int roundNum(float NumIn) { local int iNum; local float fNum; fNum = NumIn; iNum = int(fNum); fNum -= iNum; if (fNum >= 0.5f) { return (iNum + 1); } else { return iNum; } } function int GetPercentage( int Value, int MaxValue ) { return roundNum( ( float( Value ) / float( MaxValue ) ) * 100.0f); } function Init( optional LocalPlayer LocPlay ) { Start(); Advance(0.f); Super.Init( LocPlay ); LastHealthpc = -1000; HUDHealthBOX = GetVariableObject("_root.HUDHealthBOX"); HUDAmmoBOX = GetVariableObject("_root.HUDAmmoBOX"); HUDhealthBar = GetVariableObject("_root.HUDHealthBOX.HUDHealthBAR"); ammo = GetVariableObject("_root.HUDAmmoBOX.ammo"); clips = GetVariableObject("_root.HUDAmmoBOX.clips"); } function TickHUD() { local PlayerController PC; local Zompawn ZP; PC = GetPC(); ZP = ZomPawn(PC.Pawn); if (ZP == None || ZP.Weapon == None) { return; } if (lastHealthPC != GetPercentage(ZP.Health, ZP.HealthMax)) { lastHealthPC = GetPercentage(ZP.Health, ZP.HealthMax); HUDHealthBAR.SetFloat("_xscale", (lastHealthPC > 100) ? 100.0f : lastHealthPC); } if (lastAmmoPC != GetPercentage(ZomWeapon(ZP.Weapon).MagAmmo, ZomWeapon(ZP.Weapon).MaxMagAmmo)) { lastAmmoPC = GetPercentage(ZomWeapon(ZP.Weapon).MagAmmo, ZomWeapon(ZP.Weapon).MaxMagAmmo); } ammo.SetString("text", (ZomWeapon(ZP.Weapon).MagAmmo)$" / "$(ZomWeapon(ZP.Weapon).MaxMagAmmo)$""); clips.SetString("text", (ZomWeapon(ZP.Weapon).MaxAmmoCount)$""); } DefaultProperties { bIgnoreMouseInput = false bAutoPlay=True bDisplayWithHudOff=false MovieInfo=SwfMovie'ZomHUD.CleanHUD' }



Reply With Quote


Bookmarks