HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

2 triggers giving me issues

09-25-2006, 10:40 PM#1
darkwulfv
This one makes the flames correctly but doesn't remove them.
Collapse JASS:
function Trig_Flame_Stomp_Conditions takes nothing returns boolean
    if ( GetSpellAbilityId() == 'A004' ) then
    endif
    return true
endfunction

function Trig_Flame_Stomp_Actions takes nothing returns nothing
  local location l = GetUnitLoc(GetTriggerUnit())
  local location offset = OffsetLocation(l,0,0)
  local effect array SFX
  local integer i = 0
  local integer in = 1
  set offset = OffsetLocation(l,100,0)
    call AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", offset)
  set SFX[1] = GetLastCreatedEffectBJ()
  set offset = OffsetLocation(l,100,100)
    call AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", offset) 
  set SFX[2] = GetLastCreatedEffectBJ()
  set offset = OffsetLocation(l,0,100)
    call AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", offset) 
  set SFX[3] = GetLastCreatedEffectBJ()
  set offset = OffsetLocation(l,-100,100)
    call AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", offset) 
  set SFX[4] = GetLastCreatedEffectBJ()
  set offset = OffsetLocation(l,-100,0)
    call AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", offset) 
  set SFX[5] = GetLastCreatedEffectBJ()
  set offset = OffsetLocation(l,-100,-100)
    call AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", offset) 
  set SFX[6] = GetLastCreatedEffectBJ()
  set offset = OffsetLocation(l,0,-100)
    call AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", offset) 
  set SFX[7] = GetLastCreatedEffectBJ()
  set offset = OffsetLocation(l,100,-100)
    call AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", offset) 
  set SFX[8] = GetLastCreatedEffectBJ()
  call PolledWait( .50 )
   loop
   exitwhen i==8
     call DestroyEffect(SFX[in])
     set i=i+1
     set in=in+1
   endloop
   call RemoveLocation(offset)
   call RemoveLocation(l)
   set in = 0
   set i = 0
   set l = null
   set offset = null
endfunction

//===========================================================================
function InitTrig_Flame_Stomp takes nothing returns nothing
    set gg_trg_Flame_Stomp = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Flame_Stomp, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Flame_Stomp, Condition( function Trig_Flame_Stomp_Conditions ) )
    call TriggerAddAction( gg_trg_Flame_Stomp, function Trig_Flame_Stomp_Actions )
endfunction

And as far as i can see, this one doesn't work at all.

Collapse JASS:
function Trig_Flame_Stomp_Damage_Conditions takes nothing returns boolean
    if ( GetSpellAbilityId() == 'A004' ) then
    endif
    return true
endfunction

function Buff_Check takes nothing returns boolean
    return ( UnitHasBuffBJ(GetFilterUnit(), 'B001') == true )
endfunction

function Damage takes nothing returns nothing
  local integer i = GetUnitAbilityLevel(GetTriggerUnit(), 'A004')
  local real r = i
    call UnitDamageTargetBJ( GetTriggerUnit(), GetEnumUnit(), ( 2.00 + ( r * 2 ) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNKNOWN )
endfunction

And from what I can see, this one doesn't work at all.
function Trig_Flame_Stomp_Damage_Actions takes nothing returns nothing
  local unit u = GetTriggerUnit()
  local group g = GetUnitsInRangeOfLocMatching(500.00, GetUnitLoc(u), Condition(function Buff_Check))
  local timer t 
    call TimerStart( t, 5.00, false, null )
   loop
   exitwhen TimerGetRemaining(t) == 0  
     call ForGroupBJ( g, function Damage )
     call PolledWait( 1.00 )
   endloop
  call RemoveLocation(GetUnitLoc(u))
  set u = null
  set g = null
  set t = null
endfunction

//===========================================================================
function InitTrig_Flame_Stomp_Damage takes nothing returns nothing
    set gg_trg_Flame_Stomp_Damage = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Flame_Stomp_Damage, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Flame_Stomp_Damage, Condition( function Trig_Flame_Stomp_Damage_Conditions ) )
    call TriggerAddAction( gg_trg_Flame_Stomp_Damage, function Trig_Flame_Stomp_Damage_Actions )
endfunction

Any help is greatly appreiciated. I can't see whats wrong with these...
09-25-2006, 11:01 PM#2
aquilla
Collapse JASS:
    call AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", offset) 
  set SFX[2] = GetLastCreatedEffectBJ()
->
Collapse JASS:
  set SFX[2] = AddSpecialEffectLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", offset)

and for the second one, t is null :P
Collapse JASS:
local timer t = CreateTimer()
09-25-2006, 11:33 PM#3
UnMi
That's not the problem.
You
Collapse JASS:
loop
   exitwhen i==8
     call DestroyEffect(SFX[in])
     set i=i+1
     set in=in+1
   endloop
Wtf? Replace the
Collapse JASS:
call DestroyEffect(SFX[in])
with
Collapse JASS:
call DestroyEffect(SFX[i])
and remove the variable "in" completely.
And btw, you are leaking a location each time you
Collapse JASS:
set offset = OffsetLocation(l,100,-100)
Remove that location each time you add the special effect.