• 🏆 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!

whats the best method to use?

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2010
Messages
950
whats the best way to make this group then remove it for leaks

  • Set Temp_PlayerGroup = (All players matching (((Name of (Matching player)) Equal to PlayerName) or (((Name of (Matching player)) Equal to PlayerName2) or (((Name of (Matching player)) Equal to PlayerName3) or ((Name of (Matching player)) Equal to PlayerName4)))))
or like this

  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Name of (Picked player)) Equal to PlayerName
              • (Name of (Picked player)) Equal to PlayerName2
              • (Name of (Picked player)) Equal to PlayerName3
              • (Name of (Picked player)) Equal to PlayerName4
        • Then - Actions
          • Player Group - Add (Picked player) to Temp_PlayerGroup
        • Else - Actions
then at the end of what im doing remove with this
call DestroyForce(udg_Temp_PlayerGroup)

for the sake of it being easier to add names i would like to be able to use the 2nd one but does that work the same way as the first for destroying a player group to clean leaks?
Or if i do it the 2nd way does the group even need to be cleaned if i just use
  • Player Group - Remove all players from Temp_PlayerGroup
?
 
Level 22
Joined
Aug 27, 2013
Messages
3,973
first of all, it's your choice to use first or second method
if you use the second one.. why you add it to Tempplayergroup?
if you add it to a group for another use, just destroyforce it

Edit: i'm not sure if you must destroy it.. because Ralle said, if you destroy All Players it may cause problem
 
Level 13
Joined
Mar 24, 2010
Messages
950
good i like the 2nd one better for editing anyway :)

I would use the All Players option since the first one leaks, you can't prevent that in GUI.
i thought call DestroyForce(udg_Temp_PlayerGroup) removed the leak

also i guess i could just make this a perma player group even thought its not fully needed.. but doesnt a player group leak when you make 1 or add players to it? it will take up that memory that whole game right? i understand how temp groups work but what about perma groups that are made?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Custom script : call GroupEnumUnitsInRange(bj_lastCreatedGroup, x, y, radius, null)
  • Unit Group - Pick every unit in (Last created unit group) and do (Actions)
    • Loop - Actions
      • Set unit = (Picked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (unit is dead) Equal to False
          • (unit is A structure) Equal to False
        • Then - Actions
        • Else - Actions
 
Status
Not open for further replies.
Top