| 12-24-2006, 12:55 AM | #1 |
I'm trying to simulate the casting of blink where as if you target a point say 5000 range from you, but the max range of blink is 800, it will keep the angle of the cast but reduce the range to 800. My code is as follows (for this range re-set): For the sake of this question: {max = 500} JASS:if (SquareRoot((y2-y1)*(y2-y1) + (x2-x1)*(x2-x1)) > max) then set ang = bj_RADTODEG * (Atan2((y2-y1), (x2-x1))) set x2 = max * Cos(ang * bj_DEGTORAD) set y2 = max * Sin(ang * bj_DEGTORAD) endif Also, as a secondary question, I would like to know if you prefer being able to cast ANYWHERE on the map and have a maximum range, or being able to cast only a certain distance past the maximum. |
| 12-24-2006, 01:05 AM | #2 |
From the looks of things you have a very simple error in the code. JASS:set x2 = max * Cos(ang * bj_DEGTORAD) set y2 = max * Sin(ang * bj_DEGTORAD) //The above is wrong, this is what you want instead: set x2 = x1 + max * Cos(ang * bj_DEGTORAD) set y2 = y1 + max * Sin(ang * bj_DEGTORAD) I'd prefer the function to not work the way Blink does. Instead, I think it should have a maximum casting range. |
| 12-24-2006, 02:24 AM | #3 |
Oh my, duh!! Lol wow I can't even believe myself. I was drunk when I wrote this code, but when revising it sober I should have caught myself. Anyways, thanks. |
