HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Code stops halfway through

06-30-2006, 01:35 PM#1
Jazradel
The piece of code attached appears to stop at the point I indicate. Any suggestions?
Collapse JASS:
function DummyId takes nothing returns integer
    return 'h001'
endfunction

//Faerie Screech

function FSId takes nothing returns integer
    return 'A001'
endfunction

function FSTempId takes nothing returns integer
    return 'B000'
endfunction

function FSEffectId takes nothing returns integer
    return 'A003'
endfunction
Collapse JASS:
function Trig_Faerie_Screech_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == FSId()
endfunction

function Trig_Faerie_Screech_Loop takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer i = GetCacheInt(t, "i")
    local unit u = GetCacheUnit(t, "u")
    local group g = GetCacheGroup(t, "g")
    local unit d
    local unit c
    loop
        set d = FirstOfGroup(g)
        exitwhen d == null
        set c = CreateUnit( GetOwningPlayer(u), DummyId(), GetUnitX(d), GetUnitY(d), 0)
        call UnitAddAbility(c, FSEffectId())
        call IssueTargetOrder(c, "soulburn", d)
        call UnitApplyTimedLife( c, 'BTLF', 1 )
        call GroupRemoveUnit(g, d)
    endloop
    if i + 2 > GetUnitAbilityLevel(u, FSId()) then
        call FlushCache(t)
        call DestroyTimer(t)
        set t = null
        call DestroyGroup(g)
    else
        call SetCacheInt(t, "i", i + 1)
    endif
    set g = null
    set u = null
    set d = null
    set c = null
endfunction

function Trig_Faerie_Screech_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local group g =  GetUnitsInRectMatching(GetPlayableMapRect(), null)
    local group e
    local unit d
    local unit c
    call PolledWait(0.3)
    loop
        set d = FirstOfGroup(g)
        exitwhen d == null
        if GetUnitAbilityLevel(d, FSTempId()) > 0 then
            set c = CreateUnit( GetOwningPlayer(GetTriggerUnit()), DummyId(), GetUnitX(d), GetUnitY(d), 0)
            call UnitAddAbility(c, FSEffectId())
            call IssueTargetOrder(c, "soulburn", d)
            call UnitApplyTimedLife( c, 'BTLF', 1 )
            call UnitRemoveAbility(d, FSTempId())
            call GroupAddUnit(e, d)
        endif
        call GroupRemoveUnit(g, d)
    endloop
//==============Appears to stop here==============
    call SetCacheHandle(t,"u",GetTriggerUnit())
    call SetCacheHandle(t,"g",e)
    call SetCacheInt(t,"i",0)
    call TimerStart(t, 2.5, true, function Trig_Faerie_Screech_Loop)
    call DestroyGroup(g)
    set g = null
    set e = null
    set d = null
    set c = null
endfunction

//===========================================================================
function InitTrig_Faerie_Screech takes nothing returns nothing
    set gg_trg_Faerie_Screech = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Faerie_Screech, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Faerie_Screech, Condition( function Trig_Faerie_Screech_Conditions ) )
    call TriggerAddAction( gg_trg_Faerie_Screech, function Trig_Faerie_Screech_Actions )
endfunction
06-30-2006, 02:02 PM#2
Rising_Dusk
Collapse JASS:
local group e = CreateGroup()

For forgot to create the group e in function Trig_Faerie_Screech_Actions.