• 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.

Which is Better

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
So there are two ways of filtering which units you want to be affected within a unit group.

  • Set TempUnitGroup = (Units within 800.00 of TempPoint matching ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and ((((Owner of (Matching unit)) Not equal to Player 9 (Gray)) and ((Owner of (Matching unit)) Not equal to Neutral Passive)) and ((
  • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
    • Loop - Actions
      • Your Actions
  • Set TempUnitGroup = (Units within 800.00 of TempPoint)
  • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True
          • (Owner of (Matching unit)) Not equal to Player 9 (Gray)
          • (Owner of (Matching unit)) Not equal to Neutral Passive
          • (Unit-type of (Picked unit)) Not equal to Bunker
          • (Unit-type of (Picked unit)) Not equal to Firebat
        • Then - Actions
          • Your Actions
        • Else - Actions
Which is faster or are they both the same?
The second one is much nicer to work with and edit. Unless it is much slower I think it is ideal?
 
The third is faster.

  • Set TempUnitGroup = (Units within 800.00 of TempPoint)
  • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
    • Loop - Actions
      • Set tempUnit = (Picked unit)
      • Set tempUnitType = (Unit-type of tempUnit)
      • Set tempPlayer = (Owner of tempUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (tempUnit belongs to an enemy of tempPlayer) Equal to True
          • tempPlayer Not equal to Player 9 (Gray)
          • tempPlayer Not equal to Neutral Passive
          • tempUnitType Not equal to Bunker
          • tempUnitType Not equal to Firebat
        • Then - Actions
          • Your Actions
        • Else - Actions
    • Set tempUnit = No unit
    • Custom script: set udg_tempPlayer = null
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
Interesting. Thanks for that. Kind of glad I don't need to use option 4 (modified option 1, lol). And I don't normally nullify points or variables, but will do if it helps performance. Thanks mate, I'd rep but I already did last night regarding the MUI question.

Edit: You seem to be nulling everything but not the Unit_Type. Should I null the unit type too?

  • Set TempUnitType = No unit-type
 
Status
Not open for further replies.
Top