HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Dang trigger giving me memory errors, help please!

03-30-2004, 11:36 PM#1
Narwanza
This trigger crashes when the spell is used. I really need to figure out why because I am releasing a new beta version of my map this weekend and I have almost no time to get it put together, which means I have no time to work on this dang spell. It is so strange because it was working, and then it all the sudden decided to stop working. I updated my GameCache API that I use in the map (instead of globals), and I think that is what made it get screwed up. I will post both. Please help me!
Code:
function Animation_Actions takes nothing returns nothing
    local string subcat = GetStringSimple(I2S(HandleToInt(GetExpiredTimer())),"subcat")
    local real counter = (GetRealSimple(subcat,"counter") + 1)
    local real offset = (100 * counter)
    local location castpoint = H2L(GetHandleSimple(subcat,"castpoint"))
    local location point = PolarProjectionBJ(castpoint, offset, GetRealSimple(subcat,"Angle"))
    call StoreRealSimple(counter,subcat,"counter")
    if (counter <= 11) then
        call AddSpecialEffectLocBJ( point, "Objects\\Spawnmodels\\Bomb\\BombBlast.mdx" )
        call StartTimerBJ(H2T(GetHandleSimple(subcat,"timer")),false,0.15)
    else
        call FlushSubCategory(subcat)
        call DestroyTrigger(GetTriggeringTrigger())
        call DestroyTimer(GetExpiredTimer())
        call RemoveLocation(castpoint)
    endif
    if (counter == 1) then
        call FlushHandleReal(GetHandleSimple(subcat,"caster"),"isCasting")
    endif
    set castpoint = null
    call RemoveLocation(point)
    set point = null
endfunction

function Trig_Exploding_Wake_Conditions takes nothing returns boolean
    if ( GetSpellAbilityId() != 'AOsh' ) then
        return false
    endif
    if (HaveStoredReal(LocalVars(),I2S(HandleToInt(GetSpellAbilityUnit())),"isCasting")) then
        return false
    endif
    return true
endfunction

function Trig_Exploding_Wake_Actions takes nothing returns nothing
    local location loc1 = GetSpellTargetLoc()
    local trigger AnimT = CreateTrigger()
    local timer Animt = CreateTimer()
    local location castpoint = GetUnitLoc(GetSpellAbilityUnit())
    local real Angle = AngleBetweenPoints(castpoint,loc1)
    local string subcat = I2S(HandleToInt(Animt))
    call StoreStringSimple(subcat,"subcat",subcat)
    call StoreHandleReal(GetSpellAbilityUnit(),"isCasting",1)
    call StoreHandleSimple(GetSpellAbilityUnit(),subcat,"caster")
    call StoreRealSimple(100,subcat,"offset")
    call StoreRealSimple(0,subcat,"counter")
    call StoreHandleSimple(Animt,subcat,"timer")
    call TriggerRegisterTimerExpireEvent(AnimT,Animt)
    call TriggerAddAction(AnimT,function Animation_Actions)
    call StartTimerBJ(Animt,false,0)
    call StoreRealSimple(Angle,subcat,"Angle")
    call StoreHandleSimple(castpoint,subcat,"castpoint")
    call RemoveLocation(loc1)
    set loc1 = null
    set castpoint = null
    set Animt = null
    set AnimT = null
endfunction

//===========================================================================
function InitTrig_Exploding_Wake takes nothing returns nothing
    set gg_trg_Exploding_Wake = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Exploding_Wake, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Exploding_Wake, Condition( function Trig_Exploding_Wake_Conditions ) )
    call TriggerAddAction( gg_trg_Exploding_Wake, function Trig_Exploding_Wake_Actions )
endfunction
And now for the GameCacheAPI
Code:
function LocalVars takes nothing returns gamecache
	return InitGameCache("jasslocalvars.w3v")
endfunction
//===========================================================================
function H2D takes handle h returns dialog
	return h
	return null
endfunction
//===========================================================================
function H2U takes handle h returns unit
    return h
    return null
endfunction
//===========================================================================
function H2T takes handle h returns timer
    return h
    return null
endfunction
//===========================================================================
function H2L takes handle h returns location
    return h
    return null
endfunction
//===========================================================================
function HandleToInt takes handle h returns integer
    return h
    return 0
endfunction
//===========================================================================
function IntToHandle takes integer i returns handle
    return i
    return null
endfunction
//===========================================================================
function FlushHandleHandle takes handle subject, string name returns nothing
    call FlushStoredInteger(LocalVars(), I2S(HandleToInt(subject)), name)
endfunction
//===========================================================================
function FlushHandleReal takes handle subject, string name returns nothing
    call FlushStoredReal(LocalVars(), I2S(HandleToInt(subject)), name)
endfunction
//===========================================================================
function FlushHandleInt takes handle subject, string name returns nothing
    call FlushStoredInteger(LocalVars(), I2S(HandleToInt(subject)), name)
endfunction
//===========================================================================
function StoreHandleHandle takes handle subject, string name, handle value returns nothing
    call StoreInteger(LocalVars(), I2S(HandleToInt(subject)), name, HandleToInt(value))
endfunction
//===========================================================================
function StoreHandleInt takes handle subject, string name, integer value returns nothing
    call StoreInteger(LocalVars(), I2S(HandleToInt(subject)), name, value)
endfunction
//===========================================================================
function StoreHandleReal takes handle subject, string name, real value returns nothing
    call StoreReal(LocalVars(), I2S(HandleToInt(subject)), name, value)
endfunction
//===========================================================================
function GetHandleHandle takes handle subject, string name returns handle
    return IntToHandle(GetStoredInteger(LocalVars(), I2S(HandleToInt(subject)), name))
endfunction
//===========================================================================
function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(LocalVars(), I2S(HandleToInt(subject)), name)
endfunction
//===========================================================================
function GetHandleReal takes handle subject, string name returns real
    return GetStoredReal(LocalVars(), I2S(HandleToInt(subject)), name)
endfunction
//===========================================================================
function StoreRealSimple takes real value, string subcat, string name returns nothing
     call StoreReal(LocalVars(), subcat, name, value)
endfunction
//===========================================================================
function GetRealSimple takes string subcat, string name returns real
    return GetStoredReal(LocalVars(), subcat, name)
endfunction
//===========================================================================
function StoreHandleSimple takes handle h, string subcat, string name returns nothing
    call StoreInteger(LocalVars(), subcat, name, HandleToInt(h))
endfunction
//===========================================================================
function GetHandleSimple takes string subcat, string name returns handle
    return IntToHandle(GetStoredInteger(LocalVars(), subcat, name))
endfunction
//===========================================================================
function StoreIntegerSimple takes integer i, string subcat, string name returns nothing
    call StoreInteger(LocalVars(), subcat, name, i)
endfunction
//===========================================================================
function GetIntegerSimple takes string subcat, string name returns integer
    return GetStoredInteger(LocalVars(), subcat, name)
endfunction
//===========================================================================
function FlushSubCategory takes string subcat returns nothing
    call FlushStoredMission(LocalVars(),subcat)
endfunction
//===========================================================================
function StoreStringSimple takes string value, string subcat, string name returns nothing
    call StoreString(LocalVars(),subcat,name,value)
endfunction
//===========================================================================
function GetStringSimple takes string subcat, string name returns string
    return GetStoredString(LocalVars(),subcat,name)
endfunction

I will give a brief description of the spell. It creates my own bombblast.mdx model (.mdl edited) in a line of 10. Each effect is separated by 100 units of distance and .15 seconds. Help me please.

oh, and just to give details about the error, it crashes warcraft with the memory referenced at such a point and that it could not be 'read'.