Announcement

Collapse
No announcement yet.

Scaleform, HUD don't appear

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

    #16
    The editor doesn't always give the same result as starting up the game from the standalone game. try the following: create a shortcut to e.g

    C:\UDK\UDK-2011-03\Binaries\Win64\UDK.exe

    then modify the target as this:

    C:\UDK\UDK-2011-03\Binaries\Win64\UDK.exe MapName?game=Classes.Gameinfofile -vadebug -nomoviestartup -resx=1366 -resy=768 -log

    where Classes.Gameinfofile is the path (now, the original path) to your gameinfo, eg I have the GameInfofile LastStand laying under the LastStand folder, hence i use LastStand.LastStand.

    Start up the shortcut and see if you see results

    Comment


      #17
      Originally posted by misslarson View Post
      Yes, that have I done. I also have these lines in GameInfo:
      HUDType=class 'MyHUD'
      bUseClassicHUD=true;
      HUDType=class'LastStand.LSHUD';

      Development/Src/LastStand/LSHUD.uc results in the path above.


      Put your gameinfofile in a folder inside Src and do like me

      Comment


        #18
        That didn't work either. But we have decided to skip the HUD in our game since it was so hard to get it to work and our time for our assignment is starting to run out. But I really appreciated your help

        Comment


          #19
          Hello MissLarson,

          I'm assuming your are looking at this tutorial http://noexp.wordpress.com/copypasta...-actionscript/. It is a little outdated and a few things don't work anymore(atleast for me they didnt). I am new to scaleform aswell (which i am loving btw... just a lil different and unique).

          The code below works just fine for me (with the May 2011 UDK Beta). I did not add/remove/extend any functionality or anything, just got it working like the tutorial. I have slightly different classname / symbol names in flash... but if you change it to your values all should work

          rpgGameInfo.uc
          Code:
          class rpgGameInfo extends UTDeathMatch;
          
          DefaultProperties
          {
          	Acronym="RPG"
          	HUDType= class 'RPG.rpgHUD'
          	PlayerControllerClass=class 'RPG.rpgPlayerController'
          	bUseClassicHUD=true
          	bDelayedStart=false
          	bRestartLevel=false
          	name="Default__rpgGameInfo"
          	
          }
          rpgHUD.uc
          Code:
          class rpgHUD extends UTHUDBase;
          
          var rpgGFXhud HudMovie;
          
          singular event Destroyed() {
           if (HudMovie != none) {
           //Get rid of the memory usage of HudMovie
           HudMovie.Close(true);
           HudMovie = none;
           }
          
           super.Destroyed();
          }
          
          //Called after game loaded - initialise things
          simulated function PostBeginPlay() {
           super.PostBeginPlay();
          
           //Create a STGFxHUD for HudMovie
           HudMovie = new class'rpgGFXhud';
           //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.Owner);
          }
          
          //Called every tick the HUD should be updated
          event PostRender() {
           HudMovie.TickHUD();
          }
          
          DefaultProperties
          {
          }
          rpgGFXhud.uc
          Code:
          class rpgGFXhud 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 HealthMC, HealthBarMC;
          var GFxObject HealthTF;
          var localPlayer Owner;
          
          
          //  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 getpcc(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;
           local PlayerController PC;
          
           PC = GetPC();
          
           //We need to talk to the Pawn, so create a reference and check the Pawn exists
           UTP = UTPawn(PC.Pawn);
           if (UTP == None) {
           return;
           }
          
           //If the cached value for Health percentage isn't equal to the current...
           if (LastHealthpc != getpcc(UTP.Health, UTP.HealthMax)) {
           //...Make it so...
           LastHealthpc = getpcc(UTP.Health, UTP.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'rpgHUD.HealthBar'
           //Just put it in...
           bEnableGammaCorrection = false
          }
          rpgPlayerController.uc
          Code:
          class rpgPlayerController extends UTPlayerController;
          
          DefaultProperties
          {
          	bForceBehindView=False
          	name="Default__rpgPlayerController"
          }
          Best of Luck!

          P.S. I noticed in your code you commented out a few of the lines of code. As a tip don't just comment out where you are getting errors :-P. 1. There is usually a reason why it was there (and you can recode it differently to do the same thing) and 2. 9/10 it will cause more errors because your program will end up breaking later on because of it.

          Comment

          Working...
          X