HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Goofy Spell Problem

05-16-2006, 09:40 PM#1
emjlr3
Collapse JASS:
function Trig_Submerge_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A03V' 
endfunction

function Trig_Submerge_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit array dum
    local location l = GetSpellTargetLoc()
    local integer i = 1
    local integer j = 1
    local integer lvl = GetUnitAbilityLevel(u,'A03V')
    local real x = GetLocationX(l)
    local real y = GetLocationY(l)    
    local real xfall
    local real yfall
    local real ang = 0  
    local real faceang
    local real dist = 350+(lvl*50)  
    local player p = GetOwningPlayer(u)
    
    call TerrainDeformationCraterBJ( 3.00, true, l, 400.00, 400.00 )
    call TriggerSleepAction( 0.30 )
    set bj_lastCreatedUnit = CreateUnit(p,'n01B',x,y,0)
    call UnitApplyTimedLife(bj_lastCreatedUnit,'BTLF',5.)
    call SetUnitAbilityLevel(bj_lastCreatedUnit,'A03W',lvl)
    loop
        exitwhen i > 25
        set xfall = x + dist * Cos(ang * bj_DEGTORAD)
        set yfall = y + dist * Sin(ang * bj_DEGTORAD)
        set faceang = AngleBetweenPointsXY(xfall,yfall,x,y)
        set dum[i] = CreateUnit(p,'h003',xfall,yfall,faceang)        
        set i = i + 1
        set ang = ang + 15
    endloop
    set i = 1
    loop
        exitwhen i>5
        call DamageEnemiesArea(u,dist,x,y,lvl*75,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
        set j = 1
        loop
            exitwhen j>GetRandomInt(5,8)
            set xfall = x + GetRandomReal(0,dist) * Cos(GetRandomReal(0,360) * bj_DEGTORAD)
            set yfall = y + GetRandomReal(0,dist) * Sin(GetRandomReal(0,360) * bj_DEGTORAD)
            call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl",xfall,yfall))
            set j = j + 1
        endloop
        set i = i + 1        
        call TriggerSleepAction(1.)
    endloop    
    call TerrainDeformationCraterBJ( 0.5, true, l, 400.00, -400.00 )
    set i = 1
    loop
        exitwhen i > 25        
        call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\DeathPact\\DeathPactTarget.mdl",GetUnitX(dum[i]),GetUnitY(dum[i])))
        call RemoveUnit(dum[i])
        set dum[i] = null
        set i = i + 1
    endloop    
    
    set u = null
    call RemoveLocation(l)
    set l = null
    set p = null
endfunction

//===========================================================================
function InitTrig_Submerge takes nothing returns nothing
    set gg_trg_Submerge = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Submerge, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Submerge, Condition( function Trig_Submerge_Conditions ) )
    call TriggerAddAction( gg_trg_Submerge, function Trig_Submerge_Actions )
endfunction

use around no enemy creeps, always works fine, use it around certain low lvl creep camps, works fine, use it near certain high level creep camps, WC3 gets a fetal error...what gives?

(basically it creates waterfalls around in a circle, a terrain deform, damages units in the area, creates some effects, then removes teh waterfalls and terrain deform)

not entirely positive, but I think the error started happeining when I added in a dummy units with -value endurance aura to slow enemies in the area

Collapse JASS:
set bj_lastCreatedUnit = CreateUnit(p,'n01B',x,y,0)
    call UnitApplyTimedLife(bj_lastCreatedUnit,'BTLF',5.)
    call SetUnitAbilityLevel(bj_lastCreatedUnit,'A03W',lvl)