HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Something Wrong With Trigger

02-10-2007, 11:42 PM#1
ClichesAreSt00pid
In my new map I got this ability called Fire Mission which directs artillery to fire at the target and stuff. At the loop it only does the actions once, and in those actions the "call unitdamagepoint" action isn't working.
Here it is:
Collapse JASS:
function Trig_Fire_Mission_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A00A' ) ) then
        return false
    endif
    if ( not ( udg_FO_ShellsRemaining >= udg_FO_Shells ) ) then
        return false
    endif
    return true
endfunction

function Trig_Fire_Mission_Actions takes nothing returns nothing
    local effect e
    local location l1
    local location l2
    local unit u
    local integer i1
    local integer i2
    local integer i3
    call PingMinimapLocForForceEx( GetPlayersAll(), GetSpellTargetLoc(), 5.00, bj_MINIMAPPINGSTYLE_SIMPLE, 50.00, 100, 50.00 )
    set udg_FO_ShellsRemaining = ( udg_FO_ShellsRemaining - udg_FO_Shells )
    call DisplayTimedTextToForce( GetForceOfPlayer(GetTriggerPlayer()), 5.00, ( "Shells Remaining: " + I2S(udg_FO_ShellsRemaining) ) )
    call AddSpecialEffectLocBJ( GetSpellTargetLoc(), "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareTarget.mdl" )
    set e=GetLastCreatedEffectBJ()
    set l1=((GetSpellTargetLoc()))
    set i1 = 1
    set i2 = udg_FO_Shells
    set i3 = udg_FO_Radius
    call TriggerSleepAction( 11.00 )
    call DestroyEffect(e)
    loop
        exitwhen i1 > i2
        set l2=(PolarProjectionBJ(((l1)), GetRandomReal(0.00,I2R(i3)), GetRandomDirectionDeg()))
        call AddSpecialEffectLocBJ((l2), "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl" )
        call UnitDamagePoint( (u), 0, 250.00, GetLocationX(l2), GetLocationY(l2), ( 100.00 * I2R(GetUnitAbilityLevelSwapped('A00A', (u))) ), true, false, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
        set i1 = i1 + 1
    endloop
    set l1=null
    set l2=null
    set e=null
    set u=null
endfunction

//===========================================================================
function InitTrig_Fire_Mission takes nothing returns nothing
    set gg_trg_Fire_Mission = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Fire_Mission, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Fire_Mission, Condition( function Trig_Fire_Mission_Conditions ) )
    call TriggerAddAction( gg_trg_Fire_Mission, function Trig_Fire_Mission_Actions )
endfunction

RSVP!
02-11-2007, 01:41 AM#2
Vexorian
You are never assigning u.

Try getting rid of blizzadj functions that aren't being useful, You are also leaking a location (GetSpellTargetLoc()) and many effects/locations in the loop
02-11-2007, 02:20 AM#3
ClichesAreSt00pid
Lol i'm a tard. Thanks Geniousorian (sounds like a dinosaur...).