• 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] Unit group

Status
Not open for further replies.
Hey everyone :D

Here is a trigger that spawns units of 3 different categories around the map.

  • Spawn
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in gNatural[1]) Less than 20
        • Then - Actions
          • Set Temp_Point = (pCenter offset by (Random real number between 600.00 and (Random real number between 4000.00 and 6000.00)) towards (Random real number between 0.00 and 360.00) degrees)
          • Unit - Create 1 uNatural[(Random integer number between 1 and 9)] for Neutral Passive at Temp_Point facing (Random real number between 0.00 and 360.00) degrees
          • Unit Group - Add (Last created unit) to gNatural[1]
          • Custom script: call RemoveLocation(udg_Temp_Point)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in gNatural[2]) Less than 20
        • Then - Actions
          • Set Temp_Point = (pCenter offset by (Random real number between 600.00 and (Random real number between 4000.00 and 6000.00)) towards (Random real number between 0.00 and 360.00) degrees)
          • Unit - Create 1 uNatural[(Random integer number between 50 and 58)] for Neutral Passive at Temp_Point facing (Random real number between 0.00 and 360.00) degrees
          • Unit Group - Add (Last created unit) to gNatural[2]
          • Custom script: call RemoveLocation(udg_Temp_Point)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in gNatural[3]) Less than 10
        • Then - Actions
          • Set Temp_Point = (pCenter offset by (Random real number between 600.00 and (Random real number between 4000.00 and 6000.00)) towards (Random real number between 0.00 and 360.00) degrees)
          • Unit - Create 1 uNatural[(Random integer number between 100 and 114)] for Neutral Passive at Temp_Point facing (Random real number between 0.00 and 360.00) degrees
          • Unit Group - Add (Last created unit) to gNatural[3]
          • Custom script: call RemoveLocation(udg_Temp_Point)
        • Else - Actions
      • Game - Display to (All players) the text: (String((Number of units in gNatural[2])))
I basicly repeated the same algorythem 3 times, but for the last 2 the units isn't added to the group. In other words, the unit keeps spawning but group[2] and [3] stays emty. Can someone explain why?

Thanks ^^
 
Status
Not open for further replies.
Top