HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Groups issue?

04-11-2007, 04:27 AM#1
st33m
Howdy.

So... heres my problem: I need a way to repeatedly create units, assign them to a group (of 3 units, for example), and then order them to attack move to a location, and then, as a group, attack move to another location. The problem is not that I can't make the units or order the moves etc etc; the problem is how can I keep the units as a group and issue a second order after the first one, all while throughout the course of the game creating more of these unit bundles?

In other words, how can I store a cell of units for later use, while still being able to theoretically summon an infinite number more of them, in order to give that unit, without having to give it a specific variable (because these units are more generic than they are specific), another set of orders after its initial ones?

Sorry if this isn't clear its hard to explain.
04-11-2007, 05:10 AM#2
PurgeandFire111
I don't know exactly what you mean, but if you repeatedly create units, you would simply apply a periodic event, right?

Since periodic events take seconds, you can wait a certain amount of seconds to put your units in a unit group, then turn off the trigger. Though you still want to have the trigger run, so you can create another trigger and have it fire after that. Here are three triggers to elaborate on what I mean(GUI(This contains leaks, it is just so you may get the gist)):
Code:
Trigger_1
Events:
Time - Every X seconds of game time
Conditions:
Actions:
Trigger - Turn on Trigger_2
Unit - Create 1 <Unit> for <Player> at <Point> facing <Facing>
Unit Group - Add (Last Created Unit) to Unit_Group1
//Actions//
Next trigger for the wait:
Code:
Trigger_2
Events:
Time - Elapsed game time equal to <Seconds>
Conditions:
Actions:
Wait X seconds
Trigger - Turn off Trigger_1
Trigger - Turn on Trigger_3
//Next Trigger Again//
Code:
Trigger_3
Events:
Time - Every X seconds of game time
Conditions:
Actions:
Unit - Create 1 <Unit> for <Player> at <Point> facing <Facing>

I hope I understood what you meant and I hope this helps!
[Or did you mean something else or did you want it to infinitely run?]
04-11-2007, 05:19 AM#3
st33m
I need it to run as long as the game lasts, and to give each cell of three units an individual grouping, but the grouping doesn't need to be one I can call on specifically, just so that I can order the cell to attack a random location; and then, once the group enters the location (or its proximity), order them to attack a specific location.
04-11-2007, 11:42 AM#4
Castlemaster
I think all you need to do is just put each cell in a group while they are spawning. I have a similar system for my arena map where each unit is spawned individually and given a gaggle of variables (unit number, target, postion of target...) so that I can give individual units triggered orders instead of one command for all units (i.e., attack your respective targets rather than everyone attack a single target.

If you are wanting just groups to move and attack, all you need to do is set up regions in the map for them to move to, or instead of regions make it event triggered, like the position of a unit.
04-11-2007, 04:11 PM#5
wantok
You could use parallel arrays or structs. Save the array index in the unit's custom value. When a unit reaches the point where it needs to be ordered again, get the index from its custom value and use it to get the other two units.