[Solved]HolywarsNexgenHudFix

Discussions about Coding and Scripting
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Re: HolywarsNexgenHudFix

Post by Letylove49 »

Deepu wrote: Mon Oct 03, 2022 10:01 pm Write the code related to owner's hud color, Nexgen just checking for the team colors only.
Do you think that is unpossible to fix that ?
Image



Letylove49 aka Alicia
User avatar
Deepu
Adept
Posts: 353
Joined: Mon Nov 11, 2013 7:56 am
Personal rank: Average
Location: India
Contact:

Re: HolywarsNexgenHudFix

Post by Deepu »

I don't have much coding knowledge but in this case it clearly seems Nexgen HUD is not following the owner's hud color, Nexgen needs to follow the owner's HUD color so find the color changing code in Challenge HUD then add it to Nexgen HUD, no need to write any super classes maybe it requires timer to add this.
User avatar
Deepu
Adept
Posts: 353
Joined: Mon Nov 11, 2013 7:56 am
Personal rank: Average
Location: India
Contact:

Re: HolywarsNexgenHudFix

Post by Deepu »

Letylove49 wrote: Mon Oct 03, 2022 10:41 pm
Deepu wrote: Mon Oct 03, 2022 10:01 pm Write the code related to owner's hud color, Nexgen just checking for the team colors only.
Do you think that is unpossible to fix that ?
I tested the holy wars with nexgen and it's working for me, which version of nexgen HUD are you using?
Shot00038.png

Code: Select all

baseHUDColor = ChallengeHUD(player.myHUD).HUDColor;
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Re: HolywarsNexgenHudFix

Post by Letylove49 »

Deepu wrote: Wed Oct 05, 2022 6:47 am
Letylove49 wrote: Mon Oct 03, 2022 10:41 pm
Deepu wrote: Mon Oct 03, 2022 10:01 pm Write the code related to owner's hud color, Nexgen just checking for the team colors only.
Do you think that is unpossible to fix that ?
I tested the holy wars with nexgen and it's working for me, which version of nexgen HUD are you using?
Shot00038.png

Code: Select all

baseHUDColor = ChallengeHUD(player.myHUD).HUDColor;

