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

[Solved] Periodic Event causes memory leaks??

Status
Not open for further replies.
Level 3
Joined
Nov 7, 2012
Messages
38
Hello to all kind guys...I have a stupid question here...
I use this method to create the timer of my map...and can this causes memory leak? My game's players often disconnect from my map so I check all my triggers that has periodic event...and now I noticed for this trigger but I m not confirm is it occurs the bug?

  • count nc spawn timer
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Player_Timer = (All players)
      • Player Group - Pick every player in Player_Timer and do (Actions)
        • Loop - Actions
          • Player - Add 1 to (Picked player) Food used
 
Level 3
Joined
Nov 7, 2012
Messages
38
That shouldn't cause any problems. "All players" is a predefined player group, so you're not creating a new one. You're just referencing an unchanging global variable.
Thanks for the reply...hmmmm...and how about this??...I can't see any problem here...

  • patrol periodly
    • Events
      • Time - Every 8.00 seconds of game time
    • Conditions
    • Actions
      • Set WaveGroup1 = (Units of type Treant)
      • Set WaveGroup2 = (Units of type Hippogryph)
      • Set Treant_Point = (Center of PlayerRegion[(Random integer number between 1 and 8)])
      • Unit Group - Pick every unit in WaveGroup1 and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Patrol To Treant_Point
          • Custom script: call RemoveLocation (udg_Treant_Point)
      • Custom script: call DestroyGroup (udg_WaveGroup1)
      • Unit Group - Pick every unit in WaveGroup2 and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Patrol To Treant_Point
          • Custom script: call RemoveLocation (udg_Treant_Point)
      • Custom script: call DestroyGroup (udg_WaveGroup2)
 
Thanks for the reply...hmmmm...and how about this??...I can't see any problem here...

  • patrol periodly
    • Events
      • Time - Every 8.00 seconds of game time
    • Conditions
    • Actions
      • Set WaveGroup1 = (Units of type Treant)
      • Set WaveGroup2 = (Units of type Hippogryph)
      • Set Treant_Point = (Center of PlayerRegion[(Random integer number between 1 and 8)])
      • Unit Group - Pick every unit in WaveGroup1 and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Patrol To Treant_Point
          • Custom script: call RemoveLocation (udg_Treant_Point)
      • Custom script: call DestroyGroup (udg_WaveGroup1)
      • Unit Group - Pick every unit in WaveGroup2 and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Patrol To Treant_Point
          • Custom script: call RemoveLocation (udg_Treant_Point)
      • Custom script: call DestroyGroup (udg_WaveGroup2)

The RemoveLocation script should be moved outside the Unit Group Action Loop because the design is such that the location exists once and only once for the Unit Group loop. Other than that, it looks fine.
 
Level 3
Joined
Nov 7, 2012
Messages
38
The RemoveLocation script should be moved outside the Unit Group Action Loop because the design is such that the location exists once and only once for the Unit Group loop. Other than that, it looks fine.
  • patrol periodly
    • Events
      • Time - Every 8.00 seconds of game time
    • Conditions
    • Actions
      • Set WaveGroup1 = (Units of type Treant)
      • Set WaveGroup2 = (Units of type Hippogryph)
      • Set Treant_Point = (Center of PlayerRegion[(Random integer number between 1 and 8)])
      • Unit Group - Pick every unit in WaveGroup1 and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Patrol To Treant_Point
      • Custom script: call RemoveLocation (udg_Treant_Point)
      • Custom script: call DestroyGroup (udg_WaveGroup1)
      • Unit Group - Pick every unit in WaveGroup2 and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Patrol To Treant_Point
      • Custom script: call RemoveLocation (udg_Treant_Point)
      • Custom script: call DestroyGroup (udg_WaveGroup2)
like this? or move below the unit group script?
 
Level 3
Joined
Nov 7, 2012
Messages
38
Only 1 RemoveLocation after the last group Loop.
  • patrol periodly
    • Events
      • Time - Every 8.00 seconds of game time
    • Conditions
    • Actions
      • Set WaveGroup1 = (Units of type Treant)
      • Set WaveGroup2 = (Units of type Hippogryph)
      • Set Treant_Point = (Center of PlayerRegion[(Random integer number between 1 and 8)])
      • Unit Group - Pick every unit in WaveGroup1 and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Patrol To Treant_Point
      • Unit Group - Pick every unit in WaveGroup2 and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Patrol To Treant_Point
      • Custom script: call DestroyGroup (udg_WaveGroup2)
      • Custom script: call RemoveLocation (udg_Treant_Point)
just like this?
 
Level 3
Joined
Nov 7, 2012
Messages
38
Yeah. Thank you very much to all kind ones who spent time to reply me. +rep to every kind one xD
 
Status
Not open for further replies.
Top