• 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] condition structure

Status
Not open for further replies.
Level 11
Joined
Nov 12, 2006
Messages
765
how can i do a trigger where it picks every unit and then in the If/Then/Else as a condition it doesnt pick any buildings of the player? an example is shown here

  • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Picked unit) Not equal to *STRUCTURE*
        • Then - Actions
          • Unit - Kill (Picked unit)
        • Else - Actions
          • Do nothing
i think an easier way to do it would be to just pick every unit in (units owned by player 1 (red)) not equal to *structure*) and do actions...

except i dont know how to do that. +rep to anyone who helps ^^
 
Level 11
Joined
Oct 20, 2007
Messages
342
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A structure) Equal to False
              • (Owner of (Picked unit)) Not equal to Player 1 (Red)
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions
u mean like this??

unit is a structure is in boolean comparison > unit - classification check
player is player unit is in player comparison > owner of unit
 
Level 12
Joined
Aug 22, 2008
Messages
911
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A structure) Equal to False
              • (Owner of (Picked unit)) Not equal to Player 1 (Red)
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions
u mean like this??

unit is a structure is in boolean comparison > unit - classification check
player is player unit is in player comparison > owner of unit

THAT WILL NOT WORK!!!
One selected unit that does not fit the conditions stated will set the trigger to Else.
This will work:
  • Unit Group - Pick every unit owned by Player 1 matching (Matching Unit is a structure) equal to False and do (Actions)
    • Loop - Actions
      • (Actions)
You will select this in the (Owner by Player matching Condition) option. Good luck!
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
THAT WILL NOT WORK!!!
One selected unit that does not fit the conditions stated will set the trigger to Else.
This will work:
  • Unit Group - Pick every unit owned by Player 1 matching (Matching Unit is a structure) equal to False and do (Actions)
    • Loop - Actions
      • (Actions)
You will select this in the (Owner by Player matching Condition) option. Good luck!

Actually what jareph said will work, yours is just more compact, however if you need a high amount of conditions then jareph version is better.

EDIT: Just don;t use map init.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Actually of what has been given so far, this is the best one by far(though it had a spelling mistake):

  • Set GroupVar = Units owned by Player 1 (Red)) and (matching unit) is a building equal to false
  • Unit Group - Pick every unit in GroupVar
    • Loop - Actions
      • Unit - Kill (Picked unit)
    • Else - Actions
  • Custom script: call DestroyGroup(udg_GroupVar)
This shall pick every unit by player red, that is not a building

P.s.
jareph works, but leaks and is more CPU intensive because he picks up all units and then filters them, rather than picking while filtering resulting in a faster less laggier trigger.

idodik works as well but leaks
 
Status
Not open for further replies.
Top