Unit selection in region

Status
Not open for further replies.
Level 6
Joined
Jan 29, 2010
Messages
213
whats wrong with these triggers? I cant get them working...
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
      • RoundOn Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Footman
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (2a <gen> contains (Triggering unit)) Equal to True
            • Then - Actions
              • Unit Group - Pick every unit in (Units in 3a <gen>) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in (Units in 3a <gen>)) Equal to 0
                    • Then - Actions
                      • Unit - Create 1 Footman for Player 1 (Red) at (Center of 3a <gen>) facing Default building facing degrees
                    • Else - Actions
            • Else - Actions
        • Else - Actions
 
please say what's not working...

THIS: if the unit group loop runs, there is no way thay the number of units in 3a is equal to 0... the create unit will never run... just remove the group loop, its useless...

here's an edited code, also fixed leaks
  • Events
    • Player - Player 1 (Red) Selects a unit
  • Conditions
    • RoundOn Equal to True
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Triggering unit)) Equal to Footman
      • Then - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (2a <gen> contains (Triggering unit)) Equal to True
          • Then - Actions
            • Set TempGroup = Units in 3a <gen>
            • Set TempLoc = Center of 3a <gen>
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Number of units in TempGroup) Equal to 0
              • Then - Actions
                • Unit - Create 1 Footman for Player 1 (Red) at (TempLoc) facing Default building facing degrees
              • Else - Actions
            • Custom script: call RemoveLocation(udg_TempLoc)
            • Custom script: call DestroyGroup(udg_TempGroup)
            • Else - Actions
 
Level 13
Joined
Oct 25, 2009
Messages
995
This is my idea,xD:
  • First
  • Events:
  • Unit - A unit enters Region 014 <gen>
  • Conditions:
  • (Unit-type of (Entering unit)) Equal to Footman
  • Actions:
  • Trigger - Turn on Untitled Trigger 006 <gen>
  • Trigger - Turn off (This trigger)
Next trigger(create a new trigger first)
  • Events:
  • Player - Player 1 (Red) Selects a unit
  • Conditions:
  • (Unit-type of (Triggering unit)) Equal to Footman
  • Actions:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Region 014 <gen> contains (Triggering unit)) Equal to True
    • Then - Actions
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of Region 014 <gen>) facing Default building facing degrees
      • Trigger - Turn off (This trigger)
    • Else - Actions
I think no problem == xD :goblin_boom:
 
Status
Not open for further replies.
Top