Automatically training and sending units

Level 4
Joined
May 4, 2008
Messages
113
Trying to make a trigger to get a building to automatically train units.

When it is built, it will add five units to the queue, and then when a unit finishes training it will add another one. When a unit is trained, it will be sent to a certain point depending on which player it belongs to.

Here are the triggers im using:

Code:
Mechanikennel Init
    Events
        Unit - Any Unit construction progress is Completed
    Local Variables
        loop = 1 <Integer>
    Conditions
        (Unit type of (Triggering progress unit)) == Mechanikennel
    Actions
        General - For each integer loop from 1 to 5 with increment 1, do (Actions)
            Actions
                Unit - Order (Triggering progress unit) to (Mechanikennel Train Attack Dog) (After Existing Orders)

Code:
Attack Dog Spawn
    Events
        Unit - Any Unit training progress is Completed
    Conditions
        (Unit type of (Triggering progress unit)) == Attack Dog
    Actions
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                (Owner of (Triggering progress unit)) == 1
                (Owner of (Triggering progress unit)) == 2
                (Owner of (Triggering progress unit)) == 3
                (Owner of (Triggering progress unit)) == 4
            Then
                Unit - Order (Triggering progress unit) to ( Attack targeting Player 2 Target) (After Existing Orders)
            Else
                General - If (Conditions) then do (Actions) else do (Actions)
                    If
                        (Owner of (Triggering progress unit)) == 5
                        (Owner of (Triggering progress unit)) == 6
                        (Owner of (Triggering progress unit)) == 7
                        (Owner of (Triggering progress unit)) == 8
                    Then
                        Unit - Order (Triggering progress unit) to ( Attack targeting Player 1  Target) (After Existing Orders)
                    Else
        Unit - Order (Triggering unit) to (Mechanikennel Train Attack Dog) (After Existing Orders)

Through adding debug messages and whatnot to the triggers i've found that the first one doesn't even seem to fire at all, whilst the second one does, but the only action that is carried out is the very last one, the Order. I am guessing the reason neither of them work is due to conditions, but I am not quite sure what I should change! Any solutions anyone can give?

Thanks in advance.
 
Level 3
Joined
May 1, 2010
Messages
54
Just use Triggering Unit?
Shouldn't be the exact issue, but it may help.
Try adding a slight wait right as the trigger begins to fire, like Wait(.1), just to see if it works then.
 
Level 4
Joined
May 4, 2008
Messages
113
Just use Triggering Unit?
Shouldn't be the exact issue, but it may help.
Try adding a slight wait right as the trigger begins to fire, like Wait(.1), just to see if it works then.

Triggering progress unit and triggering unit are different things in this instance; I have attempted to switch them around/use them differently but it hasn't worked.

I tried the wait also before, but it didn't seem to change anything unfortunately.
 
Level 4
Joined
May 4, 2008
Messages
113
Bump.

I removed the conditions from the second trigger which check the owning player of the unit, and now the unit will actually move, so for some reason both of those sets of conditions are not being met. Can't think of why they would do that, though.

However the first one still does not work at all and I'm completely flabbergasted as to why.
 
  • Attack Dog Spawn
    • Events
      • Unit - Any Unit training progress is Completed
    • Conditions
      • (Unit type of (Triggering progress unit)) == Attack Dog
    • Actions
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • (Owner of (Triggering progress unit)) == 1
          • (Owner of (Triggering progress unit)) == 2
          • (Owner of (Triggering progress unit)) == 3
          • (Owner of (Triggering progress unit)) == 4
        • Then
          • Unit - Order (Triggering progress unit) to ( Attack targeting Player 2 Target) (After Existing Orders)
        • Else
          • General - If (Conditions) then do (Actions) else do (Actions)
            • If
              • (Owner of (Triggering progress unit)) == 5
              • (Owner of (Triggering progress unit)) == 6
              • (Owner of (Triggering progress unit)) == 7
              • (Owner of (Triggering progress unit)) == 8
            • Then
              • Unit - Order (Triggering progress unit) to ( Attack targeting Player 1 Target) (After Existing Orders)
            • Else
      • Unit - Order (Triggering unit) to (Mechanikennel Train Attack Dog) (After Existing Orders)
  • tags. Use em more often.
  • Anyway, if i were you, i would use Unit enters Region (the whole map). I can't trigger this for you, sorry :(
  • Just make all buildings auto-build more units.
 
Level 1
Joined
Oct 15, 2010
Messages
2
Im not sure if this is still valid, but heres my thought to it:

You are checking if the owner of the triggering progress unit is 1, 2, 3 AND 4 at the same time, which I doubt you intend.

Instead you can do an if for each owner check...
 
Top