I've been following the scaleform tutorial at noexperience, and at least I have succeeding in not having any errors. But the problem I have are that my code don't find the swf movie... I've checked around in the forum and on the internet but haven’t found a solution.
Anyone that knows what I've done wrong?
This is the code in the class MGGFxHUD extends GFxMoviePlayer
And in the class MyHUD extends UTHUDBase;
Thanks in advance
Anyone that knows what I've done wrong?
This is the code in the class MGGFxHUD extends GFxMoviePlayer
Code:
//Create a Health Cache variable var float LastHealthpc; //Create variables to hold references to the Flash MovieClips and Text Fields that will be modified var GFxObject HealthMC, HealthBarMC; var GFxObject HealthTF; // Function to round a float value to an int 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 to return a percentage from a value and a maximum function int getPcnt(int val, int max) { return roundNum((float(val) / float(max)) * 100.0f); } //Called from STHUD'd PostBeginPlay() function Init(optional LocalPlayer LocPlay) { //Start and load the SWF Movie Start(); Advance(0.f); //Set the cahce value so that it will get updated on the first Tick LastHealthpc = -1337; //Load the references with pointers to the movieClips and text fields in the .swf HealthMC = GetVariableObject("_root.healthbar_mc"); HealthBarMC = GetVariableObject("_root.healthbar_mc.bar_mc"); HealthTF = GetVariableObject("_root.healthbar_mc.health_txt"); } //Called every update Tick function TickHUD() { local UTPawn UTP; //We need to talk to the Pawn, so create a reference and check the Pawn exists UTP = UTPawn( GetPC().Pawn ); if ( UTP == None ) return; //If the cached value for Health percentage isn't equal to the current... if (LastHealthpc != getPcnt(GetPC().Pawn.Health, GetPC().Pawn.HealthMax)) { //...Make it so... LastHealthpc = getPcnt(GetPC().Pawn.Health, GetPC().Pawn.HealthMax); //...Update the bar's xscale (but don't let it go over 100)... HealthBarMC.SetFloat("_xscale", (LastHealthpc > 100) ? 100.0f : LastHealthpc); //...and update the text field HealthTF.SetString("text", round(LastHealthpc)$"%"); } } DefaultProperties { //this is the HUD. If the HUD is off, then this should be off bDisplayWithHudOff=false; //The path to the swf asset we will create later MovieInfo=SwfMovie'MyGame.HUD' //Just put it in... //bGammaCorrection = false }
Code:
//Reference the actual SWF container (STGFxHUD created later) var MGGFxHUD HudMovie; //Called when this is destroyed singular event Destroyed() { if (HudMovie != none) { //Get rid of the memory usage of HudMovie HudMovie.Close(true); HudMovie = none; } Destroy(); } //Called after game loaded - initialise things simulated function PostBeginPlay() { super.PostBeginPlay(); //Create a STGFxHUD for HudMovie HudMovie = new class'MGGFxHUD'; //Set the HudMovie's PlayerOwner //HudMovie.PlayerOwner = PlayerOwner; //Set the timing mode to TM_Real - otherwide things get paused in menus HudMovie.SetTimingMode(TM_Real); //Call HudMovie's Initialise function HudMovie.Init(); } //Called every tick the HUD should be updated event PostRender() { HudMovie.TickHUD(); } DefaultProperties { }
Comment