HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Add unit to unit goup problem

08-07-2007, 02:44 AM#1
botanic
this is the trigger and for some reason it wont add the unit to the unit group...

Trigger:
Spartan Spearman Create
Collapse Events
Unit - A unit enters pick spartan spearmen <gen>
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to Choose your Spartan's class
Collapse Actions
Set Player_Units_Number[(Player number of (Owner of (Entering unit)))] = (Player_Units_Number[(Player number of (Owner of (Entering unit)))] + 1)
Set Temppoint = (Center of spawn here <gen>)
Set Temp_Unit_Group = (Units in Region 003 <gen>)
Unit - Create 1 Spartan for (Owner of (Entering unit)) at (Temppoint offset by (0.00, 0.00)) facing 80.00 degrees
Unit - Set the custom value of (Last created unit) to Player_Units_Number[(Player number of (Owner of (Entering unit)))]
Trigger - Add to Hero death <gen> the event (Unit - (Last created unit) Dies)
Set Temp_Unit_Group = (Units in group of spartans <gen>)
Set tempintiger = (Integer(((String((Player number of (Owner of (Triggering unit))))) + (String(Player_Units_Number[(Player number of (Owner of (Triggering unit)))])))))
Collapse Unit Group - Pick every unit in Temp_Unit_Group and do (Actions)
Collapse Loop - Actions
Unit - Create 1 (Unit-type of (Picked unit)) for (Owner of (Entering unit)) at (Random point in spawn here <gen>) facing 80.00 degrees
Set tempunit = (Last created unit)
Unit Group - Add tempunit to Units[tempintiger]
Trigger - Add to deselect <gen> the event (Unit - tempunit Is selected)
08-07-2007, 03:18 AM#2
TheSecretArts
have you tried added debug messenges to find out where the data is slipping?
08-07-2007, 11:29 AM#3
botanic
yes and aparently in the first trigger

Trigger:
Set tempintiger = (Integer(((String((Player number of (Owner of (Triggering unit))))) + (String(Player_Units_Number[(Player number of (Owner of (Triggering unit)))])))))

sets tempintiger = 11

however the line

Trigger:
Unit Group - Add tempunit to Units[tempintiger]

will not add a unit to unit group 11

Edit: it does however create the units and add the event to the other trigger for that unit?!?
08-07-2007, 12:22 PM#4
Anitarf
Do you use the tempintiger (learn to spell) variable in any other trigger?
08-08-2007, 12:26 AM#5
botanic
nope ~.~

PS that is one word i can never spell right or id be much more capable in JASS :P
08-08-2007, 04:59 PM#6
Anitarf
Where else do you use the Units[] variable array? Also, when you declare the group array, how large do you make it's size?
08-09-2007, 11:11 PM#7
botanic
that is the only place that those variables are used ~.~

and I made the size 1 i never have had to use any other size and I have done this before..