HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Problem with trainging trigger

10-17-2009, 03:00 PM#1
Tritanis
I want to create a trigger that picks perodically one building of selected type and IF THAT BUILDING ISN'T ALREADY BUILDING SOMETHING then order it to train a Footman.
I created something like this :
Trigger:
test
Collapse Events
time - Every 5.00 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Random 1 units from (Units owned by Player 1 (Red) of type Barracks)) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Current order of (Picked unit)) Not Equals (Order(train))
Collapse Then - Actions
Unit - Order (Picked unit) to train/upgrade to a Footman
Collapse Else - Actions
Do nothing

But it doesn't work, units are queued in one building if it is picked several times.

Please help me
10-17-2009, 03:10 PM#2
Rising_Dusk
I am pretty sure that "train" isn't the actual orderstring associated with training a unit. (I'm almost certain that order doesn't even have an orderstring..) Anyways, your problem is that you only pick 1 unit, you should pick all units and then act on all of them, but only issue the train order once.
10-17-2009, 03:30 PM#3
Tritanis
But if I order all of them to train then after some time units will be queued in one of them, which I don't want to happen.
10-17-2009, 03:39 PM#4
Rising_Dusk
That didn't make any sense. You don't order all of them to train, you just pick all of them in the group before selecting the first applicable candidate for giving the train order. It would do the same thing as you described in your first post as what you wanted, it would just actually work.
10-17-2009, 04:11 PM#5
chobibo
Put the structures that are already creating/training units inside a group.
10-18-2009, 08:42 AM#6
Tritanis
Thanks chobibo, that actually worked for me!

Quote:
Originally Posted by Rising_Dusk
That didn't make any sense. You don't order all of them to train, you just pick all of them in the group before selecting the first applicable candidate for giving the train order. It would do the same thing as you described in your first post as what you wanted, it would just actually work.
Sorry to confuse you, but im making an AI for my custom race via triggers and if I picked all production buildings, then if comp had more resources than NumberOfProductionBuildings*UnitPrice then unit would queue up anyway. I could have made this trigger run every UnitTrainTime seconds but I don't want to do that. Anyway, I'm thankful to you too :)

Thanks guys