Overwatch Workshop duplicated HUD glitch

I’m working on a HUD and the issue I’m having with it is when a round is over, or I switch to another hero than back to that hero with the HUD, it duplicates it self and puts another one below it. and it keeps going until I restart the gamemode. When I switch between heroes it goes away (like it should) so that part is fine, its just when I come back to that specific hero with the HUD it duplicates itself.

I think there’s a couple things that could be going wrong and it’s hard to tell what the problem is without seeing the code. One theory is that the HUD is being created when a player is a certain hero, and that HUD is only visible to players playing that hero, so that when you switch off, the HUD isn’t actually being deleted but instead is just not visible, and then when you switch back to the hero, it creates the HUD again and the old one becomes visible again. Again, we’d have to see the code for sure to know what’s going on though.

Ah I think you are right, because you described perfectly whats happening, how do I code it, or what should I add to make the old one get deleted after it disappears.

You can check in a global rule if the game is between a round or when a round winner is declared you destroy all huds for all players, then in the next round the HUDs will be recreated again like when you started the game or the match goes into progressing or processing state, alternatively but not best suited is to flag for any player that a HUD was created after they spawned with a player variable like here:

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

	conditions
	{
		(!Event Player.A && Is Alive(Event Player) && Has Spawned(Event Player)) == True;
	}

	actions
	{
		Event Player.A = True;
		Create HUD Text(Event Player, Custom String("This Is a test!"), Null, Null, Left, 0, Color(White), Color(White), Color(White),
			Visible To Sort Order String and Color, Default Visibility);
	}
}
1 Like

I understand what you’re saying but what do you mean by " && "?

&& is the logical AND operator for booleans and returns a boolean as true if their operands are all the same otherwise if one operand would be not the same as the others the AND operator returns a bool as false, booleans can be either true ( equals 1 or On state) or false (equals 0 or Off state). The code you see is the text converted format of the in game workshop editor, you can copy and paste the textual code back into the editor like you would copy and paste Rules and script blocks like actions or conditional expressions like in the example above around within the editor where you would normally work in.

ahhh thank you very much this helped a lot!

No problem :slight_smile:

Couldn’t you just write:

Event Player.A == False;
Is Alive(Event Player) == True;
Has Spawned(Event Player) == True;

since there is an implicit “and” connecting conditions anyway?

1 Like

Yeah it’s also possible and may be enhance readability, since the lists are like Arrays, workshop may iterate on each set of condition expression as they would be placed at indexes, so the third option would be one Array of Boolean with Is True For All, i thought with the conjunction of using a chain of ANDs the workshop will interpret it as one conditional expression since the AND returns one boolean which will be compared with the value true and is accessed in condition list at index 0, idk if any of these have any impact on evaluation processes. Cause for me the event rules could be an equivalent of a c++ function pointer or C# event delegate from my background of experience where the input parameters like conditions and actions are passed as Array datas but who knows.^^

1 Like

Ah I see.

The “third option array” would probably only be an array of 1 byte entries though (since bits are probably not possible to address).
But I get your point.

1 Like