• 🏆 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] Questions about Leaks

Status
Not open for further replies.
Level 2
Joined
Oct 22, 2012
Messages
17
Hey guys, I've been going over some of the threads and tutorials about trigger leaks but I still have a few questions I thought I'd post to the community and see if any of you could help me out with some specifics.

1. Will having triggers that only affect a certain single unit cause leaks? Most of the threads and tutorials talk about unit groups and points on the map, but for example:
Trigger
A unit is attacked
Condition
Attacking unit has specific buff 'X'
Action
Cause attacking unit to deal 20 extra damage to attacked unit

In this case, will it leak? If so, I need to assign attacking unit and attacked unit to variables and then use custom script to 'remove' them right? If that's the case does anybody know the custom script for a single unit? (I only know GUI)

2. Leaks regarding points - I'm developing a map where units are generated in specific and preset regions (i.e. center of specific regions) in a recurring pattern. If that point is being 'reused' every so often, do i still need to protect from leaks because they're just these specific 50 points on the map?

3. Like #2, if recurring points cause leaks, then do warpgates cause leaks? because they send units to other points, other warpgates. Question 3.a is I have triggers in place to work as warpgates, where basically a unit enters a region and they immediately get sent to a certain point, will those cause leaks?

If i could get these questions answered, that would be very awesome. Thanks!
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
1. No.
2. Set the points on map startup and reuse them, without ever using RemoveLocation on them. The definition of a leal is data that is used once and stays in memory without being used again.
3. AFAIK warpgates don't leak, but I've never tested and it wouldn't really surprise me if they do.
3.a. This can leak if you don't set the point to a temp variable and remove it afterwards.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Units do leak but that is an game bug. There is no known fix for unit leaks and all created units will leak no mater how they are removed.

local units (such as "local unit u" but not locals from function arguments) can leak handle indicies which is another type of leak and fixable by nulling them at the end of a function.
 
Level 2
Joined
Oct 22, 2012
Messages
17
Thank you guys so much, rep to all of you. My only follow up question is: What is a 'temp variable?' Is that different from a normal variable? Or is it just that i delete it with custom script?
 
Status
Not open for further replies.
Top