Typical beam weapon in the workshop code

actions
{
	Set Player Variable (Event Player, A, First Of(Sorted Array(Filtered Array(Filtered Array(All Living Players(
		Opposite Team Of(Team Of(Event Player))), Compare(Distance Between(Event Player, Current Array Element), <=, 8)), Compare(
		Is In Line of Sight(Eye Position(Event Player), Current Array Element, Enemy Barriers Block LOS), ==, True)),
		Angle Between Vectors(Facing Direction Of(Event Player), Direction Towards(Event Player, Current Array Element)))));
}
conditions
{
	Sorted Array(Filtered Array(Filtered Array(Filtered Array(All Players(Opposite Team Of(Team Of(Event Player))), Compare(
		Distance Between(Event Player, Current Array Element), <=, 8)), Is In Line of Sight(Eye Position(Event Player),
		Current Array Element, Enemy Barriers Block LOS)), Is In View Angle(Event Player, Current Array Element, 45)),
		Angle Between Vectors(Facing Direction Of(Event Player), Direction Towards(Event Player, Current Array Element)))
		!= Empty Array;
}

This is codes to use the “closest player to reticule” with an array, Here they are used to function like sym 2.0 beam, but it doesn’t include the Create beam command. You can tweak it a bit so it works differently
I felt like sharing these because they are really important since closest player to reticule doesn’t include LOS check, view angle check and if the target is alive or not.
If you want to use them, you can change Event Player to any player or positional vector (don’t forget to change the Eye Position if you go for a vector), the value of Distance between and View angle.
Feel free to ask anything, or correct me if I’m wrong!

Edit: Here’s the base code without any of the arrays

actions
{
	Set Player Variable(Event Player, A, First Of(Sorted Array(Empty Array, Angle Between Vectors(Facing Direction Of(Event Player),
		Direction Towards(Event Player, Current Array Element)))));
}
1 Like