How to fix this leak?

Grurf

Ultra Cool Member
Reaction score
30
I have some trigger code here that leaks a lot (maybe even all) of the special effects it creates. But I can't find it, this should properly remove them all. How to fix the leaking of special effects here?

Code:
Poisonous Cloud
    Events
        Unit - A unit enters (Entire map)
    Conditions
        (Unit-type of (Entering unit)) Equal to PoisonCloud
    Actions
        Set PoisonCloudLoc = (Position of (Entering unit))
        For each (Integer PoisonCloud) from 1 to 30, do (Actions)
            Loop - Actions
                Set PoisonCloudGroup = (Units within 300.00 of PoisonCloudLoc matching (((((Matching unit) is dead) Equal to False) and (((Matching unit) is A ground unit) Equal to True)) and (((Matching unit) belongs to an enemy of (Owner of PoisonCloudCaster)) Equal to True)))
                Set PoisonCloudAmount = (Number of units in PoisonCloudGroup)
                Unit Group - Pick every unit in PoisonCloudGroup and do (Actions)
                    Loop - Actions
                        Unit - Order (Entering unit) to damage (Picked unit) for (20.00 x (Real((Level of Poisonous Cloud [Ancient Naga Enchantress] for PoisonCloudCaster)))) using attack type Spells and damage type Normal.
                For each (Integer PoisonCloudInnerLoop) from 1 to PoisonCloudAmount, do (Actions)
                    Loop - Actions
                        Set PoisonCloudTarget = (Random unit from PoisonCloudGroup)
                        Set PoisonCloudEffect[PoisonCloudInnerLoop] = (Create a special effect using Abilities\Spells\Items\AIre\AIreTarget.mdl On PoisonCloudTarget 's origin)
                        Unit Group - Remove PoisonCloudTarget from PoisonCloudGroup
                Wait 1.00 seconds
                For each (Integer PoisonCloudInnerLoop) from 1 to PoisonCloudAmount, do (Actions)
                    Loop - Actions
                        Special Effect - Destroy PoisonCloudEffect[PoisonCloudInnerLoop]
                Unit Group - Destroy unit group PoisonCloudGroup
        Unit - Remove (Entering unit) from the game
        Point - Remove PoisonCloudLoc
 

emjlr3

Change can be a good thing
Reaction score
395
looks ok to me, aside from not destroying your points, and nullifying your unit groups and units and integers
 
S

Scarzzurs

Guest
Can you have wait inside a loop? I don't think it can have, if this is right then that is a bug. Otherwise it seems clean, IF you never run this function twice within the time it works (within the next 1*30 seconds since function start?). If it does i suggest you to come by our irc channel (the one you come by every once in a while) and i will teach you the most secure way i have yet to find :)

- Scarzzurs
 
S

Scarzzurs

Guest
Aight, thanks for telling the ever forgetful me :)

- Scarzzurs
 

Grurf

Ultra Cool Member
Reaction score
30
Well, ok, I will hang around in your channel someday, but I'd actually like to see my problem fixed here, because this will help others that search for this problem, too. Any suggestions? I'm pretty sure this trigger causes the leaking, as all other triggers would only leak a couple of units and a few effects, not enough to make the lag visible, as happens with this spell. After casting it a lot (around 25 times), the camera moves shockily when viewing the place where you casted it (and that on my geforce fx 5600). I tried debugging it by placing text messages all over the trigger reporting values of variables, and all seems clean. The problem is just that this here shouldn't leak, but it does. I think I'll convert it to custom text tomorrow and analyze the JASS, maybe some weird GUI glitch prevents the special effects from being destroyed.
 
S

Scarzzurs

Guest
Grurf, the reason for not posting it here is that it is advanced jass and most people here probably won't understand it anyways. But the real reason is that i like to keep an open dialog while doing this as i find it a bit more complicated then everything else...

But i see your point and i better write a tutorial on it soon, though it is not my invention :p

- Scarzzurs
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
Scarzzurs said:
Grurf, the reason for not posting it here is that it is advanced jass and most people here probably won't understand it anyways.

Ahh. Yes? So becuse 'most' people dont understand you shoould not post a question that it is enought that 1 person understand to get help?

There is a bunch of skilled jass users on this forum, dont ignore that.


@Grurf: Try to remove the effect direct after you have created them with Effect - Destroy Last Created Effect. I dont recognice the effect you have for most effects it is enought just to dipslay the death animation.
 
S

Scarzzurs

Guest
Aight, Phyrexian...
But mind that i said that it was 1 reason out of quite a few...

