Trigger Working Weird

Jscooby

New Member
Reaction score
1
So I have this trigger...
Trigger:
  • Pheasants
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game - Display to (All players) for 10.00 seconds the text: You have 30 seconds...
      • Wait 30.00 seconds
      • Set TempPoint = (Center of Region 006 <gen>)
      • Set TempPoint2 = (Center of Region 009 <gen>)
      • Unit - Create 5 Peasant for Player 10 (Light Blue) at TempPoint facing 270.00 degrees
      • Unit Group - Order (Last created unit group) to Attack-Move To TempPoint2
      • Set TempPoint = (Center of Region 007 <gen>)
      • Unit - Create 5 Peasant for Player 10 (Light Blue) at TempPoint facing 270.00 degrees
      • Unit Group - Order (Last created unit group) to Attack-Move To TempPoint2
      • Set TempPoint = (Center of Region 008 <gen>)
      • Unit - Create 5 Peasant for Player 10 (Light Blue) at TempPoint facing 270.00 degrees
      • Unit Group - Order (Last created unit group) to Attack-Move To TempPoint2


It works fine all the time.. But now I have this trigger which spawns units after all the pheasants have died.

Trigger:
  • Shades
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set tempGroup = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Peasant) and (((Matching unit) is alive) Equal to True)))
      • Game - Display to (All players) the text: You have 10 seconds...
      • Wait 10.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempGroup) Less than or equal to 0
        • Then - Actions
          • Set TempPoint = (Center of Region 006 <gen>)
          • Set TempPoint2 = (Center of Region 009 <gen>)
          • Unit - Create 5 Ghoul for Player 10 (Light Blue) at TempPoint facing 270.00 degrees
          • Unit Group - Order (Last created unit group) to Attack-Move To TempPoint2
          • Set TempPoint = (Center of Region 007 <gen>)
          • Unit - Create 5 Ghoul for Player 10 (Light Blue) at TempPoint facing 270.00 degrees
          • Unit Group - Order (Last created unit group) to Attack-Move To TempPoint2
          • Set TempPoint = (Center of Region 008 <gen>)
          • Unit - Create 5 Ghoul for Player 10 (Light Blue) at TempPoint facing 270.00 degrees
          • Unit Group - Order (Last created unit group) to Attack-Move To TempPoint2
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • Custom script: call DestroyGroup (udg_tempGroup)


It spawns great masses of the ghouls, I'm not understanding why it just doesn't spawn the 5 in each region and stop?
 

jomik

New Member
Reaction score
17
Uhh, yeah, it's because the tempGroup is set before the wait and then checked after, so if the trigger is run again and again, untill no peasants is left, and then all triggers check and spawn peasants :p
Try something like this:

Trigger:
  • Shades
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set tempGroup = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Peasant) and (((Matching unit) is alive) Equal to True)))
      • Game - Display to (All players) the text: You have 10 seconds...
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempGroup) Less than or equal to 0
        • Then - Actions
          • Wait 10.00 seconds
          • Set TempPoint = (Center of Region 006 <gen>)
          • Set TempPoint2 = (Center of Region 009 <gen>)
          • Unit - Create 5 Ghoul for Player 10 (Light Blue) at TempPoint facing 270.00 degrees
          • Unit Group - Order (Last created unit group) to Attack-Move To TempPoint2
          • Set TempPoint = (Center of Region 007 <gen>)
          • Unit - Create 5 Ghoul for Player 10 (Light Blue) at TempPoint facing 270.00 degrees
          • Unit Group - Order (Last created unit group) to Attack-Move To TempPoint2
          • Set TempPoint = (Center of Region 008 <gen>)
          • Unit - Create 5 Ghoul for Player 10 (Light Blue) at TempPoint facing 270.00 degrees
          • Unit Group - Order (Last created unit group) to Attack-Move To TempPoint2
          • Custom script: call DestroyGroup (udg_tempGroup)
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • Custom script: call DestroyGroup (udg_tempGroup)


Just added an extra DestroyGroup before the trigger turns off, otherwise it'll leak.
 

Jscooby

New Member
Reaction score
1
Now I have this trigger...

What I want is waves of enemies to come after the previous wave has been killed..

Trigger:
  • Archers
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set tempGroup2 = (Units in (Playable map area) matching ((((Unit-type of (Triggering unit)) Equal to Peasant) or ((Unit-type of (Triggering unit)) Equal to Ghoul)) and (((Matching unit) is alive) Equal to True)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempGroup2) Less than or equal to 0
        • Then - Actions
          • Game - Display to (All players) the text: You have 15 seconds...
          • Wait 15.00 seconds
          • Set TempPoint = (Center of Region 006 <gen>)
          • Set TempPoint2 = (Center of Region 009 <gen>)
          • Unit - Create 5 Archer for Player 10 (Light Blue) at TempPoint facing 270.00 degrees
          • Unit Group - Order (Last created unit group) to Attack-Move To TempPoint2
          • Set TempPoint = (Center of Region 007 <gen>)
          • Unit - Create 5 Archer for Player 10 (Light Blue) at TempPoint facing 270.00 degrees
          • Unit Group - Order (Last created unit group) to Attack-Move To TempPoint2
          • Set TempPoint = (Center of Region 008 <gen>)
          • Unit - Create 5 Archer for Player 10 (Light Blue) at TempPoint facing 270.00 degrees
          • Unit Group - Order (Last created unit group) to Attack-Move To TempPoint2
          • Custom script: call DestroyGroup (udg_tempGroup2)
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • Custom script: call DestroyGroup (udg_tempGroup2)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top