Does this spell leak?

WarLuvr3393

Hmmm...too many things to play (WoW, COD4, WC3)
Reaction score
54
JASS:
function FB_Spell_Check takes nothing returns boolean
  return GetSpellAbilityId() == 'A005'
endfunction

function FB_Spell_Effect takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit dummy
local location l  = GetUnitLoc(caster)
local player p    = GetOwningPlayer(caster)
local integer ds  = 'A006'
local integer i   = 0
local real ang    = 0
local location pj = PolarProjectionBJ(l, 100, ang)
  
  loop
    exitwhen i > 3
    set dummy = CreateUnitAtLoc(p, 'h00B', l, 0)
    call UnitAddAbility(dummy, ds)
    call IssuePointOrderLoc(dummy, "breathoffire", pj)
    set ang = ang + 90
    set pj = PolarProjectionBJ(l, 100, ang)
    set i = i + 1
  endloop
  
call RemoveLocation(l)
call RemoveLocation(pj)
set l      = null
set pj     = null
set caster = null
set dummy  = null  
endfunction

//===========================================================================
function InitTrig_Fire_Blast takes nothing returns nothing
local trigger t = CreateTrigger()
  call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
  call TriggerAddCondition( t, Condition( function FB_Spell_Check ) )
  call TriggerAddAction( t, function FB_Spell_Effect )
endfunction


Yes/no?
 

Kenny

Back for now.
Reaction score
202
Im pretty sure that doesn't leak. However you should get use to using reals instead of locations. It makes leak-proofing much easier, as they dont need to be nulled or removed.

Instead of:

JASS:
local location l = GetUnitLoc(caster)


You can use:

JASS:
local real castx = GetUnitX(caster)
local real casty = GetUnitY(caster)


However it gets more difficult for polar projections.
 

Artificial

Without Intelligence
Reaction score
326
You might want to add an expiration timer or something for the dummies, as they aren't being removed at the moment.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top