Player HUDs disappear when switching teams (PTR only)

On PTR, player HUDs disappear when a player gets moved to opposite team. Doesn’t matter if it’s done via lobby or the new workshop action “Move player to team”. Only global HUDs are visible, player HUDs get destroyed as soon as they get created. If the player is moved to spectators first and then to a team afterwards, everything is OK.

actually i personally think this isnt a bug, once you assign a HUD to a specific player, it records everything about that specific player including the team that they belong to. If you decide to CHANGE the player’s team, the HUD won’t be able to recognize the player anymore since its different from the team that the HUD element has recorded for the player in order to recognize that player. Although, this is just a wild guess

The HUDs don’t disappear in live version though, just in PTR. Also, if you move the player (in PTR) to another team and then perform an action that creates a new HUD for that player, the HUD appears and immediately disappears. Like, you can see it for a split second.

I still don’t get it why all this happens, because in my script, all player HUDs are destroyed/created when the player spawns, so it really shouldn’t matter if the player changes team or not, because basically everything is reset as soon as the player respawns.

Wait, do you Destroy Hud thats stored in a Variable after moving them from team to team?

If so you are trying to destroy a Hud that isnt Stored in the Variable that you try to destroy which causes all Player Hud to get Corrupted / Destroyed.
Correct me if I’m wrong but you are trying to use ‘Destroy HUD Text’
once the player Spawned and probably try to destroy a Hud that’s supposedly stored in a Variable, when a Players Team is changed they get a completely new Variable set A - Z.
You would in this case destroy the Hud ID “0” which doesn’t exist and causes all Player based Hud to get destroyed.
If the Player actually already had spawned on a different Team you need to
Reset the Variables and then can actually Destroy the old Hud. (Which shouldn’t exist anyway)

You need a Rule like

Event
{
	Player Joined Match;
	All;
	All;
}

actions
{
	Event Player.A = Event Player.A
	If(Event Player.A);
		Destroy HUD Text(Event Player.A);
	Else;
		Create HUD Text(Event Player, Null, Null, Custom String("Hi."), Left, 7, Color(White), Color(White), Color(White),
			Visible To and String, Default Visibility);
		Event Player.A = Last Text ID;
	End;
}

All player HUDs are stored in a variable as LastTextID, I have no “loose” HUDs. Whenever a player spawns, there are multiple actions “Destroy HUD Text (Value in array, index No, etc.)” then there is a Wait (0,018 sec) action after which all the necessary HUDs are created again and stored in player variable. That variable is the same for all players in either team. But still… Everything works in live version, WHAT are the changes made in the PTR?

The only changes are towards, context of Global and Player Entity, some reevaluation tweaks for Effect Creation especially for the Positions. And they added a new Value called Local Player, which can only be used for visual properties like mentioned effect creation and HuDs, the new value scopes the end users screen rather than the player or character entity during a game or in a level/map, but i still can’t get any relation or correlaton between these things and your problem with the HUDs, my guess is the contextual pattern that got somewhat changed you can look here for more details. Overwatch PTR Patch Notes – February 9, 2021 - PTR Feedback - Overwatch Forums (blizzard.com)

2 Likes

OK, now I’m really curious why noone else is concerned. I deleted ALL rules and made just this one (abolutely nothing else, no variables, nothing):

Summary
rule("Rule 1")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is Button Held(Event Player, Button(Melee)) == True;
	}

	actions
	{
		Create HUD Text(All Players(All Teams), Custom String("Testing!"), Null, Null, Left, 0, Color(Green), Color(White), Color(White),
			Visible To and String, Default Visibility);
	}
}

When you first spawn and push the melee button, HUD gets created - all is fine. But as soon as you move the player directly to another team, the HUD gets immediately destroyed as soon as it is created. Or it just vanishes, because the inspector doesn’t even show that it gets destroyed, it only shows that the HUD is created. I can put a video if it seems like I’m imagining things…

Seems like the Effect or HUD looses it’s global presistency when created within a Player Event. Do you swapped teams during a processing Match or while waiting for Players?

2 Likes

I tried swapping both while waiting for players and also while game is in progress. Same outcome. EDITED: Also, player can create multiple HUDs with this rule and once the player is moved to another team those HUDs are still visible (since the rule is to be visible to all players in this case), but as soon as the player presses Melee button, it’s all gone. And if you press again - HUD appears and vanishes, and so on…

I get kind of the same issue as i reconstruct your concerns, when i press the required Button to create the HUD, the HUD stays presistent when i swap which shouldn’t actually, and when i press a specific Button again the HUD element disappears for me too and pressing it a third time won’t revive it back. So i would declare it as a bug and report it under the corresponding Section e.g. PTR Bug Report, i personally create HUDs under Global Contexts and work with the visiblity reevaluation maybe the way you do it might be wrong or not. But you said on Live it works without Problem with the same handle you provided above or do you create the HUD at different event contexts, conditions or so?

2 Likes

So the same single rule as I posted above and here how it behaves.

Live:
Player initially spawns. Presses button, creates the HUD. Player gets moved to another team - the HUD is gone. But when the button is pressed, the HUD is created again just like when the player initially spawned. In my book - everything how it should be.

PTR:
Player initially spawns. Presses button, creates the HUD. Player gets moved to another team - the HUD created earlier is NOT gone. But when the button is pressed, the HUD created earlier vanishes and a new one is visible only for a split second and then vanishes. Pressing the button again - HUD gets created and immediately vanishes.

2 Likes

Alright, i would recommending to flag this as a PTR specific Bug then, and meanwhile testing further on PTR i would create HUDs with Global events and rely on Viibility reevaluaion, to avoid that bug until its fixed, the HUD should regardless of Team swaps created again except the max entity count for these is reached.

3 Likes

I guess HUDs with global rules it is since the now live version has the same issue… But how do I show a player’s individual player variable in a HUD to that said player only? I figured, I could create a global HUD Visible to “Player in slot 0” and in the string there would be Player variable A (player in slot 0). That would require to create the HUDs for each player slot. Is that the right way?

You can use multidimensional Arrays or just Arrays in context with Filtered Array references, to handle individual Player Variables, but for better controlling or if you are unfamiliar with Arrays yeah creating a HUD for each Player might be the way. It depends on what you are trying to do, should this HUDs be presistent all the time or respond to something when something is considered to be changed, e.g. Joining or Leaving, which can happy occusionally for that case you can Map and store Last Created Entities in Global Arrays where their indecies represents each Players slot within a Team, to keep track and allow recreation and destruction when needed.

2 Likes

Oh… Would “Local player” fix the problem? So I don’t have to create new HUD for each slot?

If i remember Local Player would be enough and you can use Variable A… etc. refering to the Local Player. could be the best alternative.

2 Likes

I am familiar with arrays in the very basic level. Store value in array, then retrieve it, that’s it. I need the player to see the cooldowns and things like, picked up items. When an ability is armed/loaded, etc.

But yea, HUDs in Ongoing-player rules are officially dead from now on.