How do you give a beam effect a hitbox

How do you give a beam effect a hit box im trying to make a trip wire and i made the visual, but i dont know how to actually make it trip someone heres the code

rule(“sym if the lines are close make it”)
{
event
{
Ongoing - Each Player;
Team 1;
Symmetra;
}

conditions
{
	Hero Of(Event Player) == Hero(Symmetra);
	Team Of(Event Player) == Team 1;
	Distance Between(Player Variable(Event Player, D), Player Variable(Event Player, F)) <= 10;
	Player Variable(Event Player, C) == 3;
}

actions
{
	Create Beam Effect(All Players(All Teams), Grapple Beam, Player Variable(Event Player, D), Player Variable(Event Player, F), White,
		Visible To Position and Radius);
	Set Player Variable(Event Player, G, Last Created Entity);
	Set Player Variable(Event Player, C, 0);
}

}

You could maybe make your own hitbox detection rule, although you would need to calculate the position of the hitbox and the calculations may take a strain on your script.

Is a hithox actually nessecary? You could use raycasting to detect if the wire is trippedm or if the wire is small enough, a simple area check could suffice… yeah it would give it a sphere hitbox, but if people just walk over it, they wont notice it anyway

Yeah I posted this so long ago thanks though

You may want to change the code a bit because the code check over the entire height between the two points

1 Like

For my mode, I had a similar situation like this. I worked a solution for you. As Alexei pointed out, it might stress out the script. Feel free to change the hero, as this code ONLY works for Pharah. It is an easy change.

Code:

variables
{
player:
26: lookingPosition
27: beamEffect
}

rule(“set where the character is looking when secondary fire is held”)
{
event
{
Ongoing - Each Player;
All;
Pharah;
}

conditions
{
	Is Button Held(Event Player, Secondary Fire) == True;
	Hero Of(Event Player) == Hero(Pharah);
}

actions
{
	Set Player Variable(Event Player, lookingPosition, Ray Cast Hit Position(Eye Position(Event Player), Add(Eye Position(
		Event Player), Multiply(Facing Direction Of(Event Player), 1000)), All Living Players(Opposite Team Of(Team Of(Event Player))),
		Event Player, True));
	Wait(0.250, Ignore Condition);
	Loop If Condition Is True;
}

}

rule(“create the beam effect on secondary fire hold”)
{
event
{
Ongoing - Each Player;
All;
Pharah;
}

conditions
{
	Is Button Held(Event Player, Secondary Fire) == True;
	Hero Of(Event Player) == Hero(Pharah);
}

actions
{
	Create Beam Effect(Append To Array(All Players(Opposite Team Of(Team Of(Event Player))), Event Player), Bad Beam, Eye Position(
		Event Player), Player Variable(Event Player, lookingPosition), Blue, Visible To Position and Radius);
	Set Player Variable(Event Player, beamEffect, Last Created Entity);
}

}

rule(“remove the beam effect when not holding secondary fire”)
{
event
{
Ongoing - Each Player;
All;
Pharah;
}

conditions
{
	Is Button Held(Event Player, Secondary Fire) != True;
	Hero Of(Event Player) == Hero(Pharah);
}

actions
{
	Destroy Effect(Player Variable(Event Player, beamEffect));
}

}

rule(“damage an enemy while Pharah holds right click if they are within the hitbox range”)
{
event
{
Ongoing - Each Player;
All;
Pharah;
}

conditions
{
	Hero Of(Event Player) == Hero(Pharah);
	Is Button Held(Event Player, Secondary Fire) == True;
	X Component Of(Player Variable(Event Player, lookingPosition)) <= Add(X Component Of(Position Of(Player Closest To Reticle(
		Event Player, Opposite Team Of(Team Of(Event Player))))), X Component Of(Vector(1, 0, 0)));
	X Component Of(Player Variable(Event Player, lookingPosition)) >= Subtract(X Component Of(Position Of(Player Closest To Reticle(
		Event Player, Opposite Team Of(Team Of(Event Player))))), X Component Of(Vector(1, 0, 0)));
	Y Component Of(Player Variable(Event Player, lookingPosition)) <= Add(Y Component Of(Position Of(Player Closest To Reticle(
		Event Player, Opposite Team Of(Team Of(Event Player))))), Y Component Of(Vector(0, 1.500, 0)));
	Is In Line of Sight(Eye Position(Event Player), Position Of(Player Closest To Reticle(Event Player, Opposite Team Of(Team Of(
		Event Player)))), Enemy Barriers Block LOS) == True;
	Is Alive(Event Player) == True;
}

actions
{
	Damage(Player Closest To Reticle(Event Player, Opposite Team Of(Team Of(Event Player))), Event Player, 25);
	Wait(0.500, Ignore Condition);
	Loop If Condition Is True;
}

}

And what happens if Pharahs facing direction equals (or gets closer to equal) the X or Y axis?
I think your method only works if Pharahs facing direction equals the Z-axis.

You’re correct as I believe the reticle has to be perfectly aligned with the enemy you are facing in the Z-axis. A bit flimsy, but a quick method I came up with. I am sure there are better methods, but I haven’t come up with any yet.