• 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] Trigger to switch units...

Status
Not open for further replies.
Level 5
Joined
Sep 10, 2006
Messages
185
I'm trying to make a trigger that will switch the type of building units in this group are every 20 seconds.
This first trigger adds the unit to the group and randomizes the building for the first time...
  • Primary Built
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to High Elven Farm 5
    • Actions
      • Unit Group - Add (Constructed structure) to Unitgroup1
      • Set Int1 = (Random integer number between 1 and 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Int1 Equal to 1
        • Then - Actions
          • Set Position1 = (Position of (Constructed structure))
          • Unit - Remove (Constructed structure) from the game
          • Unit - Create 1 Enhanced Guard Tower (1) for (Owner of (Constructed structure)) at Position1 facing Default building facing degrees
          • Set Unit1[(Number of units in Unitgroup1)] = (Last created unit)
        • Else - Actions
This second trigger is supposed to randomize every unit in the group, but it doesn't.
  • Primary Shuffle
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: hello
      • For each (Integer A) from 1 to (Number of units in Unitgroup1), do (Actions)
        • Loop - Actions
          • Set Int1 = (Random integer number between 1 and 2)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Int1 Equal to 1
            • Then - Actions
              • Set Position1 = (Position of Unit1[(Integer A)])
              • Unit - Remove Unit1[(Integer A)] from the game
              • Unit - Create 1 |c00ffff80Lightning Rod (1) for (Owner of Unit1[(Integer A)]) at Position1 facing Default building facing degrees
              • Set Unit1[(Integer A)] = (Last created unit)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Int1 Equal to 2
            • Then - Actions
              • Set Position1 = (Position of Unit1[(Integer A)])
              • Unit - Remove Unit1[(Integer A)] from the game
              • Unit - Create 1 |c0080ff80Envenomed Spike (1) for (Owner of Unit1[(Integer A)]) at Position1 facing Default building facing degrees
              • Set Unit1[(Integer A)] = (Last created unit)
            • Else - Actions
Can anyone see/tell me what should be changed for the second trigger to work?

(variable names are filler atm)

EDIT: Hmm, I think I got it working...
 
Last edited:
Status
Not open for further replies.
Top