Player outline visible on ability cooldown

Hey, I’m trying to work out how to make Ana visible (her outline) to the enemy team when her sleep dart is on cooldown. Then outline to disappear when its off cooldown. Anyone know how to do this in workshop rules?

The easiest thing would just be to use a 14-second timer.

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

	conditions
	{
		Ability Cooldown(Event Player, Button(Ability 1)) == True;
	}

	actions
	{
		Start Forcing Player Outlines(Event Player, All Players(Opposite Team Of(Team Of(Event Player))), True, Color(Red), Always);
		Wait(14, Ignore Condition);
		Stop Forcing Player Outlines(Event Player, All Players(All Teams));
	}
}

Alternatively, you could make a loop that checks several times a second if the ability is still on cooldown and, if not, removes the outline. This necessarily means that the outline will linger for one check after the ability comes off of cooldown, but the checks happen every tenth of a second then that hardly matters.

This one is really only more useful if Sleep Dart’s 14-second cooldown changes some time in the future, or if you have some rule that changes or resets it.

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

	conditions
	{
		Ability Cooldown(Event Player, Button(Ability 1)) == True;
	}

	actions
	{
		Start Forcing Player Outlines(Event Player, All Players(Opposite Team Of(Team Of(Event Player))), True, Color(Red), Always);
		While(Ability Cooldown(Event Player, Button(Ability 1)));
			Wait(0.100, Ignore Condition);
			Loop If Condition Is True;
			Stop Forcing Player Outlines(Event Player, All Players(All Teams));
	}
}

The while loop in combination with the loop that restarts the action sequence is not necessary, for server load’s sake choose one of them.

1 Like

I wasn’t sure how to designate the beginning of the loop. I didn’t want to loop the whole rule, forcing player outlines 10 times a second. “While” seemed like what I was looking for, but I guess not?

Another alternative is to create two rules: one which begins forcing outlines and another which checks the CD and stops forcing outlines. There must be a way to condense it into one rule, though.

That way is called Wait Until.

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

	conditions
	{
		Hero Of(Event Player) == Hero(Ana);
		Ability Cooldown(Event Player, Button(Ability 1)) > 0;
		Is Alive(Event Player) == True;
	}

	actions
	{
		Start Forcing Player Outlines(Event Player, All Players(Opposite Team Of(Team Of(Event Player))), True, Color(white), Default);
		Wait Until(Is Dead(Event Player) || !Ability Cooldown(Event Player, Button(Ability 1)), 30);
		Stop Forcing Player Outlines(Event Player, All Players(Opposite Team Of(Team Of(Event Player))));
		Loop If Condition Is True;
		
	}
}

However not looping can cause the issue of Players joining during the Visible state which isn’t reevaluated and in turn can temporarily cause the Outline to not be visible when it should be.

And the above example breaks if the Sleep Dart cooldown is extended beyond 30secs by any other Rules…
The Hero check is a Condition because Rules that are tied to heroes are immediately aborted as soon as that Hero isn’t being played anymore, which in this case would cause the outlines to stay active…

3 Likes

Hey,

I used your second suggestion with End in between the loop if condition is true and last stop forcing players condition and it worked the way I wanted! Ace advice! Many thanks for you help!