• 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.

Problems for setting a location under certain circumstances

Status
Not open for further replies.
Level 9
Joined
Apr 19, 2011
Messages
447
Hi.

Well, I need to assign a value to a point variable, following the following rules:

In the following picture, there are some blue rectangles (4 in total), that represent regions, and a red circle. I need to assign to a point variable a random location of the visible blue area.
capg.jpg

In other words, the point must be inside one of the regions, but outside of that red area.

Maybe I'm idiot and this is easier than I think, but I can't think a way to do it. I've tried some things without success. Any ideas?

Regards
 
Level 9
Joined
Jul 10, 2011
Messages
562
set all blue regions in an array.
then create in a random of these regions a radom point. then do an if/then/else loop checking whether the point is also inside the red circle...if its in the circle run the trigger once again else do nothing.
 
Level 9
Joined
Apr 19, 2011
Messages
447
I also though about that, but if I do that, it exists a possibility of always taking a point inside the red circle. The trigger could never end, or could take a far too long time to complete for my needs. This thing is for a boss battle, and it determines the movement pattern of the boss, so it should be as smooth as possible.
Is there any other way to do it?

Regards
 
Level 9
Joined
Jul 10, 2011
Messages
562
The trigger could never end, or could take a far too long time to complete for my needs.

the trigger could just never end if the red circle would fill all reagions and the trigger wont take far to long cause it will be instant ^^ (at least if you dont add a wait^^)
 
Level 9
Joined
Apr 19, 2011
Messages
447
the trigger could just never end if the red circle would fill all reagions and the trigger wont take far to long cause it will be instant ^^ (at least if you dont add a wait^^)

"Instant"? Are you sure about that? I have no reason to add waits in that trigger, but I really doubt that it will be instant...
Well, I'll give it a try, and see what do I get.

Regards
 
Level 9
Joined
Jul 10, 2011
Messages
562
the trigger runs as many times as needed but nearly instant (about 0.01-0.02 secs max afaik) so it should not be a problem....for sure you have to make sure that you dont run through loops with 500 max value or other things that cause laggs but else its instant.
 
Status
Not open for further replies.
Top