The game start killing my casting units

Status
Not open for further replies.
Level 16
Joined
Sep 29, 2008
Messages
367
hi guys.

im currently working on a mass control map. the point is about a MUI ability that´s like knock back, but in this case the caster is moved along 400 front line range. In the casting event, a hidden book spell is added to casting unit with fire phoenix ability. this is the script:

JASS:
function Silverslash_move takes nothing returns nothing
    local timer ti = GetExpiredTimer()
    local unit u = LoadUnitHandleBJ(StringHashBJ("caster"),GetHandleIdBJ(ti), udg_cache)
    local real inc = LoadRealBJ(StringHashBJ("inc"),GetHandleIdBJ(ti), udg_cache)
    local real ang = LoadRealBJ(StringHashBJ("angle"),GetHandleIdBJ(ti), udg_cache)
    local location p = GetUnitLoc(u)
    local location p1 = PolarProjectionBJ(p, inc, ang)
    
    set inc = ( inc - 1 )
    set p = GetUnitLoc(u)
    call SetUnitPathing( u, false )
    call SetUnitPositionLoc( u, p1 )         
    call RemoveLocation(p) 
    call RemoveLocation(p1) 
    call SaveRealBJ(inc, StringHashBJ("inc"), GetHandleIdBJ(ti), udg_cache )

    set u = null
 endfunction

function Trig_silverslashX_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A06H' ) ) then
        return false
    endif
    return true
endfunction

function Trig_silverslashX_Actions takes nothing returns nothing
    local unit u = GetSpellAbilityUnit()
    local real inc = 30.00
    local real ang = GetUnitFacing(u)
    local timer te = CreateTimer()
    local location p = GetUnitLoc(u)
    local location p1 = null
    
    call SaveUnitHandleBJ(u, StringHashBJ("caster"), GetHandleIdBJ(te), udg_cache )
    call SaveRealBJ(inc, StringHashBJ("inc"), GetHandleIdBJ(te), udg_cache )
    call SaveRealBJ(ang, StringHashBJ("angle"), GetHandleIdBJ(te), udg_cache )
    call SaveLocationHandleBJ(p, StringHashBJ("p"), GetHandleIdBJ(te), udg_cache )
   

    call TriggerSleepAction( 0.04 )
    call UnitAddAbilityBJ( 'A06J', u )
    call SetUnitAnimation( u, "Attack" )
    
    call TimerStart(te, 0.02, true, function Silverslash_move)  
   
    call PolledWait(0.4)
 
    call UnitRemoveAbilityBJ( 'A06J', u )
    call SetUnitPathing( u, true )

    call FlushChildHashtableBJ(GetHandleIdBJ(te), udg_cache)
    call DestroyTimer(te)
    set u = null
    set inc = 0
    set ang = 0
    call RemoveLocation(p)
    call RemoveLocation(p1)
  
endfunction

//===========================================================================
function InitTrig_silverslashX takes nothing returns nothing
    set gg_trg_silverslashX = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_silverslashX, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_silverslashX, Condition( function Trig_silverslashX_Conditions ) )
    call TriggerAddAction( gg_trg_silverslashX, function Trig_silverslashX_Actions )
endfunction

this work perfectly the first 15 mins of game, But after, the game start killing random casters of the ability. i think, this leak in some point, but i cannot detect where. when the second timer is removed, this ability doesnot work.

any help is welcome.
 
Status
Not open for further replies.
Back
Top