Ok, so I've been reading around on Scaleform for a while now and haven't found much explaining in detail on the Unreal Script side of things. I get that I have to make (and name) the parts of the HUD in Flash, and then import it in udk and call on the components (MC or Dynamic Txt) and have them update. How I actually do this syntax wise I have a limited understanding of at this point in time. If anyone would explain some of this to me and tell me what I am doing wrong I would be great full. Here is my code that I followed from ryanjon2040's post with the example code from here http://forums.epicgames.com/threads/...-A-from-a-noob
I tailored it to suit my class and read through it quite a few times. This is what I have.
HSGFxHUD
HSHUD
And here is a picture explaining the HUD for a visual
[IMG]
[/IMG]
I tailored it to suit my class and read through it quite a few times. This is what I have.
HSGFxHUD
Code:
class HSGFxHUD extends GFxMoviePlayer; var float LastHealthpc; var GFxObject SFBar_MC; var GFxObject SFHealth_txt; var HSPlayerController PlayerOwner; var HSPawn HSP; var PlayerController myPC; 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 HealthFunc(int val, int max) { return roundNum((float(val) / float(max)) * 100.0f); } function Init2(PlayerController PC) { Start(); Advance(0.f); LastHealthpc = -1337; SFBar_MC = GetVariableObject("_root.SFBar_MC"); //Your Healthbar meter. eg: GetVariableObject("_root.health_mc"); } function TickHUD() { myPC = GetPC(); HSP = HSPawn(myPC.Pawn); if (HSP == None) { return; } else { if (LastHealthpc != HealthFunc(HSP.Health, HSP.HealthMax)) { LastHealthpc = HealthFunc(HSP.Health, HSP.HealthMax); SFBar_MC.SetFloat("_xscale", (LastHealthpc > 100) ? 100.0f : LastHealthpc); SFHealth_txt.SetString("text", round(LastHealthpc)$"%"); } } } defaultproperties { bDisplayWithHudOff = false MovieInfo=SwfMovie'UDKHUD.HSHealthHUD' //Your SWFMovie //bEnableGammaCorrection = false; bAllowInput = false; bAllowFocus = false; }
HSHUD
Code:
class HSHUD extends UDKHUD; var HSGFxHUD HudMovie; var HSPlayerController PO; //DISABLES THE GIANT RED BOOGIE HIT EFFECT FROM UTHUD. function DisplayHit(vector HitDir, int Damage, class<DamageType> damageType) { } singular event Destroyed() { if (HudMovie != none) { HudMovie.Close(true); HudMovie = none; } } simulated function PostBeginPlay() { super.PostBeginPlay(); HudMovie = new class'HSGFxHUD'; HudMovie.PlayerOwner = PO; HudMovie.SetTimingMode(TM_Real); HudMovie.Init2(HudMovie.PlayerOwner); HudMovie.SetViewScaleMode(SM_ExactFit); HudMovie.SetAlignment(Align_TopLeft); } event PostRender() { HudMovie.TickHUD(); DisplayConsoleMessages(); DisplayLocalMessages(); DisplayKismetMessages(); } defaultproperties { }
[IMG]

Comment