HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Spell Leaks

03-07-2007, 09:22 PM#1
ClichesAreSt00pid
For some reason whenever I have a dummy unit cast a spell based off of thunder clap the game lags for 1/2 a second, and I was told it's from spell leaks. How do I fix this?
03-07-2007, 10:05 PM#2
Vexorian
This really goes to triggers. /moved

Just post the trigger of the dummy spell?
03-07-2007, 10:12 PM#3
ClichesAreSt00pid
I've actually got a few >.>. It also happens when a normal unit casts an ability based off of thunder clap.

Trigger:
Paralysis Trap Death
Collapse Events
Unit - A unit Dies
Collapse Conditions
(Unit-type of (Dying unit)) Equal to Paralysis Trap
Collapse Actions
Animation - Play (Dying unit)'s death alternate animation
Unit - Create 1 Dummy for (Owner of (Dying unit)) at (Position of (Dying unit)) facing Default building facing (270.0) degrees
Unit - Add Dummy Paralysis Trap Effect to (Last created unit)
Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
Unit - Add a 5.00 second Generic expiration timer to (Last created unit)

Collapse JASS:
function Trig_Illumination_Rounds_Conditions takes nothing returns boolean
    return GetSpellAbilityId()=='A018' and udg_FO_ShellsRemaining>=udg_FO_Shells
endfunction

