HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

huge problems with laggs and leaks with JASS Spells

09-01-2007, 12:13 PM#1
Just_a°fOol
hi
I tried to copy two Diablo spells
Immolation and Lightning
I wanted them to be nearly like the ones in Diablo

but in my testmap, the spells seem to leak a lot and Immolation even laggs
but I can't figure out why...

here is the test map I made
if you want, I can also just post the triggers

thanks for help
Wish
Attached Files
File type: w3xLightning.w3x (35.6 KB)
09-01-2007, 01:20 PM#2
Vexorian
At least I found a bug:

Collapse JASS:
function Lightning_AddEffectWithTimer takes real x, real y returns nothing
    local effect e = AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",x,y)
    call PolledWait(3.00)
    call DestroyEffect(e)
    set e = null
endfunction

looks ok? But it is called from a timer expiration function, they can't have waits. Then the thread crashes, and it happens before removing the location.

Besides, a 0.03 timer is way too small for a gamecache intensive spell.

Edit:
Collapse JASS:
function Immolation_MoveDummy takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local string mk = I2S(H2I(t))
    local unit caster = I2U(GetStoredInteger(udg_GC,mk,"caster"))
    local unit dummy = I2U(GetStoredInteger(udg_GC,mk,"dummy"))
    local real v = GetStoredReal(udg_GC,mk,"velocity")
    local real dmg = GetStoredReal(udg_GC,mk,"damage")
    local real x = GetStoredReal(udg_GC,mk,"x")
    local real y = GetStoredReal(udg_GC,mk,"y")
    local group g = CreateGroup()
    local unit target
    local unit f
    local location l = Location(x,y)

    set udg_FilterUnit = caster
    call GroupEnumUnitsInRange(g,x,y,50.00,Condition(function Immolation_GroupFilter))
    set udg_FilterUnit = null
    
    if CountUnitsInGroup(g) > 0 then
        loop
            set f = FirstOfGroup(g)
            exitwhen f == null
            call UnitDamageTargetBJ(caster,f,dmg,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC)
            call RemoveUnit(f)
            if IsUnitAliveBJ(dummy) then
                call KillUnit(dummy)
                call DestroyEffect(AddSpecialEffectLocBJ( l, "Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl" ))
            endif
        endloop
        call PauseTimer(t)
        call DestroyTimer(t)
        set t = null
        call FlushStoredMission(udg_GC,mk)
        set dummy = null
        set caster = null
    else
        set l = PolarProjectionBJ(l,v,GetUnitFacing(dummy))
        set x = GetLocationX(l)
        set y = GetLocationY(l)
        call SetUnitXY(dummy,x,y)
        call StoreReal(udg_GC,mk,"x",x)
        call StoreReal(udg_GC,mk,"y",y)
        call StoreInteger(udg_GC,mk,"dummy",H2I(dummy))
    endif
    
    call RemoveLocation(l)
    set l = null
    call DestroyGroup(g)
    set mk = null
    set t = null
    set g = null
    set target = null    
endfunction

Sometimes the location in red is not removed because the line highlighted in yellow overrides it.
09-01-2007, 05:47 PM#3
Just_a°fOol
ok this already is good
I used a second location now to remove the leak you marked yellow

the thing with the effects....well I try to do something there

which timeout would be perfect for such a spell instead of 0.03 ?