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

Help me please: LEAKS

Status
Not open for further replies.
Level 11
Joined
Feb 23, 2009
Messages
577
Hi everyone,

I was wondering if someone could help me fix a major leak issue on my map, I am about to make a sequel to my fun but leaky: "Doomsday" campaign.

Hope someone can help! Thanks!...
 

Attachments

  • FPS 1.w3x
    317.7 KB · Views: 51
Level 20
Joined
Jul 14, 2011
Messages
3,213
If you're going to use the same value several time is better to use it into a variable, instead of getting it over and over. Every time you see parentheses, means the system is doing an action to get the information inside them. Same goes with anything else. Is not a leak, but improves efficiency. Also, I don't get the point on doing all those multiboard stuff in the Map Init.

  • Set Guns = (Last created multiboard)
  • Multiboard - Hide (Last created multiboard)
->->->->->->
  • Set Guns = (Last created multiboard)
  • Multiboard - Hide Guns


  • Up Go 1
    • Conditions
      • (Terrain type at ((Position of Doom 0002 <gen>) offset by 200.00 towards (Facing of Doom 0002 <gen>) degrees)) Not equal to Dungeon - Dark Rocks
1 Leak: Position of Doom 002
2 Leak: Offset.

You can remove the condition from the general trigger conditions, and use it inside an If/Then/Else, declaring the point (Position of Doom) and the offset (Point1 Offset by 200) before.

  • Up Go 1
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set Point1 = (Position of Doom 0002 <gen>)
      • Set Point2 = (Point1 offset by 200.00 towards (Facing of Doom 0002 <gen>) degrees)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain type at Point2) Not equal to Dungeon - Dark Rocks
        • Then - Actions
          • Custom script: call RemoveLocation(udg_Point2)
          • Camera - Set Player 1 (Red)'s camera Distance to target to 500.00 over 0.00 seconds
          • Camera - Set Player 1 (Red)'s camera Height Offset to 133.00 over 0.00 seconds
          • Camera - Set Player 1 (Red)'s camera Field of view to 35.00 over 0.00 seconds
          • Camera - Set Player 1 (Red)'s camera Angle of attack to 352.00 over 0.00 seconds
          • Camera - Set Player 1 (Red)'s camera Far Z to 5000.00 over 0.00 seconds
          • Set Point2 = (Point1 offset by 10.00 towards (Facing of Doom 0002 <gen>) degrees)
          • Unit - Move Doom 0002 <gen> instantly to Point2, facing (Facing of Doom 0002 <gen>) degrees
          • Camera - Set Player 1 (Red)'s camera Rotation to (Facing of Doom 0002 <gen>) over 0.00 seconds
          • Custom script: call RemoveLocation(udg_Point1)
          • Custom script: call RemoveLocation(udg_Point2)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Attacking Equal to 0.00
            • Then - Actions
              • Animation - Play Doom 0002 <gen>'s walk animation
            • Else - Actions
        • Else - Actions
          • Custom script: call RemoveLocation(udg_Point1)
          • Custom script: call RemoveLocation(udg_Point2)
Same with the rest of the triggers.


  • Selection - Select (Random unit from (Units owned by Player 1 (Red) of type Doom Dummy)) for Player 1 (Red)
You leak a group (Units Owned...) ->

  • Set Group = (Units owned by Player 1 (Red) of type Doom Dummy)
  • Selection - Select (Random unit from Group) for Player 1 (Red)
  • Custom script: call DestroyGroup(udg_Group)


Using 0.03 event is enough and faster/lighter than 0.01.



Two point leak. Position of Unit, and Offset.
  • Unit - Move Target 0011 <gen> instantly to ((Position of Doom 0002 <gen>) offset by 300.00 towards (Facing of Doom 0002 <gen>) degrees), facing (Position of Doom 0002 <gen>)
Another Point Leak
  • Region - Center Items <gen> on (Position of Doom 0002 <gen>)
More Point Leaks
  • Unit - Remove (Random unit from (Units owned by Player 1 (Red) matching (((Unit-type of (Matching unit)) Equal to Bullet) and ((Distance between (Position of Doom 0002 <gen>) and (Position of (Matching unit))) Greater than or equal to 3500.00)))) from the game
So far, you may have noticed that everytime you use "Position of..." You have to declare it into a variable, and then remove it when you don't need it anymore. If you're using Offset, you need a point for the "Point", and a Point for the Offset, and remove both later. Distance between 2 points involves 2 points: declare both, use them, remove them.

  • Unit Group - Pick every unit in (Units within 100.00 of (Position of (Random unit from (Units owned by Player 1 (Red) of type Bullet))) matching ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Not equal to Player 1 (Red)))) and do (Actions)
    • Loop - Actions
      • Unit - Cause Doom 0002 <gen> to damage (Picked unit), dealing 10.00 damage of attack type Pierce and damage type Normal
      • Unit - Remove (Random unit from (Units within 100.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Bullet))) from the game
Every "Pick Every Unit" involves the creation of a Unit Group to handle those units. You can place a "set bj_wantDestroyGroup = true" before the action "Pick Every Unit" or declare it into a Unit Group variable, use it, and then destroy it. If you're going to use another Unit Group inside the Unit Group, you have to declare it into the variable, just like you're doing. You're picking every unit in (This is the first Unit Group) Units within 100 of (Position of (Random Unit... <- A Point leak -> ...from (The second Unit Group)).



Most of your leaks are "Position of"... Solve all of them the way I've showed. Do the same with Unit Groups. Solve all of them. I Would suggest also changing 0.01 for 0.03~0.05.
 
Last edited:
Level 11
Joined
Feb 23, 2009
Messages
577
Thanks a bunch for taking the time to help guys, I'm getting right on it.

Also I heard that game-time seconds may create leaks, is that true? If so how do I change the periodic events to time and not game time?

Again thanks so much :thumbs_up:...
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
No... Events can't leak =)

Whenever you use, Points, Special Effects, Sounds, Unit Groups, and some other actions, Wc3 stores it in memory... If you don't remove it, you'll store "garbage" in the memory... and eventually lag a lot.

What most leaks if when you use "Pick Every unit..." the wrong way in a periodic event (0.01 secs) it means the trigger will run 100 times in 1 sec... Creating 100 leaks per sec.
 
Status
Not open for further replies.
Top