function Trig_Illumination_Rounds_Actions takes nothing returns nothing
    local location l1
    local location l2
    local unit u
    local integer i1
    local integer i2
    local integer i3
    local effect e1
    set l1=((GetSpellTargetLoc()))
    call PingMinimapLocForForceEx( GetPlayersAll(), (l1), 5.00, bj_MINIMAPPINGSTYLE_SIMPLE, 100.00, 50, 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 e1=GetLastCreatedEffectBJ()
    set u=GetSpellAbilityUnit()
    set i1 = 1
    set i2 = udg_FO_Shells
    set i3 = udg_FO_Radius
    call PolledWait( ( 10.00 - I2R(GetUnitAbilityLevelSwapped('A011', (u))) ) )
    call DestroyEffect(e1)
    loop
        exitwhen i1 > i2
        set l2=(PolarProjectionBJ((l1), GetRandomReal(0.00,I2R(i3)), GetRandomDirectionDeg()))
        call CreateNUnitsAtLoc( 1, 'h003', GetOwningPlayer(GetTriggerUnit()), (l2), bj_UNIT_FACING )
        call UnitAddAbilityBJ( 'A00P', GetLastCreatedUnit() )
        call SetUnitAbilityLevelSwapped( 'A00P', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A018', GetTriggerUnit()) )
        call UnitApplyTimedLifeBJ( 5.00, 'BTLF', GetLastCreatedUnit() )
        call IssuePointOrderLocBJ( GetLastCreatedUnit(), "farsight", (l2) )
        call CreateNUnitsAtLoc( 1, 'h003', GetOwningPlayer(GetTriggerUnit()), (l2), bj_UNIT_FACING )
        call UnitAddAbilityBJ( 'A01A', GetLastCreatedUnit() )
        call SetUnitAbilityLevelSwapped( 'A01A', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A018', GetTriggerUnit()) )
        call UnitApplyTimedLifeBJ( 5.00, 'BTLF', GetLastCreatedUnit() )
        call IssueImmediateOrderBJ( GetLastCreatedUnit(), "thunderclap" )
        call PolledWait( GetRandomReal(1.2, 2.85) )
        set i1 = i1 + 1
    endloop
    call RemoveLocation(l1)
    set l1=null
    set l2=null
    set e1=null
    set u=null
endfunction

//===========================================================================
function InitTrig_Illumination_Rounds takes nothing returns nothing
    set gg_trg_Illumination_Rounds = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Illumination_Rounds, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Illumination_Rounds, Condition( function Trig_Illumination_Rounds_Conditions ) )
    call TriggerAddAction( gg_trg_Illumination_Rounds, function Trig_Illumination_Rounds_Actions )
endfunction


Collapse JASS:
function Trig_Plasma_Rocket_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A01G' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Plasma_Rocket_Actions takes nothing returns nothing
    local location l=OffsetLocation(GetSpellTargetLoc(), GetRandomReal(-50.00, 50.00), GetRandomReal(-50.00, 50.00))
    local unit u=GetSpellAbilityUnit()
    call CreateTextTagUnitBJ( ( ( "|cffFF0000" + GetUnitName((u)) ) + ": FIRE IN THE HOLE!" ), (u), 25.00, 8.00, 50.00, 100, 50.00, 10.00 )
    call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 3.00 )
    call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
    call PlaySoundOnUnitBJ( gg_snd_RadioFeedback_3D, 100, (u) )
    call CreateNUnitsAtLoc( 1, 'h003', GetOwningPlayer(u), GetUnitLoc(u), bj_UNIT_FACING )
    call UnitApplyTimedLifeBJ( 4.00, 'BTLF', GetLastCreatedUnit() )
    call PolledWait( 3.00 )
    call CreateNUnitsAtLoc( 1, 'h003', GetOwningPlayer(u), GetUnitLoc(u), bj_UNIT_FACING )
    call UnitApplyTimedLifeBJ( 5.00, 'BTLF', GetLastCreatedUnit() )
    call UnitAddAbilityBJ( 'A00F', GetLastCreatedUnit() )
    call IssuePointOrderLocBJ( GetLastCreatedUnit(), "clusterrockets", (l) )
    call PolledWait( 1.0 )
    call CreateNUnitsAtLoc( 1, 'h003', GetOwningPlayer(u), (l), bj_UNIT_FACING )
    call UnitApplyTimedLifeBJ( 5.00, 'BTLF', GetLastCreatedUnit() )
    call UnitAddAbilityBJ( 'A01I', GetLastCreatedUnit() )
    call SetUnitAbilityLevelSwapped( 'A01I', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A01G', GetTriggerUnit()) )
    call IssueImmediateOrderBJ( GetLastCreatedUnit(), "thunderclap" )
    call DestroyEffect(AddSpecialEffectLoc("war3mapImported\\BigExplosionBlue.mdx", (l)))
    call UnitDamagePointLoc( (u), 0, ( 450.00 + ( 50.00 * I2R(GetUnitAbilityLevelSwapped('A01G', (u))) ) ), (l), ( 400.00 + ( 200.00 * I2R(GetUnitAbilityLevelSwapped('A01G', (u))) ) ), ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL )
    call RemoveLocation(l)
    set u=null
endfunction

//===========================================================================
function InitTrig_Plasma_Rocket takes nothing returns nothing
    set gg_trg_Plasma_Rocket = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Plasma_Rocket, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Plasma_Rocket, Condition( function Trig_Plasma_Rocket_Conditions ) )
    call TriggerAddAction( gg_trg_Plasma_Rocket, function Trig_Plasma_Rocket_Actions )
endfunction

03-08-2007, 01:39 AM#4
Raydude
Hmm...illidan92?
03-08-2007, 01:58 AM#5
Vexorian
For starters the first one has got a location leak
03-08-2007, 02:23 AM#6
wantok
Reading all those BJs was painful.

Collapse JASS:
function Trig_Illumination_Rounds_Conditions takes nothing returns boolean
    return GetSpellAbilityId()=='A018' and udg_FO_ShellsRemaining>=udg_FO_Shells
endfunction

function Trig_Illumination_Rounds_Actions takes nothing returns nothing
    local location l1 = GetSpellTargetLoc()
    local location l2
    local unit u = GetSpellAbilityUnit()
    local integer i1 = 1
    local integer i2 = udg_FO_Shells
    local integer i3 = udg_FO_Radius
    local effect e1
    local unit other
    local player p = GetOwningPlayer(u)
   
    call PingMinimapLocForForceEx( GetPlayersAll(), (l1), 5.00, bj_MINIMAPPINGSTYLE_SIMPLE, 100.00, 50, 50.00 )
    set udg_FO_ShellsRemaining = ( udg_FO_ShellsRemaining - udg_FO_Shells )
    call DisplayTimedTextToForce( GetForceOfPlayer(GetTriggerPlayer()), 5.00, ( "Shells Remaining: " + I2S(udg_FO_ShellsRemaining) ) )
    set e1 = AddSpecialEffectLoc( "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareTarget.mdl", l1 )
    
    
    call PolledWait( ( 10.00 - I2R(GetUnitAbilityLevel(u, 'A011')) ) )
    call DestroyEffect(e1)
    loop
        exitwhen i1 > i2
        set l2=(PolarProjectionBJ((l1), GetRandomReal(0.00,I2R(i3)), GetRandomDirectionDeg()))
        set other = CreateUnitAtLoc(p, 'h003', l2, 0)
        call UnitAddAbility(other, 'A00P')
        call SetUnitAbilityLevel( other, 'A00P', GetUnitAbilityLevel(u, 'A018'))
        call UnitApplyTimedLife(other, 'BTLF', 5.00)
        call IssuePointOrderLoc( other, "farsight", (l2) )
        
        set other = CreateUnitAtLoc(p, 'h003', l2, 0)
        call UnitAddAbility(other, 'A01A')
        call SetUnitAbilityLevel( other, 'A01A', GetUnitAbilityLevel(u, 'A018'))
        call UnitApplyTimedLife(other, 'BTLF', 5.00)
        call IssueImmediateOrder( other, "thunderclap" )
        call PolledWait( GetRandomReal(1.2, 2.85) )
        set i1 = i1 + 1
    endloop
    call RemoveLocation(l1)
    call RemoveLocation(l2)
    set l1=null
    set l2=null
    set e1=null
    set u=null
    set other = null
    set p = null
endfunction

Collapse JASS:
function Trig_Plasma_Rocket_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A01G' 
endfunction

function Trig_Plasma_Rocket_Actions takes nothing returns nothing
    local location l=OffsetLocation(GetSpellTargetLoc(), GetRandomReal(-50.00, 50.00), GetRandomReal(-50.00, 50.00))
    local unit u=GetSpellAbilityUnit()
    local unit other
    local texttag tt =CreateTextTagUnitBJ( ( ( "|cffFF0000" + GetUnitName((u)) ) + ": FIRE IN THE HOLE!" ), (u), 25.00, 8.00, 50.00, 100, 50.00, 10.00 )
    local player p = GetOwningPlayer(u)
    local location loc = GetUnitLoc(u)
    
    call SetTextTagLifespanBJ( tt, 3.00 )
    call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
    call PlaySoundOnUnitBJ( gg_snd_RadioFeedback_3D, 100, (u) )
    
    set other = CreateUnitAtLoc(p, 'h003', loc, 0 )
    call UnitApplyTimedLife( other, 'BTLF', 4.00)
    call PolledWait( 3.00 )
    
    set other = CreateUnitAtLoc(p, 'h003', loc, 0 )
    call UnitApplyTimedLife( other, 'BTLF', 4.00)
    call UnitAddAbility( other, 'A00F')
    call IssuePointOrderLoc( u, "clusterrockets", (l) )
    call PolledWait( 1.0 )
    
    set other = CreateUnitAtLoc(p, 'h003', l, 0 )
    call UnitApplyTimedLife( other, 'BTLF', 5.00)
    call UnitAddAbility(other, 'A01I')
    call SetUnitAbilityLevel( other, 'A01I', GetUnitAbilityLevel(u, 'A01G'))
    call IssueImmediateOrder( other, "thunderclap" )
    call DestroyEffect(AddSpecialEffectLoc("war3mapImported\\BigExplosionBlue.mdx", (l)))
    call UnitDamagePointLoc( (u), 0, ( 450.00 + ( 50.00 * I2R(GetUnitAbilityLevel(u, 'A01G')) ) ), (l), ( 400.00 + ( 200.00 * I2R(GetUnitAbilityLevel(u, 'A01G')) ) ), ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL )
    
    call RemoveLocation(l)
    call RemoveLocation(loc)
    set other = null
    set u=null
    set l = null
    set loc = null
    set p = null
endfunction
03-08-2007, 01:09 PM#7
blu_da_noob
Does the area have lots of doodads? I've heard reports of extreme lag when spells which cause terrain deformation are used in areas with lots of them. Try basing it off something like Warstomp and see what happens.
03-08-2007, 01:41 PM#8
nooK
Just use Aoe Storm bolt and trigger the sfx.
It happens on maps with alot of imports.