XeNiM666
I lurk for pizza
- Reaction score
- 138
I made this out of boredom. Just wanted to test my JASS-ing skills.
This, basically picks a random location in a circle. Thought it might be useful to others.
Just copy this to your map header:
And use this function:
Very east
Example of usage: Picks a random location with a maximum range of 700
This is my first Snippet so go easy on me and comments are well appreciated!!
~XeNiM666
This, basically picks a random location in a circle. Thought it might be useful to others.
Just copy this to your map header:
JASS:
function RandomLocInCircle takes real x_pos, real y_pos, real min_distance, real max_distance returns location
local location center = Location( x_pos , y_pos )
local real dis = GetRandomReal( GetRandomReal( min_distance , max_distance / 2.15 ) , max_distance )
local real ang = GetRandomReal( 0.00 , 360.00 ) * ( 3.14159 / 180.00 )
local real x = GetLocationX( center ) + dis * Cos( ang )
local real y = GetLocationY( center ) + dis * Sin( ang )
call RemoveLocation( center )
set x_pos = 0.00
set y_pos = 0.00
set min_distance = 0.00
set max_distance = 0.00
return Location( x , y )
endfunction
And use this function:
JASS:
RandomLocInCircle( x_coordinate , y_coordinate , min_range , max_range )
Very east
Example of usage: Picks a random location with a maximum range of 700
JASS:
local location loc = RandomLocInCircle( GetLocationX(udg_Point[1]) , GetLocationY(udg_Point[1]) , 0.00 , 700.00 )
This is my first Snippet so go easy on me and comments are well appreciated!!
~XeNiM666