| 01-31-2007, 10:14 AM | #1 |
I'm creating an ability which works almost the same way as forked lightning, just with burn damage over time instead. So, my problem is the angles. Take a look at the attachement. I am selecting all units within a circular area around the caster, and filters them out if theyre not in the red sector by checking angles and X/Y's. But, say, that I cast it towards 0 degrees, then it would mess up, because with my angle checking function it would return a number below 0 or above 360, which will not work. Well, you get the problem... |
| 01-31-2007, 01:35 PM | #2 |
Use a check to see if the angle is above/below your working angles and then add/subtract 360. I would also recommend making a special case if the red overlaps the 0-360 degrees. It wouldn't be the best math approach, but easy enough to trigger. |
| 01-31-2007, 02:11 PM | #3 |
This thread has some general discussion on basically the same thing. Specifically, my post should get you what you looking for if you change f1 to your 'middle' angle (the cast angle of the spell) and f2 to the angle between the position of the casting unit and the position of the unit you are checking. |
| 01-31-2007, 02:18 PM | #4 |
On a seperate note..I thought that negative degrees / degree measures above 360 still register correctly... (390 == 30 and -30 == 330) |
| 01-31-2007, 03:31 PM | #5 |
It works that way if you are just using it to set a units facing, etc... But it would be a problem here, imagine... JASS:if -10 > 300 then .. do stuff endif |
