• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Leaks

Status
Not open for further replies.
Level 8
Joined
Feb 20, 2009
Messages
268
I want a quick fix to some things that leak, i was wondering if i change everything to have variables, will it make it leak less? i wish i could post my trigger but i dont know how so i will describe it.

E:A unit is selected
?:(Unit equal to (unit))
A:play sound (sound) from (unit) for triggering player

if i use variables dose it make it not leak?
 
Regions/rects are only considered "leaks" when you don't use them anymore. (just like most other handles) Example:

If you were to make a region each time you cast a spell, without removing it, it will leak.

But if you were to make a region for spawning and use it several times in your map, it isn't really considered a leak.

When you create one, it takes up memory. However, if you still need it, it is fine to keep it in memory, because you still need to reference/have access to it. :) If you don't need it, you should remove it to make sure it doesn't keep its place in memory. ;)

EDIT: For the first post, you don't need to destroy the sound if that trigger is going to be run several times throughout the game. Destroying the sound will make it so that it won't be able to be played again, unless you recreate it. Thus, you can pretty much leave it as it is. =)
 
JASS:
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)

call RemoveRect(gg_rct_this_is_my_region)
call RemoveRegion(GetTriggeringRegion())

call TriggerSleepAction( 3.00 )

call DisplayTextToPlayer( p , 0.00 , 0.00 , GetUnitName( u ))

set u = null

TriggerSleepAction has a crappy "kind of" alternative: PolledWait. Polled wait will not be called until after the TriggerSleepAction time has expired, but you are still at the mercy of whatever random-ass time the wait gives you after that mark.
 
When I was guiding some guy named "muffinpancakes" pointers on an MUI trigger system, his "GetTriggerUnit()" calls were not working after a certain wait period. When I had him use "local unit u = GetTriggerUnit()" that fixed the problem. Though I haven't tested this myself, but I imagine with the failure that is GUI anything is possible.
 
Status
Not open for further replies.
Top