Moira code is annoying

Anyone know how to make it so when she shoots her primary (heal) it grows people, and when she shoots her secondary (damage) it shrinks people? I would like this command to work on enemies so that would be nice. Thanks!

There are several ways you could go about it, but depends on how your game is set up. Is there Only 1 Moira? or 1 Moira per team? or can everyone be Moira?

Can Moira Grow/Shrink All players OR only Grow (or shrink) her Allies and Shrink (or grow) enemies?

If the ladder, you can make use of the Player Dealt Healing/Damage Rule OR Player Received Healing/Damage rule. Which makes it a little easier when specifying What players do What action.

Else you’ll have to play around with Players In View Angle. Play around with the View angle Size (I’d start off with 25?) & also add conditions to IF the player(s) {the players who’s size is changing} are Outside “that” view angle, or LOS is blocked.

Also, (assuming there are multiple Moira) what happens when 1 Moira is “growing” someone and another is “shrinking” the same person? OR 2 Moira are Growing/Shrinking the same person, does the Grow/Shrink speed increase?

While Players In View Angle is pretty straight forward, it has the drawback that the resulting hitbox is a cone, wich gives it a really big size on higher range.

You can make a beam-like hitbox with fixed width no matter the range like this:
https://us.forums.blizzard.com/en/overwatch/t/how-to-make-a-beam-attack/633472/4
But it is not beginner level workshop development.

2 Likes

There is a random chance for everyone to be Moira. (Very unlikely) but there can be multiple moiras in a match ALL on different teams. I want primary (healing) to grow and secondary (damage) to shrink. If you could send me code to do it or make a map and give me workshop code for it that would be great. Also if I was to only do IN VIEW ANGLE, players could be out of reach of the healing and still grow. Appreciate you!

Are you wanting a single-targeting or for it to affect anyone close enough in front of you?

Shoot, ya i forgot about that lol. You’d need to add a Filtered Array OR Remove from Array to keep the distance in check. Meaning, Filtered Array, Players w/in Radius (Whatever Moira’s Range is), LOS Yes/No, IS in View Angle.
OR Remove from array, Distance greater then (Whatever Moira’s Range is)

Here’s a Prototype of a working Grow Shrink script. You’ll have to play around with the View Angle & Rates at which people Grow/Shrink to see what works for you. Also, this doesn’t consider the distance between Moira and “others”. But does include LOS (but not shields, but that can be changed easily)

Made 2 versions. Use whatever version is easier for you to understand and tweek.

Ver 1:

variables
{
	player:
		0: Grow
		1: Shrink
		3: Grow_Rate
		4: Shrink_Rate
}

rule("Moira Grow/Shrink Rule")
{
	event
	{
		Ongoing - Each Player;
		All;
		Moira;
	}

	conditions
	{
		(Is Firing Primary(Event Player) || Is Firing Secondary(Event Player)) == True;
	}

	actions
	{
		If(Is Firing Primary(Event Player));
			Modify Player Variable(Filtered Array(Players in View Angle(Event Player, All Teams, 25), Is In Line of Sight(Event Player,
				Current Array Element, Barriers Do Not Block LOS) && Array Contains(Current Array Element.Grow, Event Player) != True), Grow,
				Append To Array, Event Player);
			Modify Player Variable(Filtered Array(All Players(All Teams), (Array Contains(Current Array Element.Grow, Event Player)
				&& !Is In Line of Sight(Current Array Element, Event Player, Barriers Do Not Block LOS)) || (Array Contains(
				Current Array Element.Grow, Event Player) && !Is In View Angle(Event Player, Current Array Element, 25))), Grow,
				Remove From Array By Value, Event Player);
		End;
		If(Is Firing Secondary(Event Player));
			Modify Player Variable(Filtered Array(Players in View Angle(Event Player, All Teams, 25), Is In Line of Sight(Event Player,
				Current Array Element, Barriers Do Not Block LOS) && Array Contains(Current Array Element.Shrink, Event Player) != True),
				Shrink, Append To Array, Event Player);
			Modify Player Variable(Filtered Array(All Players(All Teams), (Array Contains(Current Array Element.Shrink, Event Player)
				&& !Is In Line of Sight(Current Array Element, Event Player, Barriers Do Not Block LOS)) || (Array Contains(
				Current Array Element.Shrink, Event Player) && !Is In View Angle(Event Player, Current Array Element, 25))), Shrink,
				Remove From Array By Value, Event Player);
		End;
		Wait(0.240, Ignore Condition);
		Loop If Condition Is True;
		Modify Player Variable(All Players(All Teams), Grow, Remove From Array By Value, Event Player);
		Modify Player Variable(All Players(All Teams), Shrink, Remove From Array By Value, Event Player);
	}
}

rule("Grow/Shrink - Scale Action")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		(Event Player.Grow != Empty Array || Event Player.Shrink != Empty Array) == True;
		Is Alive(Event Player) == True;
	}

	actions
	{
		Start Scaling Player(Event Player, 1 + Event Player.Grow_Rate + Event Player.Shrink_Rate, True);
		Chase Player Variable At Rate(Event Player, Grow_Rate, 100, Count Of(Remove From Array(Event Player.Grow, 0)) * 0.100,
			Destination and Rate);
		Chase Player Variable At Rate(Event Player, Shrink_Rate, -100, Count Of(Remove From Array(Event Player.Shrink, 0)) * 0.100,
			Destination and Rate);
	}
}

