Announcement

Collapse
No announcement yet.

followed tutorials and no solution

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    followed tutorials and no solution

    Hi folks,
    i've followed a number of tutorials on how to create a scaleform hud and implement it and compile and such and i've looked on here through peoples threads and posts and posted before but never understood what i was doing wrong or found a solution.so, if i may, i wanted to post my code here and hope that somebody can find my error because nomatter where i look i don't know what im looking for. thank you for your time to look at this!im sorry it's a mess,i tried to make it organized with the bold and underline...

    SGameInfo class


    class SGameInfo extends UTDeathmatch;

    DefaultProperties
    {
    //Indentify your GameInfo
    Acronym="S"

    //The class for your playerController (created later)
    PlayerControllerClass=class'SGame.SPlayerControlle r'

    //The class for your GFx HUD Wrapper (created later)
    HUDType=class'SGame.SHUD'

    //This variable was created by Epic Games to allow back compatability with UIScenes
    bUseClassicHUD=true

    //Required values
    bDelayedStart=false
    bRestartLevel=false
    Name="Default__SGameInfo"
    }



    SGFxHUD class

    class SGFxHUD extends GFxMoviePlayer;

    //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 base, healthbar;

    // 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 getpercentage(int val, int max) {
    return roundNum((float(val) / float(max)) * 100.0f);
    }

    //Called from SHUD'd PostBeginPlay()
    function Init(HudMovie.PlayerOwner)
    {
    //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
    base = GetVariableObject("_root.base");
    healthbar = GetVariableObject("_root.base.healthbar");
    }

    //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(PlayerOwner.Pawn);
    if (UTP == None) {
    return;
    }

    //If the cached value for Health percentage isn't equal to the current...
    if (LastHealthpc != getpercentage(UTP.Health, UTP.HealthMax)) {
    //...Make it so...
    LastHealthpc = getpercentage(UTP.Health, UTP.HealthMax);
    //...Update the bar's xscale (but don't let it go over 100)...
    healthbar.SetFloat("_xscale", (LastHealthpc > 100) ? 100.0f : 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'Flash.MyHud.my_hudSwf'
    //Just put it in...
    bGammaCorrection = false
    }



    SHUD class

    class SHUD extends UTHUDBase;

    //Reference the actual SWF container (SGFxHUD created later)
    var SGFxHUD 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;
    }

    super.Destroy();
    }

    //Called after game loaded - initialise things
    simulated function PostBeginPlay() {
    super.PostBeginPlay();

    //Create a SGFxHUD for HudMovie
    HudMovie = new class'SGFxHUD';
    //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(HudMovie.PlayerOwner);
    }

    //Called every tick the HUD should be updated
    event PostRender() {
    HudMovie.TickHUD();
    }

    DefaultProperties
    {
    }



    SPlayerController class

    class SPlayerController extends UTPlayerController;

    DefaultProperties
    {
    bForceBehindView=false

    Name="Default__SPlayerController"
    }

    #2
    you didnt mention your problem...
    what error does it say when you compile?

    btw use the code tags for code
    looks like this #

    Comment


      #3
      oh sorry,well i changed the code and got it to successfully compile and it seems to work but when i go in the editor i still dont have my hud. its udk's default hud. i got so excited,thinkin i fixed it...

      edit: got it workin,thanks.

      Comment

      Working...
      X