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

Moving a unit group... orderly - with array?

Status
Not open for further replies.
Level 2
Joined
Sep 12, 2009
Messages
10
Hello... I'm trying to move the player's units orderly to different regions (positions)...

The player can recruit, convert units and so on along the way so I don't know how many, nor what units it has at this point. Also, if I tell the entire group to gather in one region they'll bump into each other, block one, etc... you probably know how it goes.

My solution is to have unit 1 to 11 get to a specific position and unit 12 and beyond assemble in one region. It's unlikely the player has 12 units or more by this point, meaning they should be able to gather safely in in one region.

Wc3%20issue_zpspmhdtfge.jpg


I'm not an expert when it comes to this but I figured one way to handle this would be to convert a unit group to a unit array and then order each of the array's position to order the respective unit to its respective region. But... it doesn't work:

Wc3%20issue2_zpsh4hdyexk.jpg


EDIT:

Actually, I just used the wrong unit group the first time... and now they got moving - except they seem to ignore my positions.
On the picture above we see the regions/positions. On the top from the left it's 1,2,3,4 5 (I only marked 1 - 3 on the picture, though)
And then it's position 6, 7, 8, etc... 11

Wc3%20issue3_zpsx3td3qlt.jpg


Assuming the Banshee and Spider are array positions 4 to 5 respectively they should be to the right. With only Necro and Accolyte on the second row. Ideas?


What am I doing wrong...? Or is there perhaps a better way to do this?
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
I would use a loop probably, something like this

set x = 0
set y = 0
set i = 0
point = center of region
Unit group - pick all units in group
--set point2 = point offset by (x, y)
--order picked unit to move to point2
--if i == 6 then
----set x = 0
----set y = 128
--else
----set x = x + 128
--endif
--set i = i + 1

Use [hidden][/hidden] tags for your images.
 
Level 2
Joined
Sep 12, 2009
Messages
10
Like this?

issue4_zpsrqxfmeqb.jpg

All the units move to the same point... tried changing x and y to higher values - didn't help.
 
Status
Not open for further replies.
Top