HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Add Unit to Unit Group Variable

07-17-2007, 07:44 PM#1
PsycoMarauder
Wow I don't know why this didn't work...sucks ass that it didn't too because I did this like 250 times...Heres the jist of the trigger. I just wanted to assign unit groups through variables, thinking that if I did it would make the rest of my triggerring easier. Anyone know why the trigs I use the variables in don't work? Im pretty sure it has nothing to do with the triggs I use the variables in, but if the trig below seems fine then I'll post the triggs I used the groups in.
Trigger:
Untitled Trigger 001
Collapse Events
Time - Elapsed game time is 0.10 seconds
Conditions
Collapse Actions
Unit Group - Add Territory 0117 <gen> to TerritorySet[1]
Unit Group - Add Defense Tower 0118 <gen> to TerritorySet[1]
Unit Group - Add Territory 0035 <gen> to TerritorySet[2]
Unit Group - Add Defense Tower 0037 <gen> to TerritorySet[2]
(And so on to 128)
07-17-2007, 07:49 PM#2
fps-doug
I don't see a problem there unless in your other trigger you're clearing your unit groups. please post the triggs you used the groups in.
07-17-2007, 10:44 PM#3
TheSecretArts
should probably be
Trigger:
Untitled Trigger 001
Collapse Events
Time - Elapsed game time is 0.10 seconds
Conditions
Collapse Actions
Unit Group - Add Territory 0117 <gen> to TerritorySet[1]
Unit Group - Add Defense Tower 0118 <gen> to TerritorySet[2]
Unit Group - Add Territory 0035 <gen> to TerritorySet[3]
Unit Group - Add Defense Tower 0037 <gen> to TerritorySet[4]
(And so on to 128)
you can only have one object per array index and multidimensional arrays are not supported.
07-17-2007, 10:47 PM#4
Alevice
erm, Territory and defense tower are apparently units, and TerritorySet seems to be an array of unit groups.
07-17-2007, 10:50 PM#5
TheSecretArts
hmm.. it seems so. Try a debug messege to see if the variables are actually working, IE: Pick Every Unit In TerritorySet[X] and Create Minimap ping at location at (picked unit).
07-18-2007, 04:52 AM#6
GamesSmash
You have to go to variables (ctrl + b) and click on your variable for array.
Then change it to the value of 128. So the array would have the capacity to hold 128 groups.
07-18-2007, 07:19 AM#7
maximilianx
and if it's an array of 128, it goes from 0-127 not 1-128.
07-18-2007, 07:51 AM#8
PsycoMarauder
wait wait what? I already tried a "debug trigger" by for each integer a from 1-128 remove units in unit group territory set a. didn't work. i'm not quite sure what gamesmasher is saying/ and what i do understand i dont understand what that would do.
07-18-2007, 08:31 AM#9
Ammorth
GamesSmasher is telling you to increase the array limit in the Variable module. Since the group has to be created, you need to tell the game to create them, before you can add units to them. You can either do this by increasing the array limit, or using a bit of custom script:
Trigger:
Custom Script: set udg_TerritorySet[1] = CreateGroup()
Custom Script: set udg_TerritorySet[2] = CreateGroup()
Custom Script: set udg_TerritorySet[3] = CreateGroup()
07-18-2007, 09:26 AM#10
CommanderZ
I think this can be done in Variable manager when you set default value to empty group.
07-20-2007, 06:56 AM#11
PsycoMarauder
Sorry for late response, my great and very reliable internet service was working well once again.
/sarcasm off.

Ok so doing what Gamesmasher said should fix the problem I'm having?
07-20-2007, 07:14 AM#12
Spiky
Is the TerritorySet a Unit Group Array? Sorry, trying to clarify a few things.
07-21-2007, 05:46 AM#13
PsycoMarauder
Yeah, it is. There will be 128 of them
07-21-2007, 08:12 AM#14
Toink
You're adding units to group variables which points to groups that aren't even created.

Do what Ammorth said, initialize them with set <your variable name> = CreateGroup()
07-21-2007, 10:38 AM#15
blu_da_noob
You don't need to initialize them with custom script. Do what Gamesmasher said. Horses for courses people.