Hey, i have a map in which you can purchase new units. When new units are purchased, when the game starts, it will automatically swarm when the timer hits 0. I have created a timer window for the units which have already been purchased. However, i am trying to do this with arrays.
I can make it so each unit availiable has its own timer window however, i want it so that only purchased units will have a window.
This is what i got so far
For each (Integer A) from 1 to 4, do (Actions)
Loop - Actions
Countdown Timer - Create a timer window for User_Timers[(Integer A)] with title Names[(Integer A)]
Set User_Windows[(Integer A)] = (Last created timer window)
If (Purchased[(Integer A)] Not equal to 1) then do (Countdown Timer - Destroy User_Windows[(Integer A)]) else do (Do nothing)
I am using intergers to tell if the unit has been purchased. 0 = not purchased, 1 = purchased. The last trigger is so that when a unit is not purchased(0) the window for that unit is destoryed.
I don't know why but when i make purchased=1 at map initialization it works, but any other point, it doesn't. e.g.
Purchase Archers
Events
Unit - A unit Finishes research
Conditions
(Triggering player) Equal to Player 1 (Red)
(Researched tech-type) Equal to Purchase Archers
Actions
Set Purchased_Archer = 1
I know this trigger which changes 'Purchased_Archer = 1' works as another trigger is effected by this "Purchased_Archer = 1". A unit spawns or not spawns because of this, e.g.
User Sending Archers
Events
Time - User_Archer_Timer expires
Conditions
Purchased_Archer Equal to 1
Actions
Unit - Create 1 Archer for Player 1 (Red) at (Center of Region 000 <gen>) facing (Center of Region 001 <gen>)
Thanks in Advance
I can make it so each unit availiable has its own timer window however, i want it so that only purchased units will have a window.
This is what i got so far
For each (Integer A) from 1 to 4, do (Actions)
Loop - Actions
Countdown Timer - Create a timer window for User_Timers[(Integer A)] with title Names[(Integer A)]
Set User_Windows[(Integer A)] = (Last created timer window)
If (Purchased[(Integer A)] Not equal to 1) then do (Countdown Timer - Destroy User_Windows[(Integer A)]) else do (Do nothing)
I am using intergers to tell if the unit has been purchased. 0 = not purchased, 1 = purchased. The last trigger is so that when a unit is not purchased(0) the window for that unit is destoryed.
I don't know why but when i make purchased=1 at map initialization it works, but any other point, it doesn't. e.g.
Purchase Archers
Events
Unit - A unit Finishes research
Conditions
(Triggering player) Equal to Player 1 (Red)
(Researched tech-type) Equal to Purchase Archers
Actions
Set Purchased_Archer = 1
I know this trigger which changes 'Purchased_Archer = 1' works as another trigger is effected by this "Purchased_Archer = 1". A unit spawns or not spawns because of this, e.g.
User Sending Archers
Events
Time - User_Archer_Timer expires
Conditions
Purchased_Archer Equal to 1
Actions
Unit - Create 1 Archer for Player 1 (Red) at (Center of Region 000 <gen>) facing (Center of Region 001 <gen>)
Thanks in Advance