Does Raycasting not work for Sigma?

My goal is to apply an effect to the character that is being aimed at when using ability 1. I made the following rule to execute exactly that but no status is being applied to the hero test bot in the practice range. Is there something wrong there that I’m not comprehending or is it just Workshop being broken again?

rule("Sigma - Force Hold")
{
	event
	{
		Ongoing - Each Player;
		All;
		Sigma;
	}

	conditions
	{
		Is Game In Progress == True;
		Is Using Ability 1(Event Player) == True;
	}

	actions
	{
		Set Status(Ray Cast Hit Player(Eye Position(Event Player), Facing Direction Of(Event Player), All Players(All Teams), Event Player,
			True), Event Player, Asleep, 9999);
	}
}

you’ve done the formula wrong.

you have “Ray Cast Hit Player(Eye Position(Event Player), Facing Direction Of(Event Player)” (this will cast from the eye position to somewhere within 1 meter from vector 0, 0, 0)

you need “Ray Cast Hit Player(Eye Position(Event Player), Eye Position(Event Player) + (Facing Direction Of(Event Player) * {Distance to Cast})” (if distance is too high it will also break, not sure why. I think anything as high 9999 or maybe 99999… something like that, you gotta watch out for it)

Facing Direction will give the Direction, it needs to be added with eye position to get the position ahead of where the player is facing, and then multiply the direction otherwise it’ll only check 1 meter ahead

I hope understanding the formula will help you remember it in the future, when I figured out what made it tick, I never forgot how to make it.


Side note: this code will only apply sleep to the player the sigma is looking at when the ability is first used, you need a condition checking for if the casting detects somebody / make it always loop this.

(probably should also add a filter to prevent the sleep being applied on sleeping targets but thats up to you, if you want to or not)

1 Like

That is most likely not the issue because it didn’t work even when I was basically kissing the bot when using ability 1 as Sigma.

Anyway, I tweaked the code in the way you stated:

rule("Sigma - Force Hold")
{
	event
	{
		Ongoing - Each Player;
		All;
		Sigma;
	}

	conditions
	{
		Is Game In Progress == True;
		Is Using Ability 1(Event Player) == True;
	}

	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, False), Event Player, Asleep, 3);
	}
}

And it still doesn’t seem to work. I look at the hero bot and nothing happens. (The end status won’t be Sleeping, I just use sleeping because it has the very obvious animation tied to it so I don’t need to keep an eye out for subtle feet coloring and such.)

the formula is still wrong

you have “eye position, (eye position + facing) * 100”

you need “eye position, eye position + (facing * 100)”

you just multiply in the whole position instead of the direction thats all.

Example:
eye position = 22, 75, 91
facing = 1, 0.4, 0.8 (facing x, y, z ranges from -1 to 1)

eye position + facing = 23, 75.4, 91.8

eye position + (facing * 2) = 24, 75.8, 92.4

(eye position + facing) * 2 = 46, 150.8, 183.6

rule(“Sigma - Force Hold”)
{
event
{
Ongoing - Each Player;
All;
Sigma;
}

conditions
{
Is Game In Progress == True;
Is Using Ability 1(Event Player) == True;
}

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, False), Event Player, Asleep, 3);
}
}

this code has been tested in-game and worked perfectly fine. it looks almost identical but it does have a single “()” no longer there.

2 Likes

Gotta love the in-game condition system… :upside_down_face:
Thank you very much, it’s working as intended!

I tried to force Sigma to stare at the affected character with an identical raycast but didn’t have much luck so I dropped that part entirely. Thank you very much again!

Small correction it can be range from -1 to 1. The special case of a directional vector is as a unit or normalized vector (e.g a players facing direction) it’s magnitude regardless of it’s components ranging from -1 to 1 is equal to 1.

right… right, don’t see the value much despite how much I use it. should’ve remembered that though.

however the point of saying the range wasn’t so they know it, it was just so they could better understand what adding the direction to the eye position was doing in case they didn’t realize a facing direction was basically just a small position.

either way I think it helped them better understand the formula.

They might understand it better, but that little line triggered me nonetheless especially with the restrictor “only” in your phrasing. It just reads wrong when it’s meant as a factual statement.

Use an highlevel language such as Deltinteger or OverPy instead. Will give you more control for editing rules and conditions without working with laggy workshop UI.

  • Deltinteger (C# like syntax): https://github.com/ItsDeltin/Overwatch-Script-To-Workshop
  • OverPy (python like syntax): https://github.com/Zezombye/overpy