Hud Text bug, need help

Hi, I have bug with creating HUD Text when host move player from team 1 to team 2,
they just don’t want to be created, by inspector the conditions and actions happen but nothing create in real.

how could I fix it? and why it happen?
game code: D991V

for blizzard:
and what happen with my last topic? i didn’t find it.

Yes, it’s a known bug. In addition, it also increases the server load permanently. Just don’t move players directly from team to team. Move to spectators first and then to the team desired.

You made the last topic on the EU Forums, but this are the US Forums.


Also you might want to make

Event Player.playerShowHud[0]

into

Event Player.playerShowHud

as the Variable never is an Array


As to fixing your problem you’d want to use the Local Player Value instead of Event Player and Create every HUD only once per game not once per player
Resulting in:


variables
{
	global:
		0: blueTeamStats
		1: redTeamStats
		2: blueTeamLvlExp
		3: redTeamLvlExp

	player:
		0: playerStats
		2: playersLvlExp
		3: playerShowHud
}

rule("Rule 26")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		Create HUD Text(All Players(Team 1), Null, Null, Local Player.playerShowHud ? Custom String("Team Basic Stats:\r\n{0}",
			Custom String("{0}\r\n{1}\r\n{2}", Custom String("{0}: {1}%", String("Life"), Global.blueTeamStats[0]), Custom String(
			"{0}: {1}%", String("Damage"), Global.blueTeamStats[1]), Custom String("{0}\r\n{1}\r\n{2}", Custom String("{0} {1}: {2}%",
			String("Damage"), String("Heal"), Global.blueTeamStats[4]), Custom String("{0}: {1}%", String("Heal"),
			Global.blueTeamStats[6]), Custom String("{0}\r\n{1}\r\n{2}", Custom String("{0} {1}: {2}%", String("Projectile"), String(
			"Speed"), Global.blueTeamStats[8]), Custom String("{0} {1}: {2}%", String("Run"), String("Speed"), Global.blueTeamStats[10]),
			Custom String("{0}\r\n{1}\r\n{2}", Custom String("{0} {1}: {2}%", String("Jump"), String("Height"), Global.blueTeamStats[12]),
			Custom String("{0} {1}: {2}%", String("Obtain"), String("Damaging"), Global.blueTeamStats[14])))))) : Custom String(
			"Hold {0} button to look stats", Input Binding String(Button(Melee))), Left, 1, Color(White), Color(White), Team Of(
			Local Player), Visible To Sort Order String and Color, Default Visibility);
		Create HUD Text(All Players(Team 1), Null, Null, Local Player.playerShowHud ? Custom String("Your Actual Stats:\r\n{0}",
			Custom String("{0}\r\n{1}\r\n{2}", Custom String("{0}: {1}%", String("Life"),
			Local Player.playerStats[0] + Global.blueTeamStats[0]), Custom String("{0}: {1}%", String("Damage"),
			Local Player.playerStats[1] + Global.blueTeamStats[1]), Custom String("{0}\r\n{1}\r\n{2}", Custom String("{0} {1}: {2}%",
			String("Damage"), String("Heal"), Local Player.playerStats[2] + Global.blueTeamStats[4]), Custom String("{0}: {1}%", String(
			"Heal"), Local Player.playerStats[3] + Global.blueTeamStats[6]), Custom String("{0}\r\n{1}\r\n{2}", Custom String(
			"{0} {1}: {2}%", String("Projectile"), String("Speed"), Local Player.playerStats[4] + Global.blueTeamStats[8]), Custom String(
			"{0} {1}: {2}%", String("Run"), String("Speed"), Local Player.playerStats[5] + Global.blueTeamStats[10]), Custom String(
			"{0}\r\n{1}\r\n{2}", Custom String("{0} {1}: {2}%", String("Jump"), String("Height"),
			Local Player.playerStats[6] + Global.blueTeamStats[12]), Custom String("{0} {1}: {2}%", String("Obtain"), String("Damaging"),
			Local Player.playerStats[7] + Global.blueTeamStats[14])))))) : Custom String(" "), Left, 2, Color(White), Color(White),
			Team Of(Local Player), Visible To Sort Order String and Color, Default Visibility);
		Create HUD Text(All Players(Team 2), Null, Null, Local Player.playerShowHud ? Custom String("Team Basic Stats:\r\n{0}",
			Custom String("{0}\r\n{1}\r\n{2}", Custom String("{0}: {1}%", String("Life"), Global.redTeamStats[0]), Custom String(
			"{0}: {1}%", String("Damage"), Global.redTeamStats[1]), Custom String("{0}\r\n{1}\r\n{2}", Custom String("{0} {1}: {2}%",
			String("Damage"), String("Heal"), Global.redTeamStats[4]), Custom String("{0}: {1}%", String("Heal"), Global.redTeamStats[6]),
			Custom String("{0}\r\n{1}\r\n{2}", Custom String("{0} {1}: {2}%", String("Projectile"), String("Speed"),
			Global.redTeamStats[8]), Custom String("{0} {1}: {2}%", String("Run"), String("Speed"), Global.redTeamStats[10]),
			Custom String("{0}\r\n{1}\r\n{2}", Custom String("{0} {1}: {2}%", String("Jump"), String("Height"), Global.redTeamStats[12]),
			Custom String("{0} {1}: {2}%", String("Obtain"), String("Damaging"), Global.redTeamStats[14])))))) : Custom String(
			"Hold {0} button to look stats", Input Binding String(Button(Melee))), Left, 1, Color(White), Color(White), Team Of(
			Local Player), Visible To Sort Order String and Color, Default Visibility);
		Create HUD Text(All Players(Team 2), Null, Null, Local Player.playerShowHud ? Custom String("Your Actual Stats:\r\n{0}",
			Custom String("{0}\r\n{1}\r\n{2}", Custom String("{0}: {1}%", String("Life"),
			Local Player.playerStats[0] + Global.redTeamStats[0]), Custom String("{0}: {1}%", String("Damage"),
			Local Player.playerStats[1] + Global.redTeamStats[1]), Custom String("{0}\r\n{1}\r\n{2}", Custom String("{0} {1}: {2}%",
			String("Damage"), String("Heal"), Local Player.playerStats[2] + Global.redTeamStats[4]), Custom String("{0}: {1}%", String(
			"Heal"), Local Player.playerStats[3] + Global.redTeamStats[6]), Custom String("{0}\r\n{1}\r\n{2}", Custom String(
			"{0} {1}: {2}%", String("Projectile"), String("Speed"), Local Player.playerStats[4] + Global.redTeamStats[8]), Custom String(
			"{0} {1}: {2}%", String("Run"), String("Speed"), Local Player.playerStats[5] + Global.redTeamStats[10]), Custom String(
			"{0}\r\n{1}\r\n{2}", Custom String("{0} {1}: {2}%", String("Jump"), String("Height"),
			Local Player.playerStats[6] + Global.redTeamStats[12]), Custom String("{0} {1}: {2}%", String("Obtain"), String("Damaging"),
			Local Player.playerStats[7] + Global.redTeamStats[14])))))) : Custom String(" "), Left, 2, Color(White), Color(White), Team Of(
			Local Player), Visible To Sort Order String and Color, Default Visibility);
		Create HUD Text(All Players(Team 1), Null, Custom String("{0}: {1} / {2}", String("{0} {1}", String("Player"), String("Level")),
			Local Player.playersLvlExp[0], Global.blueTeamLvlExp[0]), Custom String("{0}: {1} / {2}", String("{0} {1}", String("Player"),
			String("Experience")), Local Player.playersLvlExp[1], Local Player.playersLvlExp[2]), Top, 2, Color(White), Color(Yellow),
			Color(Yellow), Visible To Sort Order String and Color, Default Visibility);
		Create HUD Text(All Players(Team 2), Null, Custom String("{0}: {1} / {2}", String("{0} {1}", String("Player"), String("Level")),
			Local Player.playersLvlExp[0], Global.redTeamLvlExp[0]), Custom String("{0}: {1} / {2}", String("{0} {1}", String("Player"),
			String("Experience")), Local Player.playersLvlExp[1], Local Player.playersLvlExp[2]), Top, 2, Color(White), Color(Yellow),
			Color(Yellow), Visible To Sort Order String and Color, Default Visibility);
	}
}

