Why doesn't my beam weapon work? (Solved)

It only damages 1 target. Nothing else. And it always seems to be the same target. Here’s my code:

rule("[POWER]: Energy Beam Projectile")
{
event
{
Ongoing - Each Player;
Team 1;
Doomfist;
}

conditions
{
	Is Button Held(Event Player, Primary Fire) == True;
	Is Alive(Event Player) == True;
	Player Variable(Event Player, C) == 1;
	Value In Array(Global Variable(A), 1) == 1111;
}

actions
{
	Abort If(Has Status(Event Player, Knocked Down));
	Abort If(Has Status(Event Player, Stunned));
	Abort If(Has Status(Event Player, Asleep));
	Abort If(Has Status(Event Player, Rooted));
	Play Effect(All Players(All Teams), Ring Explosion Sound, White, Event Player, 10000);
	Set Player Variable(Event Player, U, Ray Cast Hit Position(Eye Position(Event Player), Add(Eye Position(Event Player), Multiply(
		Facing Direction Of(Event Player), 1000)), All Players(All Teams), Event Player, True));
	Set Player Variable(Event Player, V, Eye Position(Event Player));
	Create Beam Effect(All Players(All Teams), Bad Beam, Eye Position(Event Player), Player Variable(Event Player, V), Purple,
		Visible To Position and Radius);
	Set Player Variable(Event Player, Y, Last Created Entity);
	Play Effect(All Players(All Teams), Bad Explosion, Purple, Event Player, 5);
	Play Effect(All Players(All Teams), Bad Explosion, Purple, Player Variable(Event Player, U), 5);
	Chase Player Variable At Rate(Event Player, V, Player Variable(Event Player, U), 240, Destination and Rate);
	Wait(0.300, Ignore Condition);
	Destroy Effect(Player Variable(Event Player, Y));
	Wait(8.750, Ignore Condition);
}

}

rule("[POWER]: Energy Beam Effects")
{
event
{
Ongoing - Each Player;
Team 1;
Doomfist;
}

conditions
{
	Distance Between(Player Variable(Event Player, V), All Players(Opposite Team Of(Team Of(Event Player)))) < 6;
	Is Button Held(Event Player, Primary Fire) == True;
	Player Variable(Event Player, C) == 1;
	Value In Array(Global Variable(A), 1) == 1111;
}

actions
{
	Abort If(Has Status(Event Player, Knocked Down));
	Abort If(Has Status(Event Player, Stunned));
	Abort If(Has Status(Event Player, Asleep));
	Abort If(Has Status(Event Player, Rooted));
	Damage(Closest Player To(Player Variable(Event Player, V), Opposite Team Of(Team Of(Event Player))), Event Player, 120);
	Wait(9.050, Ignore Condition);
	Set Player Variable(Event Player, V, Vector(0, 0, 0));
}

}

And here’s a video link to show you what I mean: - YouTube

Distance between takes exactly 2 positions as input. It doesnt work with arrays. If you give it an array it will just use the first entry.

So instead you could use damage(players within radius(player variable(event player, U), 6, opposite team of(event player), *los*), event player, 120)

rule("[POWER]: Energy Beam Projectile")
{
event
{
Ongoing - Each Player;
Team 1;
Doomfist;
}

conditions
{
	Is Button Held(Event Player, Primary Fire) == True;
	Is Alive(Event Player) == True;
	Player Variable(Event Player, C) == 1;
	Value In Array(Global Variable(A), 1) == 1111;
}

actions
{
	Abort If(Has Status(Event Player, Knocked Down));
	Abort If(Has Status(Event Player, Stunned));
	Abort If(Has Status(Event Player, Asleep));
	Abort If(Has Status(Event Player, Rooted));
	Play Effect(All Players(All Teams), Ring Explosion Sound, White, Event Player, 10000);
	Set Player Variable(Event Player, U, Ray Cast Hit Position(Eye Position(Event Player), Add(Eye Position(Event Player), Multiply(
		Facing Direction Of(Event Player), 1000)), All Players(All Teams), Event Player, True));
	Set Player Variable(Event Player, V, Eye Position(Event Player));
	Create Beam Effect(All Players(All Teams), Bad Beam, Eye Position(Event Player), Player Variable(Event Player, V), Purple,
		Visible To Position and Radius);
	Set Player Variable(Event Player, Y, Last Created Entity);
	Play Effect(All Players(All Teams), Bad Explosion, Purple, Event Player, 5);
	Play Effect(All Players(All Teams), Bad Explosion, Purple, Player Variable(Event Player, U), 5);
	Chase Player Variable At Rate(Event Player, V, Player Variable(Event Player, U), 240, Destination and Rate);
	Wait(0.300, Ignore Condition);
	Destroy Effect(Player Variable(Event Player, Y));
	Wait(4, Ignore Condition);
	Set Player Variable(Event Player, V, Eye Position(Event Player));
}

}

rule("[POWER]: Energy Beam Effects")
{
event
{
Ongoing - Each Player;
Team 1;
Doomfist;
}

conditions
{
	Distance Between(Player Variable(Event Player, V), Closest Player To(Player Variable(Event Player, V), Team 2)) < 3;
	Is Button Held(Event Player, Primary Fire) == True;
	Player Variable(Event Player, C) == 1;
	Value In Array(Global Variable(A), 1) == 1111;
}

actions
{
	Abort If(Has Status(Event Player, Knocked Down));
	Abort If(Has Status(Event Player, Stunned));
	Abort If(Has Status(Event Player, Asleep));
	Abort If(Has Status(Event Player, Rooted));
	Damage(Closest Player To(Player Variable(Event Player, V), Opposite Team Of(Team Of(Event Player))), Event Player, 120);
	Wait(7.700, Ignore Condition);
}

}

This ended up working for some reason

Why are you using aborts in your actions when you can use the conditions? What is the 7.7 sec wait for?

1 Like

It’s part of my game, where you the boss (Doomfist) can’t use his infinity gauntlet if he is cc’d and the wait is a cooldown.