wich version of Nexgen are you using ? ( i have tested with Nexgen112 same probleme.
i use this version :

Code: Select all

 /***************************************************************************************************
 *
 *  $DESCRIPTION  Initializes/updates the variables used in the rendering procedure.
 *  $PARAM        c  Canvas object that provides the drawing capabilities.
 *  $REQUIRE      c != none
 *  $ENSURE       c.font != none
 *
 **************************************************************************************************/
simulated function setup(Canvas c) {
	local int index;
	local bool bUpdateBase;
	local float dummy;
	
	// Make sure the font ain't none.
	if (baseFont == none) baseFont = getFont(chatMsgSize, c);
	c.font = baseFont;
	
	// Get local PlayerPawn.
	player = c.viewport.actor;
	
	// Set base hud color.
	if (player == none || player.playerReplicationInfo == none || player.gameReplicationInfo == none) {
		baseHUDColor = baseColors[5];
	} else if (player.playerReplicationInfo.bIsSpectator &&
	    !player.playerReplicationInfo.bWaitingPlayer) {
		baseHUDColor = baseColors[4];
	} else if (useUTHUDColor || (!player.gameReplicationInfo.bTeamGame && ChallengeHUD(player.myHUD) != none)) {
		baseHUDColor = ChallengeHUD(player.myHUD).favoriteHUDColor * 15.9;
	} else if (0 <= player.playerReplicationInfo.team && player.playerReplicationInfo.team <= 3) {
		baseHUDColor = baseColors[player.playerReplicationInfo.team];
	} else {
		baseHUDColor = baseColors[5];
	}
  
	// Fix offset 
	C.bCenter = false;
	
	// Prevent redundant setups.
	if (lastSetupTime == level.timeSeconds) {
		return;
	}

	// Timer control.
	timeSeconds += (level.timeSeconds - lastLevelTimeSeconds) / level.timeDilation;
	lastLevelTimeSeconds = level.timeSeconds;
		
	// Check if the base variables need to be updated.
	bUpdateBase = lastResX != c.clipX ||
	              lastResY != c.clipY ||
				  bForceUpdate;
	
	// Update HUD base variables.
	if (bUpdateBase) {	
		// General variables.
		baseFont = getFont(chatMsgSize, c);
		c.font = baseFont;
		c.strLen("Online [00:00]", minPanelWidth, baseFontHeight);
		lastResX = c.clipX;
		lastResY = c.clipY;
		
		// Message box info.
		msgBoxWidth = int(c.clipX * 0.75);
		msgBoxLineHeight = int(baseFontHeight + 4.0);
		msgBoxHeight = msgBoxLineHeight * chatMsgMaxCount;
		
		// Other messages.
		otherFont = getFont(otherMsgSize, c);
		c.font = otherFont;
		c.strLen("XXX", dummy, otherFontHeight);
		
		bForceUpdate = false;
	}
	
	// Remove expired messages.
	if (chatMsgCount > 0 && timeSeconds - chatMessages[0].timeStamp > chatMessageLifeTime) {
		for (index = 1; index < chatMsgCount; index++) {
			chatMessages[index - 1] = chatMessages[index];
		}
		chatMsgCount--;
		if (chatMsgCount == 0) {
			faceImg = none;
		}
	} 
	if (msgCount > 0 && timeSeconds - messages[0].timeStamp > messageLifeTime) {
		for (index = 1; index < msgCount; index++) {
			messages[index - 1] = messages[index];
		}
		msgCount--;
	} 
	
	lastSetupTime = level.timeSeconds;
}

Image



Letylove49 aka Alicia
User avatar
Deepu
Adept
Posts: 353
Joined: Mon Nov 11, 2013 7:56 am
Personal rank: Average
Location: India
Contact:

Re: HolywarsNexgenHudFix

Post by Deepu »

Try Nexgen 112 MH edition or UP2
UP2.zip
(1.65 MiB) Downloaded 6 times
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Re: HolywarsNexgenHudFix

Post by Letylove49 »

that work with the Nexgen112N because i have do this fix:

Code: Select all

  /***************************************************************************************************
 *
 *  $DESCRIPTION  Initializes/updates the variables used in the rendering procedure.
 *  $PARAM        c  Canvas object that provides the drawing capabilities.
 *  $REQUIRE      c != none
 *  $ENSURE       c.font != none
 *
 **************************************************************************************************/
simulated function setup(Canvas c) {
	local int index;
	local bool bUpdateBase;
	
	// Make sure the font ain't none.
	if (baseFont == none) baseFont = getStaticSmallestFont(c.clipX);
	c.font = baseFont;
	
	// Get local PlayerPawn.
	player = c.viewport.actor;
	

	// Set base hud color.
        baseHUDColor = ChallengeHUD(player.myHUD).HUDColor; // use the HUD colour set in UT prefs	
/*	if (player == none || player.playerReplicationInfo == none || player.gameReplicationInfo == none) {
		baseHUDColor = baseColors[5];
	} else if (player.playerReplicationInfo.bIsSpectator &&
	    !player.playerReplicationInfo.bWaitingPlayer) {
		baseHUDColor = baseColors[4];
	} else if (!player.gameReplicationInfo.bTeamGame &&
		       ChallengeHUD(player.myHUD) != none) {
		baseHUDColor = ChallengeHUD(player.myHUD).favoriteHUDColor * 15.9;
	} else if (0 <= player.playerReplicationInfo.team && player.playerReplicationInfo.team <= 3) {
		baseHUDColor = baseColors[player.playerReplicationInfo.team];
	} else {
		baseHUDColor = baseColors[5];
	}
*/
	// Prevent redundant setups.
	if (lastSetupTime == level.timeSeconds) {
		return;
	}

	// Timer control.
	timeSeconds += (level.timeSeconds - lastLevelTimeSeconds) / level.timeDilation;
	lastLevelTimeSeconds = level.timeSeconds;
		
	// Check if the base variables need to be updated.
	bUpdateBase = lastResX != c.clipX ||
	              lastResY != c.clipY;
	
	// Update HUD base variables.
	if (bUpdateBase) {

	// Set base hud color.
        baseHUDColor = ChallengeHUD(player.myHUD).HUDColor; // use the HUD colour set in UT prefs	
		
		// General variables.
		baseFont = getStaticSmallestFont(c.clipX);
		c.font = baseFont;
		c.strLen("Online [00:00]", minPanelWidth, baseFontHeight);
		lastResX = c.clipX;
		lastResY = c.clipY;
		
		// Message box info.
		msgBoxWidth = int(c.clipX * 0.75);
		msgBoxLineHeight = int(baseFontHeight + 4.0);
		msgBoxHeight = msgBoxLineHeight * arrayCount(chatMessages);
	}
	
	// Remove expired messages.
	if (chatMsgCount > 0 && timeSeconds - chatMessages[0].timeStamp > chatMessageLifeTime) {
		for (index = 1; index < chatMsgCount; index++) {
			chatMessages[index - 1] = chatMessages[index];
		}
		chatMsgCount--;
		if (chatMsgCount == 0) {
			faceImg = none;
		}
	} 
	if (msgCount > 0 && timeSeconds - messages[0].timeStamp > messageLifeTime) {
		for (index = 1; index < msgCount; index++) {
			messages[index - 1] = messages[index];
		}
		msgCount--;
	} 
	
	lastSetupTime = level.timeSeconds;
}


i'm trying to fix that on Nexgen112SDL ( a new private version) like it but that doesn't work.

Code: Select all

 /***************************************************************************************************
 *
 *  $DESCRIPTION  Initializes/updates the variables used in the rendering procedure.
 *  $PARAM        c  Canvas object that provides the drawing capabilities.
 *  $REQUIRE      c != none
 *  $ENSURE       c.font != none
 *
 **************************************************************************************************/
simulated function setup(Canvas c) {
	local int index;
	local bool bUpdateBase;
	local float dummy;
	
	// Make sure the font ain't none.
	if (baseFont == none) baseFont = getFont(chatMsgSize, c);
	c.font = baseFont;
	
	// Get local PlayerPawn.
	player = c.viewport.actor;
	
		// Set base hud color.
      if (Level.Game.IsA('HolyWarsGame')){
	 baseHUDColor = ChallengeHUD(player.myHUD).HUDColor;
       }else
	if (player == none || player.playerReplicationInfo == none || player.gameReplicationInfo == none) {
		baseHUDColor = baseColors[5];
	} else if (player.playerReplicationInfo.bIsSpectator &&
	    !player.playerReplicationInfo.bWaitingPlayer) {
		baseHUDColor = baseColors[4];
	} else if (useUTHUDColor || (!player.gameReplicationInfo.bTeamGame && ChallengeHUD(player.myHUD) != none)) {
		baseHUDColor = ChallengeHUD(player.myHUD).favoriteHUDColor * 15.9;
	} else if (0 <= player.playerReplicationInfo.team && player.playerReplicationInfo.team <= 3) {
		baseHUDColor = baseColors[player.playerReplicationInfo.team];
	} else {
		baseHUDColor = baseColors[5];
	}
  
	// Fix offset 
	C.bCenter = false;
	
	// Prevent redundant setups.
	if (lastSetupTime == level.timeSeconds) {
		return;
	}

	// Timer control.
	timeSeconds += (level.timeSeconds - lastLevelTimeSeconds) / level.timeDilation;
	lastLevelTimeSeconds = level.timeSeconds;
		
	// Check if the base variables need to be updated.
	bUpdateBase = lastResX != c.clipX ||
	              lastResY != c.clipY ||
				  bForceUpdate;
	
	// Update HUD base variables.
	if (bUpdateBase) {	
	
	       // Set base hud color.
                baseHUDColor = ChallengeHUD(player.myHUD).HUDColor; // use the HUD colour set in UT prefs	
	
		// General variables.
		baseFont = getFont(chatMsgSize, c);
		c.font = baseFont;
		c.strLen("Online [00:00]", minPanelWidth, baseFontHeight);
		lastResX = c.clipX;
		lastResY = c.clipY;
		
		// Message box info.
		msgBoxWidth = int(c.clipX * 0.75);
		msgBoxLineHeight = int(baseFontHeight + 4.0);
		msgBoxHeight = msgBoxLineHeight * chatMsgMaxCount;
		
		// Other messages.
		otherFont = getFont(otherMsgSize, c);
		c.font = otherFont;
		c.strLen("XXX", dummy, otherFontHeight);
		
		bForceUpdate = false;
	}
	
	// Remove expired messages.
	if (chatMsgCount > 0 && timeSeconds - chatMessages[0].timeStamp > chatMessageLifeTime) {
		for (index = 1; index < chatMsgCount; index++) {
			chatMessages[index - 1] = chatMessages[index];
		}
		chatMsgCount--;
		if (chatMsgCount == 0) {
			faceImg = none;
		}
	} 
	if (msgCount > 0 && timeSeconds - messages[0].timeStamp > messageLifeTime) {
		for (index = 1; index < msgCount; index++) {
			messages[index - 1] = messages[index];
		}
		msgCount--;
	} 
	
	lastSetupTime = level.timeSeconds;
}

  

I have so far fixed the problem by applying the same method as in Nexgen112N but I am not 100% satisfied because it disables the "useUTHUDColor" function


Nexgen112SDL is a private version based on Nexgen113 develloped by Spongebob who are no longer develloped for the moment.
Image



Letylove49 aka Alicia
User avatar
Deepu
Adept
Posts: 353
Joined: Mon Nov 11, 2013 7:56 am
Personal rank: Average
Location: India
Contact:

Re: HolywarsNexgenHudFix

Post by Deepu »

🙄
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Re: HolywarsNexgenHudFix

Post by Letylove49 »

i have try to creat a 2nd fonction

Code: Select all

 /***************************************************************************************************
 *
 *  $DESCRIPTION  Initializes/updates the variables used in the rendering procedure.
 *  $PARAM        c  Canvas object that provides the drawing capabilities.
 *  $REQUIRE      c != none
 *  $ENSURE       c.font != none
 *
 **************************************************************************************************/
simulated function setup(Canvas c) {
	local int index;
	local bool bUpdateBase;
	local float dummy;
	
	// Make sure the font ain't none.
	if (baseFont == none) baseFont = getFont(chatMsgSize, c);
	c.font = baseFont;
	
	// Get local PlayerPawn.
	player = c.viewport.actor;
	
		// Set base hud color.

	if (player == none || player.playerReplicationInfo == none || player.gameReplicationInfo == none) {
		baseHUDColor = baseColors[5];
	} else if (player.playerReplicationInfo.bIsSpectator &&
	    !player.playerReplicationInfo.bWaitingPlayer) {
		baseHUDColor = baseColors[4];
	} else if (useUTHUDColor || (!player.gameReplicationInfo.bTeamGame && ChallengeHUD(player.myHUD) != none)) {
		baseHUDColor = ChallengeHUD(player.myHUD).favoriteHUDColor * 15.9;
	} else if (0 <= player.playerReplicationInfo.team && player.playerReplicationInfo.team <= 3) {
		baseHUDColor = baseColors[player.playerReplicationInfo.team];
	} else {
		baseHUDColor = baseColors[5];
	}

  
	// Fix offset 
	C.bCenter = false;
	
	// Prevent redundant setups.
	if (lastSetupTime == level.timeSeconds) {
		return;
	}

	// Timer control.
	timeSeconds += (level.timeSeconds - lastLevelTimeSeconds) / level.timeDilation;
	lastLevelTimeSeconds = level.timeSeconds;
		
	// Check if the base variables need to be updated.
	bUpdateBase = lastResX != c.clipX ||
	              lastResY != c.clipY ||
				  bForceUpdate;
	
	// Update HUD base variables.
	if (bUpdateBase) {	

    // Set base hud color.
        baseHUDColor = ChallengeHUD(player.myHUD).HUDColor; 
		// General variables.
		baseFont = getFont(chatMsgSize, c);
		c.font = baseFont;
		c.strLen("Online [00:00]", minPanelWidth, baseFontHeight);
		lastResX = c.clipX;
		lastResY = c.clipY;
		
		// Message box info.
		msgBoxWidth = int(c.clipX * 0.75);
		msgBoxLineHeight = int(baseFontHeight + 4.0);
		msgBoxHeight = msgBoxLineHeight * chatMsgMaxCount;
		
		// Other messages.
		otherFont = getFont(otherMsgSize, c);
		c.font = otherFont;
		c.strLen("XXX", dummy, otherFontHeight);
		
		bForceUpdate = false;
	}
	
	// Remove expired messages.
	if (chatMsgCount > 0 && timeSeconds - chatMessages[0].timeStamp > chatMessageLifeTime) {
		for (index = 1; index < chatMsgCount; index++) {
			chatMessages[index - 1] = chatMessages[index];
		}
		chatMsgCount--;
		if (chatMsgCount == 0) {
			faceImg = none;
		}
	} 
	if (msgCount > 0 && timeSeconds - messages[0].timeStamp > messageLifeTime) {
		for (index = 1; index < msgCount; index++) {
			messages[index - 1] = messages[index];
		}
		msgCount--;
	} 
	
	lastSetupTime = level.timeSeconds;
}


/***************************************************************************************************
 *
 *  $DESCRIPTION  Initializes/updates the variables used in the rendering procedure.
 *  $PARAM        c  Canvas object that provides the drawing capabilities.
 *  $REQUIRE      c != none
 *  $ENSURE       c.font != none
 *
 **************************************************************************************************/
simulated function setup1(Canvas c) {
	local int index;
	local bool bUpdateBase;
	local float dummy;


     if (Level.Game.IsA('HolyWarsGame'))
	
	// Make sure the font ain't none.
	if (baseFont == none) baseFont = getFont(chatMsgSize, c);
	c.font = baseFont;
	
	// Get local PlayerPawn.
	player = c.viewport.actor;
	
		// Set base hud color.
      
       baseHUDColor = ChallengeHUD(player.myHUD).HUDColor;


  
	// Fix offset 
	C.bCenter = false;
	
	// Prevent redundant setups.
	if (lastSetupTime == level.timeSeconds) {
		return;
	}

	// Timer control.
	timeSeconds += (level.timeSeconds - lastLevelTimeSeconds) / level.timeDilation;
	lastLevelTimeSeconds = level.timeSeconds;
		
	// Check if the base variables need to be updated.
	bUpdateBase = lastResX != c.clipX ||
	              lastResY != c.clipY ||
				  bForceUpdate;
	
	// Update HUD base variables.
	if (bUpdateBase) {	

    // Set base hud color.
        baseHUDColor = ChallengeHUD(player.myHUD).HUDColor; 
		// General variables.
		baseFont = getFont(chatMsgSize, c);
		c.font = baseFont;
		c.strLen("Online [00:00]", minPanelWidth, baseFontHeight);
		lastResX = c.clipX;
		lastResY = c.clipY;
		
		// Message box info.
		msgBoxWidth = int(c.clipX * 0.75);
		msgBoxLineHeight = int(baseFontHeight + 4.0);
		msgBoxHeight = msgBoxLineHeight * chatMsgMaxCount;
		
		// Other messages.
		otherFont = getFont(otherMsgSize, c);
		c.font = otherFont;
		c.strLen("XXX", dummy, otherFontHeight);
		
		bForceUpdate = false;
	}
	
	// Remove expired messages.
	if (chatMsgCount > 0 && timeSeconds - chatMessages[0].timeStamp > chatMessageLifeTime) {
		for (index = 1; index < chatMsgCount; index++) {
			chatMessages[index - 1] = chatMessages[index];
		}
		chatMsgCount--;
		if (chatMsgCount == 0) {
			faceImg = none;
		}
	} 
	if (msgCount > 0 && timeSeconds - messages[0].timeStamp > messageLifeTime) {
		for (index = 1; index < msgCount; index++) {
			messages[index - 1] = messages[index];
		}
		msgCount--;
	} 
	
	lastSetupTime = level.timeSeconds;
}

Image



Letylove49 aka Alicia
User avatar
Deepu
Adept
Posts: 353
Joined: Mon Nov 11, 2013 7:56 am
Personal rank: Average
Location: India
Contact:

Re: HolywarsNexgenHudFix

Post by Deepu »

"useUTHUDColor" means customized UT's HUD color right, any color if you customized with UT's HUD, it will copy the same color from master HUD class (ChallengeHUD), IDK why are you still stick with this.
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: HolywarsNexgenHudFix

Post by Barbie »

I don't understand such:

Code: Select all

class PlayerReplicationInfo expands ReplicationInfo
...
var byte	Team;	// Player Team, 255 = None for player.
Letylove49 wrote: Wed Oct 05, 2022 9:19 pm

Code: Select all

simulated function setup(Canvas c) {
...
	if (0 <= player.playerReplicationInfo.team
...
Not wrong but useless because Team cannot go below zero.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Re: HolywarsNexgenHudFix

Post by Letylove49 »

Barbie wrote: Fri Oct 07, 2022 1:58 pm I don't understand such:

Code: Select all

class PlayerReplicationInfo expands ReplicationInfo
...
var byte	Team;	// Player Team, 255 = None for player.
Letylove49 wrote: Wed Oct 05, 2022 9:19 pm

Code: Select all

simulated function setup(Canvas c) {
...
	if (0 <= player.playerReplicationInfo.team
...
Not wrong but useless because Team cannot go below zero.
is not me who wrote this code but Defrost.
m<y goal is to set the Holywars hud on the right color who is used by this gametype but with the code that don't work. The only way i have fund until now is to use the same fix that i use on MHA edtion ( desable the orignial code and replace it by

Code: Select all

  ChallengeHUD(player.myHUD).HUDColor; // use the HUD colour set in UT prefs

Code: Select all

 
	// Set base hud color.
        baseHUDColor = ChallengeHUD(player.myHUD).HUDColor; // use the HUD colour set in UT prefs	
/*	if (player == none || player.playerReplicationInfo == none || player.gameReplicationInfo == none) {
		baseHUDColor = baseColors[5];
	} else if (player.playerReplicationInfo.bIsSpectator &&
	    !player.playerReplicationInfo.bWaitingPlayer) {
		baseHUDColor = baseColors[4];
	} else if (!player.gameReplicationInfo.bTeamGame &&
		       ChallengeHUD(player.myHUD) != none) {
		baseHUDColor = ChallengeHUD(player.myHUD).favoriteHUDColor * 15.9;
	} else if (0 <= player.playerReplicationInfo.team && player.playerReplicationInfo.team <= 3) {
		baseHUDColor = baseColors[player.playerReplicationInfo.team];
	} else {
		baseHUDColor = baseColors[5];
	}
*/
Image



Letylove49 aka Alicia
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Error: C:\UT coding\UnrealTournament\Nexgen112SDL\Classes\NexgenHUD.uc(786) : Error, Unexpected 'if'

Post by Letylove49 »

Error: C:\UT coding\UnrealTournament\Nexgen112SDL\Classes\NexgenHUD.uc(786) : Error, Unexpected 'if'


Code: Select all

 /***************************************************************************************************
 *
 *  $DESCRIPTION  Initializes/updates the variables used in the rendering procedure.
 *    if gametype Holywars Goto setup1 else setup
 *  
 *
 **************************************************************************************************/
// check wich function muste be used;
 if(Level.Game.IsA('HolyWarsGame')) goto Function setup1;
else goto function setup;

/***************************************************************************************************
 *
 *  $DESCRIPTION  Initializes/updates the variables used in the rendering procedure.
 *  $PARAM        c  Canvas object that provides the drawing capabilities.
 *  $REQUIRE      c != none
 *  $ENSURE       c.font != none
 *
 **************************************************************************************************/
simulated function setup(Canvas c) {
	local int index;
	local bool bUpdateBase;
	local float dummy;
	
	// Make sure the font ain't none.
	if (baseFont == none) baseFont = getFont(chatMsgSize, c);
	c.font = baseFont;
	
	// Get local PlayerPawn.
	player = c.viewport.actor;
	
		// Set base hud color.
	if (player == none || player.playerReplicationInfo == none || player.gameReplicationInfo == none) {
		baseHUDColor = baseColors[5];
	} else if (player.playerReplicationInfo.bIsSpectator &&
	    !player.playerReplicationInfo.bWaitingPlayer) {
		baseHUDColor = baseColors[4];
	} else if (useUTHUDColor || (!player.gameReplicationInfo.bTeamGame && ChallengeHUD(player.myHUD) != none)) {
		baseHUDColor = ChallengeHUD(player.myHUD).favoriteHUDColor * 15.9;
	} else if (0 <= player.playerReplicationInfo.team && player.playerReplicationInfo.team <= 3) {
		baseHUDColor = baseColors[player.playerReplicationInfo.team];
	} else {
		baseHUDColor = baseColors[5];
	}
  
	// Fix offset 
	C.bCenter = false;
	
	// Prevent redundant setups.
	if (lastSetupTime == level.timeSeconds) {
		return;
	}

	// Timer control.
	timeSeconds += (level.timeSeconds - lastLevelTimeSeconds) / level.timeDilation;
	lastLevelTimeSeconds = level.timeSeconds;
		
	// Check if the base variables need to be updated.
	bUpdateBase = lastResX != c.clipX ||
	              lastResY != c.clipY ||
				  bForceUpdate;
	
	// Update HUD base variables.
	if (bUpdateBase) {	

    // Set base hud color.
        
		// General variables.
		baseFont = getFont(chatMsgSize, c);
		c.font = baseFont;
		c.strLen("Online [00:00]", minPanelWidth, baseFontHeight);
		lastResX = c.clipX;
		lastResY = c.clipY;
		
		// Message box info.
		msgBoxWidth = int(c.clipX * 0.75);
		msgBoxLineHeight = int(baseFontHeight + 4.0);
		msgBoxHeight = msgBoxLineHeight * chatMsgMaxCount;
		
		// Other messages.
		otherFont = getFont(otherMsgSize, c);
		c.font = otherFont;
		c.strLen("XXX", dummy, otherFontHeight);
		
		bForceUpdate = false;
	}
	
	// Remove expired messages.
	if (chatMsgCount > 0 && timeSeconds - chatMessages[0].timeStamp > chatMessageLifeTime) {
		for (index = 1; index < chatMsgCount; index++) {
			chatMessages[index - 1] = chatMessages[index];
		}
		chatMsgCount--;
		if (chatMsgCount == 0) {
			faceImg = none;
		}
	} 
	if (msgCount > 0 && timeSeconds - messages[0].timeStamp > messageLifeTime) {
		for (index = 1; index < msgCount; index++) {
			messages[index - 1] = messages[index];
		}
		msgCount--;
	} 
	
	lastSetupTime = level.timeSeconds;
}




/***************************************************************************************************
 *
 *  $DESCRIPTION  Initializes/updates the variables used in the rendering procedure.
 *  $PARAM        c  Canvas object that provides the drawing capabilities.
 *  $REQUIRE      c != none
 *  $ENSURE       c.font != none
 *
 **************************************************************************************************/
simulated function setup1(Canvas c) {
	local int index;
	local bool bUpdateBase;
	local float dummy;
	
	// Make sure the font ain't none.
	if (baseFont == none) baseFont = getFont(chatMsgSize, c);
	c.font = baseFont;
	
	// Get local PlayerPawn.
	player = c.viewport.actor;
	
		// Set base hud color.
         baseHUDColor = ChallengeHUD(player.myHUD).HUDColor;
		
/*
	if (player == none || player.playerReplicationInfo == none || player.gameReplicationInfo == none) {
		baseHUDColor = baseColors[5];
	} else if (player.playerReplicationInfo.bIsSpectator &&
	    !player.playerReplicationInfo.bWaitingPlayer) {
		baseHUDColor = baseColors[4];
	} else if (useUTHUDColor || (!player.gameReplicationInfo.bTeamGame && ChallengeHUD(player.myHUD) != none)) {
		baseHUDColor = ChallengeHUD(player.myHUD).favoriteHUDColor * 15.9;
	} else if (0 <= player.playerReplicationInfo.team && player.playerReplicationInfo.team <= 3) {
		baseHUDColor = baseColors[player.playerReplicationInfo.team];
	} else {
		baseHUDColor = baseColors[5];
	}

*/  
	// Fix offset 
	C.bCenter = false;
	
	// Prevent redundant setups.
	if (lastSetupTime == level.timeSeconds) {
		return;
	}

	// Timer control.
	timeSeconds += (level.timeSeconds - lastLevelTimeSeconds) / level.timeDilation;
	lastLevelTimeSeconds = level.timeSeconds;
		
	// Check if the base variables need to be updated.
	bUpdateBase = lastResX != c.clipX ||
	              lastResY != c.clipY ||
				  bForceUpdate;
	
	// Update HUD base variables.
	if (bUpdateBase) {	

    // Set base hud color.
        
		// General variables.
		baseFont = getFont(chatMsgSize, c);
		c.font = baseFont;
		c.strLen("Online [00:00]", minPanelWidth, baseFontHeight);
		lastResX = c.clipX;
		lastResY = c.clipY;
		
		// Message box info.
		msgBoxWidth = int(c.clipX * 0.75);
		msgBoxLineHeight = int(baseFontHeight + 4.0);
		msgBoxHeight = msgBoxLineHeight * chatMsgMaxCount;
		
		// Other messages.
		otherFont = getFont(otherMsgSize, c);
		c.font = otherFont;
		c.strLen("XXX", dummy, otherFontHeight);
		
		bForceUpdate = false;
	}
	
	// Remove expired messages.
	if (chatMsgCount > 0 && timeSeconds - chatMessages[0].timeStamp > chatMessageLifeTime) {
		for (index = 1; index < chatMsgCount; index++) {
			chatMessages[index - 1] = chatMessages[index];
		}
		chatMsgCount--;
		if (chatMsgCount == 0) {
			faceImg = none;
		}
	} 
	if (msgCount > 0 && timeSeconds - messages[0].timeStamp > messageLifeTime) {
		for (index = 1; index < msgCount; index++) {
			messages[index - 1] = messages[index];
		}
		msgCount--;
	} 
	
	lastSetupTime = level.timeSeconds;
}


Image



Letylove49 aka Alicia
Eternity
Skilled
Posts: 172
Joined: Sat Nov 30, 2019 10:56 pm

Re: HolywarsNexgenHudFix

Post by Eternity »

As it was mentioned above, Level.Game is None if Level.NetMode==NM_Client (need to use another GameType sign that exists client side, for example GameReplicationInfo).
Also, initialization scripts should be called from within some event (such as PostBeginPlay), and using proper UC syntax...

Automatically merged

These "setup(Canvas s)" functions obviously must be called from PostRender event.
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Error: C:\UT coding\UnrealTournament\Nexgen112SDL\Classes\NexgenHUD.uc(786) : Error, Unexpected 'if'

Post by Barbie »

Letylove49 wrote: Sun Oct 09, 2022 9:38 pm

Code: Select all

if(Level.Game.IsA('HolyWarsGame'))
As mentioned above Level.Game is always NONE in a HUD class. Better use such as

Code: Select all

if (PlayerPawn(Owner) != None)
	if (PlayerPawn(Owner).GameReplicationInfo != None)
		if (PlayerPawn(Owner).GameReplicationInfo.IsA('HolyWarsGame'))

Letylove49 wrote: Sun Oct 09, 2022 9:38 pm Error: C:\UT coding\UnrealTournament\Nexgen112SDL\Classes\NexgenHUD.uc(786) : Error, Unexpected 'if'

Code: Select all

if(...) goto Function setup1;
else goto function setup;
You mixed up a GOTO with a function call. Use GOTO within a code block. Call another function just by its name.
Example for GOTO (The GoTo statement should generally be avoided. (Why?)):

Code: Select all

function JonDoe()
{
	if (WhatEver) goto Label1;
	// do some other stuff here
Label1:
	// this is executed in every case
} // function JonDoe() ends here
Example for function call:

Code: Select all

if (...) setup1();
else setup();
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Re: HolywarsNexgenHudFix

Post by Letylove49 »

this not work. i got the same error with this:

Code: Select all

if (PlayerPawn(Owner) != None)
	if (PlayerPawn(Owner).GameReplicationInfo != None)
		if (PlayerPawn(Owner).GameReplicationInfo.IsA('HolyWarsGame')) setup1();
else setup();
} 
Image



Letylove49 aka Alicia
Post Reply