• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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?
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
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