changing hud mid game from playercontroller

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

beefsack

the authority in beef
Nov 22, 2002
241
0
16
39
Canberra, Australia
beefsack.blogspot.com
k im trying to change to a different HUD midgame from the playercontroller class. all the lines around it execute find. heres the line i use to try to switch huds:

Code:
level.Game.HUDType = "ThePackage.NewHUD";

what am i doing wrong :(
 

Mychaeel

New Member
You should start by checking how and where that "HUDType" variable is used by the game's UnrealScript code. There's nothing native involved, so by merely looking into the source code you can find out why, exactly, making that assignment doesn't work.

I'm more interested in why you want to do this in the first place. Why don't you just set the corresponding default property in your custom GameInfo subclass?

If you are not making a game type, you shouldn't have custom PlayerController and HUD subclasses to start with; see Unreal Wiki: Maintaining Compatibility.
 

beefsack

the authority in beef
Nov 22, 2002
241
0
16
39
Canberra, Australia
beefsack.blogspot.com
yeah im making a gametype ;) where i need to be able to build stuff so it needs a player hud and a building hud. thanks for the help i had a deeper look and when the player logs in it sets it. sorry for not trying harder :p . id post the code but im at school atm.
 

beefsack

the authority in beef
Nov 22, 2002
241
0
16
39
Canberra, Australia
beefsack.blogspot.com
Code:
function ChangeHUD(string NewHUDType, string NewSBType)
{
    local class<HUD> HudClass;
    local class<Scoreboard> ScoreboardClass;

    HudClass = class<HUD>(DynamicLoadObject(NewHUDType, class'Class'));
    ScoreboardClass = class<Scoreboard>(DynamicLoadObject(NewSBType, class'Class'));
    ClientSetHUD( HudClass, ScoreboardClass );
}
thats in the playercontroller class :)