About the attack system. It has some bugs:
If the attacking unit has the facing angle of 1 and the facing angle of the attacked unit is 359, it will not deal the damage, because Warcraft will think it is comparing two reals while you are actually comparing angles. Let me explain:
The attacked unit's facing angle is 1
The attacking unit's facing angle is 359
Thus it will check:
Is 1 Greater than, or equal to 359 - 52.5 which it is not
So what you should do is a lot more complex
I use 5 real variables but you can use less, but it is harder to explain using less.
Facing1
Facing2
AngleClockwise
AngleAntiClockwise
Differance
Okay.
Firstly I set the variables.
set Facing1=((Facing of (Attacked unit))
set Facing2=((Facing of (Attacking unit))
// Here I'm just calculating the differance between the angles
set AngleClockwise=Facing1-Facing2
set AngleAntiClockwise=(Facing1+360)-Facing2
if AngleClockwise is less than 0 then
set AngleClockwise=AngleClockwise*-1 // If the angle is negative this makes it positive
endif
if AngleAntiClockwise is less than 0 then
set AngleAntiClockwise=AngleAntiClockwise*-1 // If the angle is negative this makes it positive
endif
// Now Finnally
if AngleAntiClockwise is greater than AngleClockwise then
set Differance=AngleClockwise
else
set Differance=AngleAntiClockwise
endif
// This entire piece of code finds the differance between angles, now you can just add
if Differance is less than X then
// Replace X with a number between 1-90 degrees
//X based on how easely you should be able to have the bonus damage. I prefer 45 degrees
// Your damge actions are placed here ->
endif