• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How to get random point in radius/range?

Status
Not open for further replies.
Level 12
Joined
Aug 12, 2008
Messages
350
I currently trying to make a spell that channels explosion at random point within 1000 range of radius of caster.
For those who play DotA, it is the same as the Crystal Maiden's ultimate spell, Freezing Field.
The problem is that I do not know how to pick a random point. I only manage to find a trigger that pick a random point in region instead of random point within 1000 range of radius of caster.
 
Last edited:
EDIT: I'm sorry. Just figured it out on how to pick a random point.
For those who need, search for "Random point in region". Click the (Playable Map Area) and choose the "Conversion - Convert Point With Size To Region". The (Width) determine the range of radius of caster.

What!?
Better do this properly like it should be done:
  • Actions
    • Set tempp = (Position of (Triggering unit))
    • Set tempp2 = (tempp offset by (Random number between 1 and 1000) towards (Random angle))
Thats way how to create random point in circle around the caster.
Dont forgot about leak removal latter.
 
  • Like
Reactions: Kam
Level 12
Joined
Aug 12, 2008
Messages
350
Hmm... Why can't use this function "Random point in region"?
I thought it's good enough if it function properly :p
Anyway, I will use yours opinion. Thanks Spinnaker :D

The above idea's (my first post) had been re-edit in order not to confused any readers. The post before was the post quoted by Spinnaker. Sorry if there are any readers got confused.
 
Just to explain 'why':
Region isn't circle - it's rectangle.
You have to create/destroy region dynamicaly or (what's better) create region at map initialization and use 'move region' action. However, it still punishes you. You is somewhat constant and you have to non stop change it's size.

Using location is just simpler and faster. REMEMBER TO REMOVE leaks faterwards.
  • Custom script: call RemoveLocation (udg_tempp1)
Do that for each point used at the end of function.
 
Status
Not open for further replies.
Top