| 08-28-2005, 04:03 AM | #1 |
I've read a few tutorials and things, but I still don't quite get it. What exactly leaks in GUI triggers? Or are all the leaks in my map caused by the 1% of the triggers that are custom scripts (which I haven't leak proffed yet)? I might have follow up questions, but I need this clarified first =) As for the custom script leaks, I probably just need to add one line at the end of a few triggers, which removes a local unit variable. Could I see the code for that too? [edit] I'm also using WEU, if that makes a difference... |
| 08-28-2005, 08:13 AM | #2 |
Handles leak. Handles are all variables except real, integer, boolean and string. Whenever in GUI you write "position of unit (Dude)" It creates the location of the position of the unit, although it is then lost as it is not stored into a variable and then destroyed. The only ones you need to worry about are locations, groups (unit and player) and probobly special effects ( wits SFX's theres a GUI function to destroy it.) since your using an enhanced WE, itll probobly come with the deconstructers unlike normal WE where you would need to insert custom text to destroy the handle. |
| 08-28-2005, 06:36 PM | #3 |
Ok, the unit and player groups sound easy enough. For the unit groups I just need to use "Unit Group - Destroy unit group (Last created unit group)" or "Advanced - Turn destruction of leaking unit groups On for the next created group", right? Looks like I need a custom script to destroy the player groups though, but I can't seem to find what it is... What about the points/locations - which ones of these would leak? 1) TargetPoint is a global array, so I'm assuming this won't leak: Set TargetPoint[(Player number of (Picked player))] = ((Position of CurrentUnit) offset by -80.00 towards (Facing of CurrentUnit) degrees) 2) I'm pretty sure this would cause leaks, but could I stop them with only one extra point variable (equal to position of CurrentUnit)? If - Conditions (Distance between (Position of CurrentUnit) and TargetPoint[(Player number of (Picked player))]) Greater than or equal to (360.00 / 0.30) 3) Same solution as #2 I assume? Camera - Pan camera for (Picked player) to ((Position of CurrentUnit) offset by 320.00 towards (Angle from (Position of CurrentUnit) to TargetPoint[(Player number of (Picked player))]) degrees) over 1.00 seconds |
| 09-02-2005, 10:29 PM | #4 |
Sorry to have to revive this, but I really need this answered before I can start doing anything. The last thing I'd want to do is try to get rid of the leaks, and then find out I did it wrong... |
| 09-02-2005, 11:20 PM | #5 | |
Quote:
This one will leak, actually it will leak twice as polar projection function will leak too. so set TargPoint = Position of Current Unit set TargPoint2 = (TargPoint) offset by -80.00 towards (Facing of CurrentUnit) degrees) custom text: call RemoveLocation(TargPoint) custom text: call RemoveLocation(TargPoint2) And do the same for the other 2 wherever position of unit is, set it into a variable, reference it off the variable and then remove it after you finish using it. |
| 09-02-2005, 11:57 PM | #6 |
Ok, now I get it, thanks =] I've got a lot of work to do then. One more question (hopefully): do global player or unit groups ever leak anything (when they're picked or changed)? |
| 09-03-2005, 01:54 AM | #7 |
The trigger pick every unit doesnt leak if used with a group variable. It only leaks when you do: pick every unit in ( units in 500 range of blah) This is because it creates a group and doesnt destroy it (unless you save it as a variable before hand or use the bj_Want_Destroy_Group = true. |
| 09-05-2005, 10:38 PM | #8 |
Ok, I think I understand everything, but now something weird happened: Set p1 = (Target point of issued order) Set p2 = (Position of (Triggering unit)) Set p3 = (p1 offset by 100.00 towards (Angle from p2 to p1) degrees) Set TargetPoint[(Player number of (Owner of (Triggering unit)))] = p3 Point - Remove p1 Point - Remove p2 Point - Remove p3 I don't think it leaks, but TargetPoint, instead of being what it's supposed to be, is a point in the centre of the map. It does the same thing if I use "call RemoveLocation(udg_p1)" instead. There's a similar trigger using p1,p2,p3 that doesn't work, but there's a third trigger that uses only p1 and works fine. I'm REALLY confused... [edit] The other trigger that doesn't work also sets a global point array (the same one actually), and the one that does work plays a 3d sound at a point. [Edit2] Maybe because I remove p3, the value in the global variable is also removed. Can I get around this without it leaking? [Edit3] I changed it to this so now it works. But does it leak? I sure hope not =p Set p1 = (Target point of issued order) Set p2 = (Position of (Triggering unit)) Set TargetPoint[(Player number of (Owner of (Triggering unit)))] = (p1 offset by 100.00 towards (Angle from p2 to p1) degrees) Point - Remove p1 Point - Remove p2 |
| 09-06-2005, 05:13 AM | #9 |
as long as you remove target point. |
