Results 1 to 4 of 4
  1. #1
    MSgt. Shooter Person
    Join Date
    Sep 2010
    Location
    Australia
    Posts
    148

    Question Display variables from GameInfo?

    All I want to do is show the player's score out of the GoalScore on the HUD (example: 45/100)

    GoalScore is declared in GameInfo and the GFxMoviePlayer class won't access WorldInfo.Game via UnrealScript. Is there a way to grab that GoalScore integer from GameInfo?

    Current snippet:
    Code:
     MaxScoreString = string(100);
     MaxScoreTF.SetString("text", MaxScoreString);
    I need that "100" to be the GoalScore variable...
    » Team Friendship (UDK 4P co-op) "Like" our Facebook Page for dev-blog updates
    » Audio Tours Australia - MP3 walking tours of Australia

  2. #2
    MSgt. Shooter Person
    Join Date
    Sep 2010
    Location
    Australia
    Posts
    148

    Default

    Okay I kept playing around with it and I came up with this:

    PlayerController grabs the GoalScore variable and stores it as GameGoalScore...
    Code:
    class MTPlayerController extends UTPlayerController;
    
    var int GameGoalScore;
    
    simulated function PostBeginPlay()
    {
     super.PostBeginPlay();
     GameGoalScore = WorldInfo.Game.GoalScore;
    }
    Then in the GFxMoviePlayer I call on that variable instead....
    Code:
    class MonkeyGFxHUD extends GFxMoviePlayer;
    
    var string MaxScoreString;
    var GFxObject MaxScoreTF;
    
    function Init2()
    {
     Start();
     Advance(0.f);
    
     MaxScoreTF = GetVariableObject("_root.scorebar_mc.maxscore_txt");
    
     MaxScoreString = string(MTPlayerController(GetPC()).GameGoalScore);
     MaxScoreTF.SetString("text", MaxScoreString);
    }
    (All other code has been left out)

    That works but it doesn't seem very stable because it's asking for the variable from the PlayerController and not straight from the source. Does anyone know of a cleaner way? Cheers
    » Team Friendship (UDK 4P co-op) "Like" our Facebook Page for dev-blog updates
    » Audio Tours Australia - MP3 walking tours of Australia

  3. #3
    Redeemer
    Join Date
    Jun 2010
    Location
    Barcelona
    Posts
    1,901

    Default

    just a note, storing variables in your GameInfo is not a very good idea because in a network game the GameInfo can't be accessed.
    single-player only? no problem

  4. #4
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Posts
    218

    Default

    You could have the data get sent to the GameReplicationInfo and that'll be more or like "getting it from the source."


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.