HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Unit groups

07-15-2003, 09:50 PM#1
LegolasArcher
i need to make a tower defence map where many units are in a unit group (ie > 20.) The problem is the limit. Is there any easy solution for this? Could i use "Pick Every Unit in ____ and do action". Will "Picked units" still be limited? will this work?
07-17-2003, 01:23 PM#2
DaKaN
Yea, how about you just make a unit varible, and as the unit is created, store it in the array. so if you have 20 units

MyUnits[1] to MyUnits[20] can be referenced by doing a loop from 1-20.

And please do not post questions in the trigger repository...
07-17-2003, 03:12 PM#3
LegolasArcher
sorry about posting in the wrong spot... I didnt know what the Trigger section was exactly for.

About my question, could you elplain it in more detail. Im using it in a TD game where I had:

"Create (spawn_unit_number) of (spawn_unit_type) in the center of (spawnbottomright)"
"Pick every unit in (spawnbottomright) and do multiple actions)"
---"Unit- Order (picked units) to the center of (spawntopright)"

I really want to have it so I can tell when there are no units left, but you cant do that when picking units. Could you explain in more detail?
07-17-2003, 03:46 PM#4
DaKaN
instead of creating them all at once, you make a For Each Integer A Loop

create them 1 at a time, and have the loop go from 1 to MaxUnits to create.

Using the TFT editor, you can do a loop with multiple actions in the GUI (opposed to doing this in JASS).

here is an example of a loop in gui:

Variable editor - make a unit variable

events-
Whatever
conditions-
if any needed

actions-

For each integer A Loop (multiple actions)
Unit - Create 1 unit-type for playerX at locationY
set UnitVarible[IntegerA] = Last Created Unit
endloop

or you can order it to move or whatever in that loop

then you can refer to those units by UnitVariable[1] to UnitVariable[20] (or the max number of units spawned