• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] Leak Remove

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,601
Hey.

I think this trigger leaks and I've no idea how to fix it. Please fix it for me and can I continue doing this boss spell!

Map attached. Trigger looks like this:

  • Damage
    • Events
      • Time - Every 0.30 seconds of game time
    • Conditions
      • Boss_Event Equal to True
    • Actions
      • Set Skull_Point[Skull_Counter] = (Position of AAAPhodom)
      • Set Skull_Counter = (Skull_Counter + 1)
      • Wait 1.00 seconds
      • -------- --------
      • Special Effect - Create a special effect at Skull_Point[1] using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set TempGroup = (Units owned by Player 1 (Red))
      • Set TempGroup2 = (Units within 100.00 of Skull_Point[1] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is in TempGroup) Equal to True) and ((Level of Invulnerable (Neutral) for (Matching unit)) Equal to 0))))
      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
        • Loop - Actions
          • Unit - Cause AAAPhodom to damage AAAPhodom, dealing 50.00 damage of attack type Spells and damage type Normal
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call DestroyGroup(udg_TempGroup2)
      • Custom script: call RemoveLocation(udg_Skull_Point[1])
      • -------- --------
      • For each (Integer A) from 1 to (Skull_Counter - 1), do (Actions)
        • Loop - Actions
          • Set Skull_Point[(Integer A)] = Skull_Point[((Integer A) + 1)]
      • Custom script: call RemoveLocation(udg_Skull_Point[udg_Skull_Counter])
      • Set Skull_Counter = (Skull_Counter - 1)
Rep + credits for the helper.
 

Attachments

  • PALADIN DMG.w3x
    18.1 KB · Views: 41
Level 17
Joined
Nov 13, 2006
Messages
1,814
Hey.

I think this trigger leaks and I've no idea how to fix it. Please fix it for me and can I continue doing this boss spell!

Map attached. Trigger looks like this:

  • Damage
    • Events
      • Time - Every 0.30 seconds of game time
    • Conditions
      • Boss_Event Equal to True
    • Actions
      • Set Skull_Point[Skull_Counter] = (Position of AAAPhodom)
      • Set Skull_Counter = (Skull_Counter + 1)
      • Wait 1.00 seconds
      • -------- --------
      • Special Effect - Create a special effect at Skull_Point[1] using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set TempGroup = (Units owned by Player 1 (Red))
      • Set TempGroup2 = (Units within 100.00 of Skull_Point[1] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is in TempGroup) Equal to True) and ((Level of Invulnerable (Neutral) for (Matching unit)) Equal to 0))))
      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
        • Loop - Actions
          • Unit - Cause AAAPhodom to damage AAAPhodom, dealing 50.00 damage of attack type Spells and damage type Normal
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call DestroyGroup(udg_TempGroup2)
      • Custom script: call RemoveLocation(udg_Skull_Point[1])
      • -------- --------
      • For each (Integer A) from 1 to (Skull_Counter - 1), do (Actions)
        • Loop - Actions
          • Set Skull_Point[(Integer A)] = Skull_Point[((Integer A) + 1)]
      • Custom script: call RemoveLocation(udg_Skull_Point[udg_Skull_Counter])
      • Set Skull_Counter = (Skull_Counter - 1)
Rep + credits for the helper.

for me its give fatal error when i try start the map even i turned off all trigger. to u this demo map well?

just a notice, maybe u can removelocation in loop?

  • For each (Integer A) from 1 to (Skull_Counter - 1), do (Actions)
    • Loop - Actions
      • Custom script: call RemoveLocation(udg_Skull_Point[GetForLoopIndexA()])
      • Set Skull_Point[(Integer A)] = Skull_Point[((Integer A) + 1)]
  • Custom script: call RemoveLocation(udg_Skull_Point[udg_Skull_Counter])
 
Level 17
Joined
Nov 13, 2006
Messages
1,814

Attachments

  • 1.jpg
    1.jpg
    17.4 KB · Views: 75
Level 7
Joined
Jan 28, 2012
Messages
266
  • Damage
    • Events
      • Time - Every 0.30 seconds of game time
    • Conditions
      • Boss_Event Equal to True
    • Actions
      • Custom script: local location udg_Skull_Loc
      • Set Skull_Loc = (Position of AAAPhodom)
      • Wait 1.00 seconds
      • -------- --------
      • Special Effect - Create a special effect at Skull_Loc using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set TempGroup = (Units owned by Player 1 (Red))
      • Set TempGroup2 = (Units within 100.00 of Skull_Loc matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is in TempGroup) Equal to True) and ((Level of Invulnerable (Neutral) for (Matching unit)) Equal to 0))))
      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
        • Loop - Actions
          • Unit - Cause AAAPhodom to damage AAAPhodom, dealing 50.00 damage of attack type Spells and damage type Normal
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call DestroyGroup(udg_TempGroup2)
      • Custom script: call RemoveLocation(udg_Skull_Loc)
