| 01-23-2005, 07:05 PM | #1 |
Now if you look at the picture i've attached. I need to know how i should do to get a random real number between thoose 2 red dots. I know that i should use the Math - Random Number but after that, to calculate the positions is the hard part =) |
| 01-23-2005, 10:45 PM | #2 | |
Quote:
Im not 100% sure but when i was doing key bord movment triggers it was changing unit to facing degree and that was done by the triggiering units facing degree - 10 so it would turn 10 degrees to the left or right. maybe u could do random number between facing degree of unit - 10 and facing degree of unit + 10. im not sure if this is correct. but im pretty sure it has something to do with the units facing angle |
| 01-23-2005, 11:10 PM | #3 |
I am assuming that the position you are trying to find is on an arc a certain distance from the peasant. One way of doing this is using a circle with the peasant as the center. You can generate a random real number between 0 and 1 and use it to determine how large the angle is to the point on that arc. Assuming you're using degrees, it would be something like this for the full circle: (360 * (Random real between 0 and 1)) You can replace 360 with the size of the arc and add a number of degrees depending on which part of the circle you want the arc to start. So you might use something like this: ((90 * (Random real between 0 and 1)) + 45) That would give you a number between 45 and 135 that could be used for the degrees of the angle. Once you've found the degrees of the angle, use Trigonometric functions with the radius of the circle to determine the x and y coordinates of the point, and create a location using those points. I'm not entirely sure if this is what you want, but I hope it helps. |
| 01-23-2005, 11:49 PM | #4 | |
Quote:
LOL u have to go make my post look like sh*t now with those big fancy words like trigonometric and coordinates |