The offer is still open, and it is open to everyone that might need the help i can do on this topic. I might try to descripe it in this forum later, but right now i don't feel like it. Sorry if i wasted forum space with these posts...

Oh btw. i figgered that not every one know what irc channel i was refering to, so i will link to the post in which i describted it: Here

- Scarzzurs
 

Grurf

Ultra Cool Member
Reaction score
30
I just converted the trigger to JASS, and I can't find anything that would prevent the removing of the special effects... Plz have a look at it and see if you can find the leak:

Code:
function Trig_Poisonous_Cloud_Conditions takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetEnteringUnit()) == 'n01F' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Poisonous_Cloud_Func002Func001002003001001 takes nothing returns boolean
    return ( IsUnitDeadBJ(GetFilterUnit()) == false )
endfunction

function Trig_Poisonous_Cloud_Func002Func001002003001002 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_GROUND) == true )
endfunction

function Trig_Poisonous_Cloud_Func002Func001002003001 takes nothing returns boolean
    return GetBooleanAnd( Trig_Poisonous_Cloud_Func002Func001002003001001(), Trig_Poisonous_Cloud_Func002Func001002003001002() )
endfunction

function Trig_Poisonous_Cloud_Func002Func001002003002 takes nothing returns boolean
    return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_PoisonCloudCaster)) == true )
endfunction

function Trig_Poisonous_Cloud_Func002Func001002003 takes nothing returns boolean
    return GetBooleanAnd( Trig_Poisonous_Cloud_Func002Func001002003001(), Trig_Poisonous_Cloud_Func002Func001002003002() )
endfunction

function Trig_Poisonous_Cloud_Func002Func003A takes nothing returns nothing
    call UnitDamageTargetBJ( GetEnteringUnit(), GetEnumUnit(), ( 20.00 * I2R(GetUnitAbilityLevelSwapped('A04O', udg_PoisonCloudCaster)) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endfunction

function Trig_Poisonous_Cloud_Actions takes nothing returns nothing
    set udg_PoisonCloudLoc = GetUnitLoc(GetEnteringUnit())
    set udg_PoisonCloud = 1
    loop
        exitwhen udg_PoisonCloud > 30
        set udg_PoisonCloudGroup = GetUnitsInRangeOfLocMatching(300.00, udg_PoisonCloudLoc, Condition(function Trig_Poisonous_Cloud_Func002Func001002003))
        set udg_PoisonCloudAmount = CountUnitsInGroup(udg_PoisonCloudGroup)
        call ForGroupBJ( udg_PoisonCloudGroup, function Trig_Poisonous_Cloud_Func002Func003A )
        set udg_PoisonCloudInnerLoop = 1
        loop
            exitwhen udg_PoisonCloudInnerLoop > udg_PoisonCloudAmount
            set udg_PoisonCloudTarget = GroupPickRandomUnit(udg_PoisonCloudGroup)
            set udg_PoisonCloudEffect[udg_PoisonCloudInnerLoop] = AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIre\\AIreTarget.mdl", udg_PoisonCloudTarget, "origin")
            call GroupRemoveUnitSimple( udg_PoisonCloudTarget, udg_PoisonCloudGroup )
            set udg_PoisonCloudInnerLoop = udg_PoisonCloudInnerLoop + 1
        endloop
        call TriggerSleepAction( 1.00 )
        set udg_PoisonCloudInnerLoop = 1
        loop
            exitwhen udg_PoisonCloudInnerLoop > udg_PoisonCloudAmount
            call DestroyEffectBJ( udg_PoisonCloudEffect[udg_PoisonCloudInnerLoop] )
            set udg_PoisonCloudInnerLoop = udg_PoisonCloudInnerLoop + 1
        endloop
        call DestroyGroup( udg_PoisonCloudGroup )
        call DisplayTextToForce( GetPlayersAll(), I2S(udg_PoisonCloudAmount) )
        set udg_PoisonCloud = udg_PoisonCloud + 1
    endloop
    call RemoveUnit( GetEnteringUnit() )
    call RemoveLocation( udg_PoisonCloudLoc )
endfunction

//===========================================================================
function InitTrig_Poisonous_Cloud takes nothing returns nothing
    set gg_trg_Poisonous_Cloud = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_Poisonous_Cloud, GetEntireMapRect() )
    call TriggerAddCondition( gg_trg_Poisonous_Cloud, Condition( function Trig_Poisonous_Cloud_Conditions ) )
    call TriggerAddAction( gg_trg_Poisonous_Cloud, function Trig_Poisonous_Cloud_Actions )
endfunction
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top