HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Setting an AOE...

06-20-2006, 04:03 AM#1
Ignitedstar
I have a spell that is set to cast in a 700 AOE. Within that 700 AOE, there are supposed to be exploding effects that randomly come out of nowhere, hurting enemies. The probem is, how would I set an AOE for a spell that uses many smaller AOEs within that larger one?

I hope that made sense. Thanks in advance.
06-20-2006, 06:51 AM#2
vile
Get the target location on a variable
Put this function in the script:

Collapse JASS:
function GetRandomLocInCircle takes location center, real radius returns location
  local real dist = SquareRoot(GetRandomReal(0,1))*radius
  local real angle = GetRandomReal(0,2*bj_PI)
  return Location(GetLocationX(center)+dist*Cos(angle), GetLocationY(center)+dist*Sin(angle))
endfunction

Then use a location variable using that script. Example:
Collapse JASS:
local location l=GetSpellTargetLoc()
local location random=GetRandomLocInCircle(l, AOEHERE)

Then, just group all units in range of "random", using the aoe desired, and do your stuff on them.

Edited by Blade.dk. Reason: Replaced code tags with jass tags.
06-20-2006, 04:48 PM#3
Blade.dk
http://www.wc3campaigns.net/misc.php?do=bbcode#jass
06-21-2006, 12:09 AM#4
Ignitedstar
Thanks again. But, was there really no other way?
06-21-2006, 09:17 AM#5
blu_da_noob
It probably would be preferable to inline the function and remove the need for locations, but otherwise yes, that is the way to get random points in a circle with equal distribution.