rule("Player Died. Reset Values")
{
	event
	{
		Player Died;
		All;
		All;
	}

	actions
	{
		Wait Until(Has Spawned(Event Player), 10);
		Stop Chasing Player Variable(Event Player, Grow_Rate);
		Stop Chasing Player Variable(Event Player, Shrink_Rate);
		Stop Scaling Player(Event Player);
		Wait(0.016, Ignore Condition);
		Event Player.Grow_Rate = Null;
		Event Player.Shrink_Rate = Null;
		Event Player.Grow = Empty Array;
		Event Player.Shrink = Empty Array;
	}
}

rule("Player Joined.")
{
	event
	{
		Player Joined Match;
		All;
		All;
	}

	actions
	{
		Event Player.Grow = Empty Array;
		Event Player.Shrink = Empty Array;
	}
}

Ver 2:

variables
{
	player:
		0: Grow
		1: Shrink
		2: Rates
}

rule("Add to Grow Value")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is Alive(Event Player) == True;
		Is In View Angle(Remove From Array(Filtered Array(Players On Hero(Hero(Moira), All Teams), Is Firing Primary(
			Current Array Element)), Event Player), Event Player, 25) == True;
		Is In Line of Sight(Remove From Array(Filtered Array(Players On Hero(Hero(Moira), All Teams), Is Firing Primary(
			Current Array Element)), Event Player), Event Player, Barriers Do Not Block LOS) == True;
	}

	actions
	{
		Event Player.Rates[0] += 0.100;
		Wait Until(!Is In View Angle(Filtered Array(Players On Hero(Hero(Moira), All Teams), Is Firing Primary(Current Array Element)),
			Event Player, 25) || !Is In Line of Sight(Filtered Array(Players On Hero(Hero(Moira), All Teams), Is Firing Primary(
			Current Array Element)), Event Player, Barriers Do Not Block LOS), 60);
		Event Player.Rates[0] -= 0.100;
	}
}

rule("Add to Shrink Value")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is Alive(Event Player) == True;
		Is In View Angle(Remove From Array(Filtered Array(Players On Hero(Hero(Moira), All Teams), Is Firing Secondary(
			Current Array Element)), Event Player), Event Player, 25) == True;
		Is In Line of Sight(Remove From Array(Filtered Array(Players On Hero(Hero(Moira), All Teams), Is Firing Secondary(
			Current Array Element)), Event Player), Event Player, Barriers Do Not Block LOS) == True;
	}

	actions
	{
		Event Player.Rates[1] += 0.100;
		Wait Until(!Is In View Angle(Filtered Array(Players On Hero(Hero(Moira), All Teams), Is Firing Secondary(Current Array Element)),
			Event Player, 25) || !Is In Line of Sight(Filtered Array(Players On Hero(Hero(Moira), All Teams), Is Firing Secondary(
			Current Array Element)), Event Player, Barriers Do Not Block LOS), 60);
		Event Player.Rates[1] -= 0.100;
	}
}

rule("Grow/Shrink - Scale Action")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Event Player.Rates != 0;
		Event Player.Rates != Empty Array;
	}

	actions
	{
		Start Scaling Player(Event Player, 1 + Event Player.Grow + Event Player.Shrink, True);
	}
}

rule("Grow/Shrink - Chase Variable")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Event Player.Rates != 0;
		Event Player.Rates != Empty Array;
	}

	actions
	{
		Chase Player Variable At Rate(Event Player, Grow, 100, Event Player.Rates[0], Destination and Rate);
		Chase Player Variable At Rate(Event Player, Shrink, -100, Event Player.Rates[1], Destination and Rate);
	}
}

rule("Player Died. Reset Values")
{
	event
	{
		Player Died;
		All;
		All;
	}

	actions
	{
		Wait Until(Has Spawned(Event Player), 10);
		Stop Chasing Player Variable(Event Player, Grow);
		Stop Chasing Player Variable(Event Player, Shrink);
		Event Player.Grow = Null;
		Event Player.Shrink = Null;
		Event Player.Rates = Null;
		Stop Scaling Player(Event Player);
	}
}

Make sure, if you copy both versions, that NOT both are active at the same time, as they use the same variables and WILL CONFLICT!

On the first rule I am stuck after the BARRIERS DO NOT BLOCK LOS because then mine wants a variable? If u want photos add me on discord Sammus#1676 but I don’t know what to put in there. On your code it says && and I don’t know how to do that ESPECIALLY when it is asking for a variable

You can copy the text block and paste the rule in the workshop editor

I am on PlayStation. If you make a map for me to copy it from would that work?

S79BK

&& = AND
TL;DR
In the Condition or Compare section of most any rule/action, you can put multiple Conditions that need to be met. So in this example, in the Condition section of the Filtered Array where it [Normally] says Compare, you select from the drop down list, AND. This will then give you 2 new Value lines with the default setting TRUE. Which you then can change to Compare. Now you have 2 Conditions that need to be met to satisfy the Condition of the Filtered Array.
So in this example, I used “is in line of sight” and “Array Contains”.

Besta luck!

2 Likes