The official site of Clan TMMM
 
HomeHomeSearchUsergroupsFAQRegisterLog in


Latest topics
» Hey whats up
by seankly Yesterday at 1:55 pm

» Gotta click fast - WC3 Mazing #mildlyinteresting
by hoffmann Wed Jun 21, 2017 10:28 pm

» I'm getting married and you guys are invited
by Achilles.42 Wed Sep 07, 2016 11:00 am

» Server Photo Album 1
by Pat1487 Sat Aug 06, 2016 5:28 pm

» Legacy of The Void Beta
by Achilles.42 Sun Oct 18, 2015 3:21 am

» Hey guys!!!
by Eat_bacon_daily Fri Oct 16, 2015 11:20 pm

» What everyone been up to
by The_Chosen_Oreo Sun Jun 14, 2015 11:55 am

SC2 Links
SC2 Challenge/Tourney Info

Official SC2 Forums

SC2 Curse

SC2Mapster

Team Liquid

SC2 Replayed

SC2 Strategy
WC3 Links
Clan_TMMM[Host] Info

WC3 Challenge/Tourny Rules

Epicwar
Poll
What game does everyone play now?
Starcraft 2
26%
 26% [ 8 ]
Warcraft 3
35%
 35% [ 11 ]
League of Legends
19%
 19% [ 6 ]
World of Warcraft
0%
 0% [ 0 ]
Diablo 2
0%
 0% [ 0 ]
No games at all
10%
 10% [ 3 ]
Other game not listed
10%
 10% [ 3 ]
Total Votes : 31
Transparency

Share | 
 

 Trigger Leaks

Go down 
AuthorMessage
Eat_bacon_daily
Captain
Captain
avatar


PostSubject: Trigger Leaks   Tue Aug 09, 2011 12:25 pm

-So i have these 2 triggers that leak like 25% of the time witch is really annoying.
-I was wondering if theres a simple way to fix it.
-Also would using like set TemPoint to position of unit then making the effect on temPoint fix this or even reduce.


For this trigger its the lightning effects (special effects work fine)



For this one the texte just stays on there FOREVER!
Back to top Go down
The_Chosen_Oreo
Corporal
Corporal
avatar


PostSubject: Re: Trigger Leaks   Tue Aug 09, 2011 12:30 pm

Do you have any other floating texts that are created during that time?

During the "Wait 1 Second", another floating text could have been created, thus messing up the Last Created Floating Text.

If you need to, just do Trigger - Turn off (This Trigger) at the beginning of the actions, and do Trigger - Turn on (This Trigger) at the end of the actions.

Also, you could increment an integer each time and store the floating text in an array, where you can manually delete everything later.
Back to top Go down
Serenity09
Moderator
Moderator
avatar


PostSubject: Re: Trigger Leaks   Tue Aug 09, 2011 1:10 pm

oreo is right

because both have a wait inside of them before any of the effects are destroyed, its very possible that the trigger will run again

think of last created floating text or last created lightning effect as a variable made by the game (just like the variables you make, except you can't directly touch this one) that is set whenever you make the matching handle type (handles are pretty much anything that isn't number related - special effects, floating text, units etc). most handles have a "last created" variable like this, but none of these are arrays - ie... there can only be one "last created"

an important part of triggers is making them MUI, which means Multi User Instanceable. i'm sure you've run into the problem where you can make something that works really well for one person, but as soon as you bring another person into the mix trying to use the same effect - it all falls apart.

you have a few ways to fix the leak

the easiest is turning it off and on like oreo said, although this doesn't really fix the effect to work perfectly (as is won't run in close succession), it will fix the leaks.

if you wanted the leaks gone and the effect to still display every time you'd have to store the handles in an array, but this leads to the problem of when to periodically clear the array. you could maybe clear the handles that belong to the single trigger from the array, but i can't think of any easy (or really even any hard) ways to do that.

i'd probably attach the effects to a timer and then just have the timer destroy them after.
i think you'd need JASS to do it, and the way i think i'd do it would use vJASS

something like
have a struct for each effect type with enough variables to store all the effects created
then have a method to destroy/clear all those variables
then have the create method of the struct define those variables and start a one shot timer which is attached to the above method
then destroy/release the timer

ie
Code:
struct UnitAttacked

private effect e1
private effect e2
private lightning l1
private timer t = CreateTimer()

private method DestroyEffects takes nothing returns nothing

    call DestroyEffect(e1)
    call DestroyEffect(e2)
    call DestroyLightning(l1)
    call DestroyTimer(t)
    set e1 = null
    set e2 = null
    set l1 = null
    set t = null
endmethod

public method create takes effect ue1, effect ue2, lightning ul1, real waittime returns UnitAttacked

    local UnitAttacked UA = UnitAttacked.allocate()
    call TimerStart(UA.t, waittime, false, function DestroyEffects)
    //altho it might be:
    //call TimerStart(UA.t, waittime, false, function UA.DestroyEffects)
    return UA
endmethod

endstruct

also for the first screen shot you posted, the first special effect (not lightning) will never get destroyed. its place as last created effect is being overwritten by the next one you make in the same trigger. you could get around this by making a temp variable that holds it, but this'll have the same problems as you already have with the last created and the wait timer.
Back to top Go down
Eat_bacon_daily
Captain
Captain
avatar


PostSubject: Re: Trigger Leaks   Wed Aug 10, 2011 7:15 pm

Damn ty for the help guys. Didnt know it was so complicated >.<
Back to top Go down
Sponsored content




PostSubject: Re: Trigger Leaks   

Back to top Go down
 
Trigger Leaks
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Clan TMMM :: Warcraft 3 :: WC3 Tutorials and Help-
Jump to: