• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Trigger Problem

Status
Not open for further replies.
Level 4
Joined
Aug 1, 2013
Messages
54
Hello i got a problem with a trigger
So here is how the trigger is:
  • Events
    • Unit - A unit Finishes training a unit
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Owner of (Trained unit)) Equal to Player
        • ((Owner of (Trained unit)) is an ally of Player) Equal to True
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Trained unit)) Equal to unit1
        • integer1 Equal to 5
      • Then - Actions
        • Unit - Create 1 unit1 for (Owner of (Triggering unit)) at (Position of (Trained unit)) facing Default building facing degrees
        • Set integer1 = 0
      • Else - Actions
        • Set integer1 = (integer1 + 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Trained unit)) Equal to unit2
        • integer2 Equal to 5
      • Then - Actions
        • Unit - Create 1 unit2 for (Owner of (Triggering unit)) at (Position of (Trained unit)) facing Default building facing degrees
        • Set integer2 = 0
      • Else - Actions
        • Set integer2 = (integer2 + 1)
At the start of the map when i train 5 unit1 units the trigger to give me another unit1 and reset the integer1 will work, but if i train unit2 after or while training unit1 the trigger will never work again, and vice verso for unit2

Any help would be appreciated.
 
Your methode is wrong. Even if you train Unit1 ineteger2 will set integer2+1

Do like this:
  • Aktionen
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • 'IF'-Bedingungen
        • (Unit-type of (Triggering unit)) Gleich unit1
      • 'THEN'-Aktionen
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • 'IF'-Bedingungen
            • integer1 Gleich 5
          • 'THEN'-Aktionen
            • Einheit - Create 1 unit1 for Player 1 (Red) at xxx
            • Set integer1 = 0
          • 'ELSE'-Aktionen
            • Set integer1 = (integer1 + 1)
      • 'ELSE'-Aktionen

Use same IfThenElse-block for unit2, and btw in second IfThenElse you set wrong integer=0
 
Level 4
Joined
Oct 4, 2013
Messages
67
this would solve your problem

  • zzz
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Owner of (Trained unit)) Equal to Player
          • ((Owner of (Trained unit)) is an ally of Player) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Trained unit)) Equal to Unit1
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • integer1 Less than 5
            • Then - Actions
              • Set integer1 = (integer1 + 1)
            • Else - Actions
              • Unit - Create 1 Unit1 for Player at (Position of (Trained unit)) facing Default building facing degrees
              • Set integer1 = 0
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Trained unit)) Equal to Unit2
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • integer2 Less than 5
                • Then - Actions
                  • Set integer2 = (integer2 + 1)
                • Else - Actions
                  • Unit - Create 1 Unit2 for Player at (Position of (Trained unit)) facing Default building facing degrees
                  • Set integer2 = 0
            • Else - Actions
 
Level 4
Joined
Aug 1, 2013
Messages
54
Your methode is wrong. Even if you train Unit1 ineteger2 will set integer2+1

Do like this:
  • Aktionen
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • 'IF'-Bedingungen
        • (Unit-type of (Triggering unit)) Gleich unit1
      • 'THEN'-Aktionen
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • 'IF'-Bedingungen
            • integer1 Gleich 5
          • 'THEN'-Aktionen
            • Einheit - Create 1 unit1 for Player 1 (Red) at xxx
            • Set integer1 = 0
          • 'ELSE'-Aktionen
            • Set integer1 = (integer1 + 1)
      • 'ELSE'-Aktionen
This is exactly what i needed thank you very much
 
Status
Not open for further replies.
Top