HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger cuasing map to crash!

03-08-2007, 09:59 AM#1
The__Prophet
I have absolutly no clue why this trigger keeps on cuasing my map to crash. Maby someone on here can see somthing I can't see. The problem has to lie in this trigger, becuase the game never seems to crash when a hero dies, and a respawn trigger is the only one going off in my test map besides this trigger. Ideas?

Edit: Hmmmmm.... Seems as if I somehow fixed the crash without realizing quite how. I don't understand. Oh well, maby a little bit of sleep and a fresh look at this in the morning will help.

Collapse JASS:
function Assist_System_Condition takes nothing returns boolean
    return not GetAttachedBoolean(GetTriggerUnit(), GetPlayerName(GetOwningPlayer(GetEventDamageSource())))
endfunction

function Assist_System_Hero_Check takes nothing returns boolean
    return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO)
endfunction

function Trig_Assist_System_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit d = GetEventDamageSource()
    local string p_d = GetPlayerName(GetOwningPlayer(d))
    call AttachBoolean(u, p_d, true)
    call TriggerSleepAction(15)
    call AttachBoolean(u, p_d, false)
    set p_d = null    
    set u = null
    set d = null
endfunction

//===========================================================================
function InitTrig_Assist_System takes nothing returns nothing
    local group g = CreateGroup()
    local group g2 = CreateGroup()
    local unit u  
    set gg_trg_Assist_System = CreateTrigger(  )
    call GroupEnumUnitsInRect(g, gg_rct_Start, Condition(function Assist_System_Hero_Check))
    call GroupEnumUnitsInRect(g2, gg_rct_Start_2, Condition(function Assist_System_Hero_Check))
    call GroupAddGroup(g2, g)
    set u = FirstOfGroup(g)
    loop
        exitwhen u == null
        set u = FirstOfGroup(g)
        call GroupRemoveUnit(g, u)
        call TriggerRegisterUnitEvent( gg_trg_Assist_System, u, EVENT_UNIT_DAMAGED )
    endloop
    call TriggerAddAction( gg_trg_Assist_System, function Trig_Assist_System_Actions )
    call TriggerAddCondition(gg_trg_Assist_System, Condition(function Assist_System_Condition))
    call DestroyGroup(g)
    call DestroyGroup(g2)
    set g2= null
    set g = null
    set u = null
endfunction
03-09-2007, 07:40 AM#2
PitzerMike
Use Grimoire's error logging in case it happens again.