made leakless uses a local instead of a global.
 

Attachments

  • PALADIN DMG.w3x
    142.8 KB · Views: 39
Level 17
Joined
Nov 13, 2006
Messages
1,814
Okay fixed. Here's the fixed map in this post.

acctually if u replace points to coords then i think ok

still i think kinda wrong if u use 1 sec waits in 0.3 sec periodic triggers but u know, also u just pick the units in temp group2 only around 1st point :p

JASS:
function Trig_Damage_Conditions takes nothing returns boolean
    return udg_Boss_Event
endfunction

function Trig_Damage_Actions takes nothing returns nothing
    local unit pu
    local integer i
    local integer max
    set udg_X[udg_Skull_Counter] = GetUnitX(udg_AAAPhodom)
    set udg_Y[udg_Skull_Counter] = GetUnitY(udg_AAAPhodom)
    set udg_Skull_Counter = udg_Skull_Counter + 1
    call TriggerSleepAction( 1.00 )
    //  
    call DestroyEffect(AddSpecialEffect( "Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl" , udg_X[1], udg_Y[1]))
    call GroupEnumUnitsOfPlayer (udg_TempGroup, Player(0), null)
    call GroupEnumUnitsInRange(udg_TempGroup2, udg_X[1], udg_Y[1], 100.00, null)
    loop
        set pu = FirstOfGroup(udg_TempGroup2)
        exitwhen (pu==null)
        if IsUnitInGroup(pu, udg_TempGroup) and GetUnitAbilityLevel(pu, 'Avul') == 0 and not IsUnitType(pu, UNIT_TYPE_DEAD) then
            call UnitDamageTarget(udg_AAAPhodom, udg_AAAPhodom, 50.00, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, null)
        endif
        call GroupRemoveUnit(udg_TempGroup2, pu)
    endloop
 
    set i = 1
    set max = udg_Skull_Counter - 1
    loop
        exitwhen i > max
        set udg_X[i] = udg_X[i + 1 ]
        set udg_Y[i] = udg_Y[i + 1 ]
        set i = i + 1
    endloop
    set udg_Skull_Counter = udg_Skull_Counter - 1
    set pu = null
endfunction

//===========================================================================
function InitTrig_Damage takes nothing returns nothing
    set gg_trg_Damage = CreateTrigger( )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Damage, 0.30 )
    call TriggerAddCondition( gg_trg_Damage, Condition( function Trig_Damage_Conditions ) )
    call TriggerAddAction( gg_trg_Damage, function Trig_Damage_Actions )
endfunction

if u want make to others points too then
JASS:
    call DestroyEffect(AddSpecialEffect( "Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl" , udg_X[1], udg_Y[1]))
    call GroupEnumUnitsInRange(udg_TempGroup2, udg_X[1], udg_Y[1], 100.00, null)

change to this

JASS:
    call DestroyEffect(AddSpecialEffect( "Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl" , udg_X[udg_Skull_Counter], udg_Y[udg_Skull_Counter]))
     call GroupEnumUnitsInRange(udg_TempGroup2, udg_X[udg_Skull_Counter], udg_Y[udg_Skull_Counter], 100.00, null)
 

Attachments

  • PALADIN DMG1.w3x
    142.9 KB · Views: 33
Level 37
Joined
Mar 6, 2006
Messages
9,240
I'm not sure if shadowing a global leaks if you do not null the variable.

I would do it this way:
  • Damage
    • Events
      • Time - Every 0.30 seconds of game time
    • Conditions
      • Boss_Event Equal to True
    • Actions
      • Custom script: local location l = GetUnitLoc(udg_AAAPhodom)
      • Wait 1.00 seconds
      • Custom script: set udg_Skull_Loc = l
      • -------- --------
      • Special Effect - Create a special effect at Skull_Loc using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set TempGroup = (Units within 100.00 of Skull_Loc matching ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) Equal to Player 1 (Red)) and ((Level of Invulnerable (Neutral) for (Matching unit)) Equal to 0))))
      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
        • Loop - Actions
          • Unit - Cause AAAPhodom to damage AAAPhodom, dealing 50.00 damage of attack type Spells and damage type Normal
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call RemoveLocation(l)
      • Custom script: set l = null
 
Status
Not open for further replies.
Top