HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Random Spawn Location!

06-30-2010, 11:42 AM#1
PsiSan
Is there a way to make units players send start at random regions?

And whats the best way to script units to keep attack a unit (thats allrdy in a unit group)
07-02-2010, 05:43 AM#2
Tot
1) don't understand what you want...sry

2) periodically loop through the group and issue "attack"-order

OR

register all order-events (ISSUE_ORDER, ISSUE_POINT_ORDER, ISSUE_TARGET_ORDER) and check if the ordered unit is within your group, if it is and the order is different from "attack" then disable the order-trigger, pause the unit, issue "stop", unpause it, issue "attack", enable the order-trigger. this method requires to issue "attack" when an unit is added to the group.

i thing second way is more efficient, but also more difficult to code...
07-02-2010, 07:56 AM#3
PsiSan
Cool thanks that helped alot!!

Ok what i meant by the first one is, i have a region, where the units enter (like creep sends), then i want those units that enter the region to spawn in random other regions?
07-02-2010, 08:12 AM#4
Tot
use unit enters region event and an array with all possible random locations/regions
everytime an units enter the region, move it instantly to the location/region at a random place in the array. use a random integer form <index of first location/region> to <index of last location/region> as index to determine the location/region where you wanna move your unit
07-05-2010, 09:05 AM#5
PsiSan
How do i add regions to the array?
07-05-2010, 10:33 AM#6
Anitarf
Quote:
Originally Posted by PsiSan
How do i add regions to the array?
You need to do it in a trigger that runs on map initialization: just use the "set variable" action.
07-05-2010, 12:13 PM#7
PsiSan
Will this work on multipale regions?
07-05-2010, 01:13 PM#8
Tot
yes, you need a region-array and an integer to count how many regions you have.
then simply populate the array and set the count-integer to the maximal used index of your array.