Hud will not load. [SOLVED]

Discussions about Coding and Scripting
User avatar
papercoffee
Godlike
Posts: 10447
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: Hud will not load.

Post by papercoffee »

sektor2111 wrote:PlayerPawn.uc class has at <defaultproperties> a default HUD class which is called in PostBeginPlay - (sent by server ? - see replication section).
If you went to screw these in your custom player you won't have HUD.
Sooo... I was partially right. :mrgreen:

papercoffee knew something *joy*
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Hud will not load.

Post by sektor2111 »

Actually I think I used wrong term - Not default properties but it was a Variable HUD. Being undefined, this variable is being set in PostBeginPlay - if you skip it you simply skip HUD. And then if you have rammed PostBeginPlay say Good Bye to HUD, it's not a need to ruin HUD directly these things have links each-other, if you break their chain will result in malfunctions. You might want to check your PostBeginPlay and compare it with the one from <PlayerPawn.uc>. Go figure...
Aside <Level.Game> fired must have declared HUD or called HUD properly. Watch PlayerPawn.uc related to what I'm saying

Code: Select all

var HUD	myHUD;
var ScoreBoard Scoring;
var class<hud> HUDType;
var class<scoreboard> ScoringType;
...
replication
{
	// Things the server should send to the client.
	reliable if( bNetOwner && Role==ROLE_Authority )
		ViewTarget, ScoringType, HUDType,...
...
event PostBeginPlay()
{
	Super.PostBeginPlay();
	if (Level.LevelEnterText != "" )
		ClientMessage(Level.LevelEnterText);
	if ( Level.NetMode != NM_Client )
	{
		HUDType = Level.Game.HUDType;
		ScoringType = Level.Game.ScoreboardType;
		MyAutoAim = FMax(MyAutoAim, Level.Game.AutoAim);
	}
	bIsPlayer = true;
	DodgeClickTime = FMin(0.3, DodgeClickTime);
	DesiredFOV = DefaultFOV;
	EyeHeight = BaseEyeHeight;
	if ( Level.Game.IsA('SinglePlayer') && (Level.NetMode == NM_Standalone) )
		FlashScale = vect(0,0,0);
}
Variable HudType is being set here. All relations start with default announcement about HUDType used and this drives to <MyHUD>. Actually Player is using to trigger more things HUD related but we have a problem THAT ONE should be started, called, it needs to exist first.
User avatar
SilverSound
Adept
Posts: 344
Joined: Fri Nov 06, 2015 10:12 am
Personal rank: Curious
Location: St. Cloud, Florida

Re: Hud will not load. [SOLVED]

Post by SilverSound »

Huh. So I'l try to put that in my Custom Player. The Mutator just uses something sektor wrote for his nsDM stuff.

Code: Select all

class BotMe expands Mutator;



function ModifyLogin(out class<playerpawn> SpawnClass, out string Portal, out string Options)
{





//	Log("SpawnClass:"@SpawnClass);		// Someone claims that Engine.Pawn makes it here.
	if ( SpawnClass == None )
		SpawnClass = class'TMale1';

	if ( NextMutator != None )
		NextMutator.ModifyLogin(SpawnClass, Portal, Options);



	if (!ClassIsChildOf(SpawnClass, class'TPBotMe'))
	{
		log ("Player has entered with class"@SpawnClass);
		if ( Right(Caps(SpawnClass),5) == "TBOSS" )
		{
			SpawnClass = class'NsTBoss';
			Log ("Assigned"@SpawnClass);
			GoTo JL753;
		}
		else if ( Right (Caps(SpawnClass),6) == "TMALE1" )
		{
			SpawnClass = class'NsTMale1';
			Log ("Assigned"@SpawnClass);
			GoTo JL753;
		}
		else if ( Right (Caps(SpawnClass),6) == "TMALE2" )
		{
			SpawnClass = class'NsTMale2';
			Log ("Assigned"@SpawnClass);
			GoTo JL753;
		}
		else if ( Right (Caps(SpawnClass),8) == "TFEMALE1" )
		{
			SpawnClass = class'NsTFemale1';
			Log ("Assigned"@SpawnClass);
			GoTo JL753;
		}
		else if ( Right (Caps(SpawnClass),8) == "TFEMALE2" )
		{
			SpawnClass = class'NsTFemale2';
			Log ("Assigned"@SpawnClass);
			GoTo JL753;
		}

        }
JL753:
}
I'll check what sektor pointed out here right now.

Edit: look at that. Sektor was right. I had a PostBeginPlay(); in my player. Go figure. SOLVED

To anyone else having this issue do not call PostBeginPlay(); in your custom player unless you add the playerpawn hud code with it. If you don't you will have my issue.


That would be this:

Code: Select all

event PostBeginPlay()
{
	Super.PostBeginPlay();
	if (Level.LevelEnterText != "" )
		ClientMessage(Level.LevelEnterText);
	if ( Level.NetMode != NM_Client )
	{
		HUDType = Level.Game.HUDType;
		ScoringType = Level.Game.ScoreboardType;
		MyAutoAim = FMax(MyAutoAim, Level.Game.AutoAim);
	}
	bIsPlayer = true;
	DodgeClickTime = FMin(0.3, DodgeClickTime);
	DesiredFOV = DefaultFOV;
	EyeHeight = BaseEyeHeight;
	if ( Level.Game.IsA('SinglePlayer') && (Level.NetMode == NM_Standalone) )
		FlashScale = vect(0,0,0);
}
Thanks sektor!
"Woah what?! I wish I was recording that...."
Post Reply