1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Automatically training and sending units

Discussion in 'StarCraft II Modding' started by ZiggyMcjoney, Aug 8, 2010.

  1. ZiggyMcjoney

    ZiggyMcjoney

    Joined:
    May 4, 2008
    Messages:
    109
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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 (Text):
    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 (Text):
    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.
     
  2. TheOverWhelming

    TheOverWhelming

    Joined:
    May 1, 2010
    Messages:
    54
    Resources:
    0
    Resources:
    0
    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.
     
  3. ZiggyMcjoney

    ZiggyMcjoney

    Joined:
    May 4, 2008
    Messages:
    109
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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.
     
  4. ZiggyMcjoney

    ZiggyMcjoney

    Joined:
    May 4, 2008
    Messages:
    109
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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.
     
  5. Statharas

    Statharas

    Joined:
    Jul 9, 2008
    Messages:
    2,332
    Resources:
    14
    Tools:
    1
    StarCraft II Resources:
    5
    Tutorials:
    8
    Resources:
    14
    • 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.
     
  6. mrzwach

    mrzwach

    Joined:
    Aug 1, 2009
    Messages:
    929
    Resources:
    3
    Tutorials:
    3
    Resources:
    3
    Have you tried putting in a debug message, that says what the triggering unit's name is just to test that it is actually the building and not something else (or nothing at all)?
     
  7. SledgeHammer

    SledgeHammer

    Joined:
    Oct 15, 2010
    Messages:
    2
    Resources:
    0
    Resources:
    0
    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...