i made a system that would detect if a unit was within 45 degrees of a line perpendicular to either its left or right sides, but there seems to be a problem with the code, i removed all variables, because i thought that may be causing a problem, the only variable that remains is "target" which is the unit that will be detected.
heres the code (in GUI)
Trigger:
Arc detection
Events

Time - Every 0.10 seconds of game time
Conditions
Actions

Unit Group - Pick every unit in (Units in (Playable map area) matching (((Picked unit) has buff In range ) Equal to True)) and do (Actions)


Loop - Actions



Set Target = (Picked unit)



If (All Conditions are True) then do (Then Actions) else do (Else Actions)




If - Conditions





(((Facing of ShipPlayer1) + 45.00) Less than or equal to (Angle from (Position of ShipPlayer1) to (Position of Target))) and ((((Facing of ShipPlayer1) + 135.00) Greater than or equal to (Angle from (Position of ShipPlayer1) to (Position of Target))) and (((Triggering unit) has buff In range ) Equal to True))




Then - Actions





Floating Text - Create floating text that reads Left side ready! at Point1 with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency





Floating Text - Change (Last created floating text): Disable permanence





Floating Text - Set the velocity of (Last created floating text) to 20.00 towards 90.00 degrees





Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds





Floating Text - Change the age of (Last created floating text) to 1.00 seconds





Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl





Special Effect - Destroy (Last created special effect)




Else - Actions





If (All Conditions are True) then do (Then Actions) else do (Else Actions)






If - Conditions







(((Facing of ShipPlayer1) - 45.00) Greater than or equal to (Angle from (Position of ShipPlayer1) to (Position of Target))) and ((((Facing of ShipPlayer1) - 135.00) Less than or equal to (Angle from (Position of ShipPlayer1) to (Position of Target))) and (((Triggering unit) has buff In range ) Equal to True))






Then - Actions







Floating Text - Create floating text that reads Right side ready! at Point1 with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency







Floating Text - Change (Last created floating text): Disable permanence







Floating Text - Set the velocity of (Last created floating text) to 20.00 towards 90.00 degrees







Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds







Floating Text - Change the age of (Last created floating text) to 1.00 seconds







Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl







Special Effect - Destroy (Last created special effect)






Else - Actions
im thinking its something wrong with this line:
Trigger:
(((Facing of ShipPlayer1) + 45.00) Less than or equal to (Angle from (Position of ShipPlayer1) to (Position of Target))) and ((((Facing of ShipPlayer1) + 135.00) Greater than or equal to (Angle from (Position of ShipPlayer1) to (Position of Target))) and (((Triggering unit) has buff In range ) Equal to True))
Maybe there is something i have put in backwards, or Angle from Point1 to Point2 finds the polar offset or the angle between the two vectors or some other random thing, rather then the bearing (which is what i expected it to do).
*note: this line is not retarded, the buff is called "In range" so dont think that that is a lack of buff.
Trigger:
Unit Group - Pick every unit in (Units in (Playable map area) matching (((Picked unit) has buff In range ) Equal to True)) and do (Actions)
any ideas?