How to check for a specific hero situation?

I managed to change Ana’s sleep dart to apply a sleep effect on a target. However, I want it to not apply if the target is specifically a Reinhardt that is charging. (Realistically I’d say I’d need to condition it to trigger on anything other than the charging Reinhardt but I don’t care which way it’s accomplished if it were to work.)

rule("Ana - Status Sleep Dart")
{
	event
	{
		Ongoing - Each Player;
		All;
		Ana;
	}

	conditions
	{
		Is Game In Progress == True;
		Is Button Held(Event Player, Button(Ability 1)) == True;
		Ability Cooldown(Event Player, Button(Ability 1)) == 0;
	}

	actions
	{
		Set Status(Ray Cast Hit Player(Eye Position(Event Player), Eye Position(Event Player) + Facing Direction Of(Event Player) * 100,
			All Players(Opposite Team Of(Team Of(Event Player))), Event Player, True), Null, Asleep, 5);
	}
}

This specific case is for a charging Reinhardt, but I’d generally like to see if it’s possible to have some way to add these exceptions manually - if possible - so I could say “This doesn’t work on a Fortified Orisa AND Charging Rein AND Transformed Rammatra” etc.
Anyone think they’d be up for the challenge?

this sounds like you can just use a “Is true for Any” inside a condition or filter.

  • Hero of == Reinhardt && is using ability 1
  • Hero of == Orisa && is using ability 1
  • Hero of == Ramattra && is in alternative form

and for any others just add a new entry to the array with the hero and ability detection.
im not sure what exactly your trying to do whether your want to block the sleep, trigger the sleep, create a workshop sleep, etc.

but not matter what it is this ‘is true for any’ should help.

(keep in mind to detect duplicated players where you would use a ‘Hero of’, instead replace it with “if ‘duplicating’ then ‘duplicated hero of’ else ‘hero of’”)

1 Like

Ok, ok, I do get what you’re saying from a logical standpoint but how would I do that check on a ray cast player hit within OW?

I’m getting the target that’s supposed to be evaluated with the ray cast in the action part of the code I posted. I managed to make Ana’s sleep dart shoot and do everything but not sleep a target through the use of a workshop bug I guess. I apply a WORKSHOP sleep through the ray cast in order to have more control over who it gets applied to but I’m not sure I get how to put in this “Is true for Any” jigsaw piece.

I didn’t quite understand what you meant, so I just made a proof of concept in the workshop instead Code: 4N7F2. one of the methods didn’t work due to unexpected difficulties (listed in a comment), but the other 2 worked as expected in-game, preventing the use of sleep dart.

(wouldn’t recommend the ‘Enbedded Casting’ option, far too messy and difficult to edit tbh i think it might even crash your game if you open the ‘is true for any’ condition, idk as i made it in VS-Code…)

i just figured this would be easier then me misunderstanding you, and leaving you with the question unanswered until the next comment.

and of course you can replace the script with whatever anti-sleep bug you’ve found, my cancel method was just a temporary placeholder for testing.

EDIT: just found out Ramattra’s Alternate Form data is bugged. just replace it with using Ability 1 like the rest and it’ll work

1 Like

Holy hell that’s complicated to look at…
Anyway I did try to put the “Is true for any” to use but it seems to me that Workshop is bugged and Abort If does absolute jack:

At first I tried putting your exact code into the game but it didn’t seem to work for me. I figured I just missed some detail somewhere which made it not work so I tried to simplify the entire thing into a very basic condition from which I could then branch out just to test if it works correctly:

variables
{
	player:
		24: StaticCast
		25: Hero
}

rule("Ana - Status Sleep Dart")
{
	event
	{
		Ongoing - Each Player;
		All;
		Ana;
	}

	conditions
	{
		Is Game In Progress == True;
		Is Button Held(Event Player, Button(Ability 1)) == True;
		Ability Cooldown(Event Player, Button(Ability 1)) == 0;
	}

	actions
	{
		Event Player.StaticCast = Ray Cast Hit Player(Eye Position(Event Player), Eye Position(Event Player) + Facing Direction Of(Event Player) * 99, All Living Players(Opposite Team Of(Team Of(Event Player))), Event Player, True);
		Wait(0.016, Ignore Condition);
		Abort If(Event Player.StaticCast == Hero(Reinhardt));
		Set Status(Event Player.StaticCast, Null, Asleep, 5);
	}
}

First I did it without the wait but it still put Reinhardt to sleep. I then added the wait because I thought that maybe it didn’t manage to update the variable before triggering but it still doesn’t work and I can put Reinhardt to sleep.

When I checked through the inspector, even if it had the “Abort if” action as green/true, it still went on and set the Workshop sleep status. (I know it’s this workshop sleep status because I have a debug to cancel all sleep on all characters on a button press and that worked.) I did do a debug HUD writeout so that I can see the current Event Player.StaticCast value and it did set correctly so I have no idea if I’m wrong somewhere or if Workshop is just being a female dog again.

your checking if a Player is equal to a Hero… not if a Players’ Hero is equal to a Hero, meaning its impossible to be true (i dont think inspector color matters, but i’ve never tested before)

you need Hero of(Event Player.StaticCast) == Hero(Reinhardt)

the full code without that error for easy copy pasting:

variables
{
	player:
		24: StaticCast
		25: Hero
}

rule("Ana - Status Sleep Dart")
{
	event
	{
		Ongoing - Each Player;
		All;
		Ana;
	}

	conditions
	{
		Is Game In Progress == True;
		Is Button Held(Event Player, Button(Ability 1)) == True;
		Ability Cooldown(Event Player, Button(Ability 1)) == 0;
	}

	actions
	{
		Event Player.StaticCast = Ray Cast Hit Player(Eye Position(Event Player), Eye Position(Event Player) + Facing Direction Of(Event Player) * 99, All Living Players(Opposite Team Of(Team Of(Event Player))), Event Player, True);
		Wait(0.016, Ignore Condition);
		Abort If(Hero of(Event Player.StaticCast) == Hero(Reinhardt));
		Set Status(Event Player.StaticCast, Null, Asleep, 5);
	}
}
1 Like

I wish I could program in the Spiderman sound whenever you would happen to join any of my Custom games as a form of thank you for your unending help…

You are a true hero.

1 Like