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.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top