HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Having trouble with a trigger.

10-27-2006, 07:45 PM#1
Zankor
Im trying to make a map that revovles around having a base that spawns units and the base having abilities that when cast order all your units to attack move to either of the 8 players bases or the middle of the map.

Sense the action "unit-group order units to Attack move to a location" can only order a maxium of 12 units at a time i came up with a trigger to add up all the units someone has(in this case player1) and assign them to a unit group variable called "Player1units" i then have 12 units randomly picked from that group and assigned to a unit group array variable called "MassAttackPlayer1(which is a 0-12 array)" as the number Player1units / 12 then remove these 12 units from Player1units.(all done in a loop).
The adding up and dispersing of units is done once every 5 seconds(the spawn time for new units) and before putting the newly added units into groups i have to clear out MassAttackPlayer1.

Then i have a trigger that orders all the units in MassAttackPlayer1 to attack move to the location.

The problem im having is if they have more then 156 units it would try to assgin them to the array as the 14th spot which doesn't exist and then sense they aren't assigned to the array they aren't removed from the unit group that added them all up so the loop ends up doing nothing and all at once the units stop getting orders, which im pretty sure would almost cripple the players control over his units.

anyone have any ideas on how to fix this problem?(without making me make the array so huge noone could ever hope of filling it up becuase i have to make this trigger for each of the 8 players and i havn't figured out how to clear all the slots of the MassAttackPlayer1 array without doing them slot by slot)

anyway here is the trigger.
Trigger:
Red Attack Controls
Collapse Events
Time - Every 5.00 seconds of game time
Conditions
Collapse Actions
Unit Group - Remove all units from MassAttackPlayer1[0]
Unit Group - Remove all units from MassAttackPlayer1[1]
Unit Group - Remove all units from MassAttackPlayer1[2]
Unit Group - Remove all units from MassAttackPlayer1[3]
Unit Group - Remove all units from MassAttackPlayer1[4]
Unit Group - Remove all units from MassAttackPlayer1[5]
Unit Group - Remove all units from MassAttackPlayer1[6]
Unit Group - Remove all units from MassAttackPlayer1[7]
Unit Group - Remove all units from MassAttackPlayer1[8]
Unit Group - Remove all units from MassAttackPlayer1[9]
Unit Group - Remove all units from MassAttackPlayer1[10]
Unit Group - Remove all units from MassAttackPlayer1[11]
Unit Group - Remove all units from MassAttackPlayer1[12]
Unit Group - Pick every unit in (Units in Play Field <gen> owned by Player 1 (Red)) and do (Unit Group - Add (Picked unit) to Player1units)
Collapse For each (Integer A) from 0 to 12, do (Actions)
Collapse Loop - Actions
Unit Group - Add all units of (Random 12 units from Player1units) to MassAttackPlayer1[((Number of units in Player1units) / 12)]
Unit Group - Remove all units of MassAttackPlayer1[((Number of units in Player1units) / 12)] from Player1units
10-27-2006, 08:05 PM#2
Naakaloh
Unit groups can hold more than enough units and the function that issues them orders has nothing to do with the number of units in the group.

The function you're using is rather useless for this purpose. In fact, it seems Blizzard's function is poorly designed unless they have a specific unspecified use for it. Anyway, you should instead pick every unit in the group and order them to attack-move to the point

Something like this...
Trigger:
Actions
Collapse Unit Group - Pick every unit in UnitGroup and do (Actions)
Collapse Loop - Actions
Unit - Order Picked Unit to Attack-Move To Location
10-27-2006, 08:12 PM#3
Zankor
Well i tried this before

Trigger:
OldTrigger
Events
Conditions
Collapse Actions
Unit Group - Pick every unit in (Units in Play Field <gen> owned by Player 1 (Red)) and do (Unit - Order (Picked unit) to Attack-Move To (Center of Middle <gen>))
but it seemed to hand out the order to each unit one by one, and when we add in lots and lots of units there starts to become a large delay in response time from first unit ordered to last unit ordered.

also the unit group order im trying to use now is
Trigger:
OldTrigger
Events
Conditions
Collapse Actions
Unit Group - Order (Units in (Playable map area)) to Attack-Move To (Center of Middle <gen>)
which didn't seem to hand out orders as slow. but had a limit of 12 units.

Edit.
i just tried the trigger i posted above and i didn't see the same problem i remembered having, i guess it was just unit pathing or something that made the order appear to go out slower.
10-27-2006, 08:33 PM#4
Naakaloh
Well part of that probably has to do with the fact that you're only ordering 12 units. You might want to try something like this if it's really getting to be an issue:

Trigger:
Actions
Collapse Unit Group - Pick every unit in UnitGroup and do (Actions)
Collapse Loop - Actions
Unit - Order Picked Unit to Attack-Move To Location
UnitGroup - Remove Picked Unit from UnitGroup
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(UnitGroup is empty) Equal to False
Collapse Then - Actions
Trigger - Run (This trigger) (checking conditions)
Else - Actions
10-27-2006, 08:41 PM#5
Zankor
its ok, retrying the original trigger i made seems to work fine now...
i don't know why but i remember when i tested it the first time they seemed to react slower.

gonna go back to using the simple trigger, thanks for your help.
10-28-2006, 07:43 AM#6
blu_da_noob
If you have large numbers of units in the game (starts somewhere around ?300? or so), all units start to 'react slowly' to orders. The game can't handle that many units at once, so it gives them 'turns' to follow their orders, making their movements jerky.