Ok, so I have a struct and when I do this:
then the game will crash without showing any debug messages, but if I comment out call sp.destroy(), then it will show the message "destcall" as it should, thus leading me to believe onDestroy is crashing my game. The struct is spcast, and I have no idea why this wont work. I've done this a lot before, and the only real difference now is the use of static variables. Is it possible this is the problem?
Thanks in advance!
JASS:
if (sp.wait < 0.0) then
call BJDebugMsg("destcall")
call sp.destroy()
endif
then the game will crash without showing any debug messages, but if I comment out call sp.destroy(), then it will show the message "destcall" as it should, thus leading me to believe onDestroy is crashing my game. The struct is spcast, and I have no idea why this wont work. I've done this a lot before, and the only real difference now is the use of static variables. Is it possible this is the problem?
JASS:
private method onDestroy takes nothing returns nothing
call BJDebugMsg("destroy")
// remove from the array
set spcast.ActiveCastArray[spcast.Index] = spcast.ActiveCastArray[spcast.ActiveCasters - 1]
set spcast.ActiveCasters = spcast.ActiveCasters - 1
// add caster to idle if it isn't full
if (spcast.IdleCasters < DUMMY_UNIT_INACTIVE_LIMIT) then
// remove the ability first
//call UnitRemoveAbility(.caster, .abilityId)
// now add to the idle
set spcast.IdleCasterArray[spcast.IdleCasters] = .caster
set spcast.IdleCasters = spcast.IdleCasters + 1
call BJDebugMsg("destroySave")
else
//call RemoveUnit(.caster)
call BJDebugMsg("destroyRemove")
endif
// nullify
set .caster = null
set .target = null
set .owner = null
endmethod
Thanks in advance!