This has also the above mentioned change.

Or you simply Import: MYC6T
which has all changes made which are needed without the hassle of puzzling everything together.

thanks :slight_smile:
it takes me long time to understand what is Local Player, now I use it a lot in my new mode
J4MJ8 (If you move you die).

the main problem of Local Player that if player in spectator… he always see 0 :slight_smile:

Yeah the spectator thing is something you sadly can’t change, the only thing that would be possible would be to never show the spectators that HUD.

As long as you have such a big HUD String it ain’t really worth trying to make it Work for spectators.

I did notice however that you could at least break down the Team Stats into two different HUD’s one that’s only visible to Players with playerShowHud True and the Other being false.
Since the Team Values are Global Variables it would be at least possible to show those to spectators.


Something else that might have worked from the beginning (not sure though)

variables
{
	player:
		3: playerShowHud
}

rule("Rule 27")
{
	event
	{
		Player Joined Match;
		All;
		All;
	}

	actions
	{
		Event Player.playerShowHud = Event Player.playerShowHud;
		If(Event Player.playerShowHud);
		Else;
			Create HUD Text(All Players(Team 1), Custom String(""), Null, Null, Left, 0, Color(White), Color(White), Color(White),
				Visible To and String, Default Visibility);
		End;
	}
}

The Create HUD is a place holder for the original HUD which was created at the Player level.

thanks, now i’m working on J4MJ8
so when will have time will try to upgrade this mode too :3

1 Like