Leak? Help

V

Voodoo

Guest
My code:

JASS:
function Trig_Ice_Explosion_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00S'
endfunction

function Trig_Ice_Explosion_Actions takes nothing returns nothing
local unit icecaster
local unit icetarget
local location icecasterpoint
local location icetargetpoint
local group icegroup
    set icecaster = GetTriggerUnit()
    set icetargetpoint = GetSpellTargetLoc()
    set icecasterpoint = GetUnitLoc(icecaster)
    set icegroup = GetUnitsInRangeOfLocAll(( 100.00 + ( 200.00 * I2R(GetUnitAbilityLevelSwapped('A00S', icecaster)) ) ), icetargetpoint)
    loop
        exitwhen icegroup == null
        set icetarget = FirstOfGroup(icegroup)
        if IsUnitEnemy(icetarget, GetOwningPlayer(icecaster))==true then
        call GroupRemoveUnit(icegroup,icetarget)
        call CreateNUnitsAtLoc( 1, 'h008', GetOwningPlayer(icecaster), icecasterpoint, bj_UNIT_FACING )
        call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
        call SetUnitPathing( GetLastCreatedUnit(), false )
        call UnitAddAbilityBJ( 'A00R', GetLastCreatedUnit() )
        call SetUnitAbilityLevelSwapped( 'A00R', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A00S', icecaster) )
        call IssueTargetOrderBJ( GetLastCreatedUnit(), "chainlightning", icetarget )
        set icetarget = null
        else
        call GroupRemoveUnit(icegroup,icetarget)
        set icetarget = null
        endif  
    endloop
    set icegroup = null
    set icecaster = null
    set icetargetpoint = null
    set icecasterpoint = null
endfunction

//===========================================================================
function InitTrig_Ice_Explosion takes nothing returns nothing
    set gg_trg_Ice_Explosion = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Ice_Explosion, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Ice_Explosion, Condition( function Trig_Ice_Explosion_Conditions ) )
    call TriggerAddAction( gg_trg_Ice_Explosion, function Trig_Ice_Explosion_Actions )
endfunction


The Ability :

Ice Explosion

summons numerous ice explosion to destroy enemies. Each explosion deals 100/200/300 damage, (Imagine a Chain Lightning, being cast several times, bouncing from one unit to another, the missle is deleted, only the frost nova effect is added)

My Problem :

When I cast the ability(everytime) I hang (sever lag)....after 2 sec, it come back to normal, but the events are forwarded. The damage takes place, ALL takes place. But I just hate what is that Lag every time i cast the spell

Note : I preloaded ALL units, and abilities.

Plss help
 

gref

New Member
Reaction score
33
The locations and groups leak.

You have to call DestroyGroup and RemoveLocation just above where you null them.

That won't be the lag though. Try preloading.
 

chobibo

Level 1 Crypt Lord
Reaction score
48
Use natives instead of those BJ functions that just calls native functions.
 

Tom Jones

N/A
Reaction score
437
Endlees loop, icegroup will never be null. Change it to:
JASS:
        set icetarget = FirstOfGroup(icegroup)
        exitwhen icetarget == null
And you should remove those set icetarget = null if you want the loop to run more than once. Also you should remove the leaks as described in the above posts.
 
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