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

Space between units {setting a specific distance between 20 spawned units}

Status
Not open for further replies.
Level 11
Joined
Feb 14, 2009
Messages
884
I have written a trigger which spawns 20+ units in the center of a region. Is there any way of setting a space between them, as Hanyu has done on his TD map? Now, they are spawned all together one very close to another and I don't want this since I need them to move freely. Thanks in advance :D
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
kinda complicated
For Each A integer from 1 to C
-For Each B integer from 1 to V
--Create Unit in Location(Q+ ( CITR(B) x S ), W+( CITR(A) x S ) )

CITR is the "Convert integer to Real" function
Q is X coordinate of position of first unit
W is Y coordinate of position of first unit
C is number of lines of units
V is number of units in a single line
S is space between em
and A and B are usual loop counters
x and + are calculation symbols
 
Level 11
Joined
Feb 14, 2009
Messages
884
Hm, thanks a lot. I 'm gonna try it and I'll let you know. :D

{EDIT}
It works! I had some problems implementing it but now it's fine. I love you! +rep :)
 
Last edited by a moderator:
Status
Not open for further replies.
Top