• 🏆 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] Need help finding leak

Status
Not open for further replies.
Level 8
Joined
Jul 15, 2012
Messages
143
hello, i want ask something
i make trigger with event every 3 sec , i use handle counter to check if the trigger leaking or not..

but when the trigger already run 3 times ( at 10 sec) , the number increasing..

  • error
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Set MLoop[1] = 0
      • Set MLoop[1] = (MLoop[1] + 1)
      • Set Striker[18] = (Position of Hero[MLoop[1]])
      • Set Unit_Groups = (Units within 750.00 of Striker[18] matching ((((Matching unit) is A Hero) Equal to True) and (((Player number of (Owner of (Matching unit))) Greater than or equal to 1) and (((Player number of (Owner of (Matching unit))) Less than or equal to 9) and (((Match
      • Set NumUnit = (Number of units in Unit_Groups)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • NumUnit Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in Unit_Groups and do (Actions)
            • Loop - Actions
              • Unit - Cause Hero[MLoop[1]] to damage (Picked unit), dealing 5.00 damage of attack type Spells and damage type Normal
        • Else - Actions
      • Custom script: call DestroyGroup(udg_Unit_Groups)
      • Custom script: set udg_Unit_Groups = null
      • Custom script: call RemoveLocation(udg_Striker[18])
      • Game - Display to (All players) the text: post 1
      • Wait 0.10 seconds
      • Game - Display to (All players) the text: post 1.25
      • Set MLoop[1] = (MLoop[1] + 1)
      • Set Striker[18] = (Position of Hero[MLoop[1]])
      • Game - Display to (All players) the text: post 1.3
      • Set Unit_Groups = (Units within 750.00 of Striker[18] matching ((((Matching unit) is A Hero) Equal to True) and (((Player number of (Owner of (Matching unit))) Greater than or equal to 1) and (((Player number of (Owner of (Matching unit))) Less than or equal to 9) and (((Match
      • Game - Display to (All players) the text: post 1.35
      • Set NumUnit = (Number of units in Unit_Groups)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • NumUnit Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in Unit_Groups and do (Actions)
            • Loop - Actions
              • Unit - Cause Hero[MLoop[1]] to damage (Picked unit), dealing 5.00 damage of attack type Spells and damage type Normal
        • Else - Actions
      • Game - Display to (All players) the text: post 1.5
      • Custom script: call DestroyGroup(udg_Unit_Groups)
      • Custom script: set udg_Unit_Groups = null
      • Custom script: call RemoveLocation(udg_Striker[18])
      • Game - Display to (All players) the text: post 2
Handle counter jass,

JASS:
function HandleCount takes nothing returns nothing
    local location L = Location(0,0)
    call BJDebugMsg(I2S(GetHandleId(L)-0x100000))
    call RemoveLocation(L)
    set L = null
endfunction

//===========================================================================
function InitTrig_HandleCount takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterTimerEvent(t,0.09,true)
    call TriggerAddAction(t,function HandleCount)
endfunction

in game , i take screen shot of handle counter,
it happen when action "wait 0.1 sec " start
i am already turn off all trigger , for checking whether another trigger causing it , but it is not , the causes come from this trigger itself

128687d1377077929-finding-leak-trigger-chat-log.jpg

can anyone help me finding the leak ?
 

Attachments

  • pleasehelp.w3x
    24.5 KB · Views: 86
Last edited by a moderator:
Level 6
Joined
Apr 23, 2011
Messages
182
dont know where are the leaks. But your wait of 0.1 seconds will not work for this reason:

smallest posible wait is = 0.3 seconds aprox.

Also why set group of units to null if you destroy them ??
 
Level 6
Joined
Apr 23, 2011
Messages
182
can you write the hole Set Unit_Groups = .... Because i cant see the end of it please :)

For what you post it seems that the mayor issue is between 1 and 1.25 and that is the wait. Believe me using waits in loop triggers is a bad idea in general pros told me that. Wc3 engine is bad with waits for some ( only god or blizzard knows why ).
 
Level 6
Joined
Apr 23, 2011
Messages
182
Yudistira you have like x5 repeat acctions. And you didnt change the time properly. You just set it worst to = wait 0.01 game-time seconds. This does not work.

I am not really good at removing leaks. But all i can tell you is that for me your trigger is better without the waits inside the loops.
Use a counter with a integrer variable.
run the trigger every 1 second.
add +1 to the counter. When reaches 3 active the damage. reset to 0.
 
Level 6
Joined
Apr 23, 2011
Messages
182
I dont know really sorry. But you do some strange thinks like for example:

why Set Striker[18] ?? Why 18 if you dont have 17 ?
Also type Spell damage is needed? Can you just set to normal the default.

Trying my best sry.
 
Level 8
Joined
Jul 15, 2012
Messages
143
I dont know really sorry. But you do some strange thinks like for example:

why Set Striker[18] ?? Why 18 if you dont have 17 ?
Also type Spell damage is needed? Can you just set to normal the default.

Trying my best sry.

haha , that just 1 trigger of my map..
i use many times variable striker with any array..btw +rep to u..haha

@daffa the mage..

i already delete
JASS:
set udg_Unit_Groups = null
, but it same , after 3 times trigger executed , the number of handle counter is increasing..
 
Level 8
Joined
Jul 15, 2012
Messages
143
okeyy,actually i not to smart to configure AI well,
i see that if AI attacked he will use all of his skill ,


so i make this trigger , to damage AI if there is another nearby heroes, so he can aggressively attacking / use skill to that heroes..

thats all..
 
Level 6
Joined
Apr 23, 2011
Messages
182
xDD knew what had a problem. Okey dont worry just tell me what spells you want the AI unit or units to cast.

If they are normal spells you can just do:
Order unit group to attack move to point.
If they encounter enemies they will automatically cast the spells.
 
Level 6
Joined
Apr 23, 2011
Messages
182
if it not normal spell ?
how to make ai use that skill ?

Post your spell or tell me more about it and then i figure out how the AI can use it.

But the fast way is to use Storm bolt or spells that normaly the mele AI uses when he attack-moves.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I think it is the local group created by the unit group pick in GUI.

This is "Units within x of location matching..."
JASS:
function GetUnitsInRangeOfLocMatching takes real radius, location whichLocation, boolexpr filter returns group
    local group g = CreateGroup()
    call GroupEnumUnitsInRangeOfLoc(g, whichLocation, radius, filter)
    call DestroyBoolExpr(filter)
    return g
endfunction


  • bug
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set MLoop[1] = 0
      • Set MLoop[1] = (MLoop[1] + 1)
      • Set Striker[18] = (Position of Hero[MLoop[1]])
      • Set Unit_Groups = (Units within 750.00 of Striker[18] matching ((((Matching unit) is A Hero) Equal to True) and (((Player number of (Owner of (Matching unit))) Greater than or equal to 1) and (((Player number of (Owner of (Matching unit))) Less than or equal to 9) and (((Match
      • Set NumUnit = (Number of units in Unit_Groups)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • NumUnit Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in Unit_Groups and do (Unit - Cause Hero[MLoop[1]] to damage (Picked unit), dealing 5.00 damage of attack type Spells and damage type Normal)
        • Else - Actions
      • Custom script: call DestroyGroup(udg_Unit_Groups)
      • Custom script: set udg_Unit_Groups = null
      • Custom script: call RemoveLocation(udg_Striker[18])
      • Custom script: set udg_Striker[18] = null

->
JASS:
function Trig_bug_Copy_2_Func004002003001 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true )
endfunction

function Trig_bug_Copy_2_Func004002003002001 takes nothing returns boolean
    return ( GetConvertedPlayerId(GetOwningPlayer(GetFilterUnit())) >= 1 )
endfunction

function Trig_bug_Copy_2_Func004002003002002001 takes nothing returns boolean
    return ( GetConvertedPlayerId(GetOwningPlayer(GetFilterUnit())) <= 9 )
endfunction

function Trig_bug_Copy_2_Func004002003002002002 takes nothing returns boolean
    return ( IsUnitEnemy(GetFilterUnit(), ConvertedPlayer(udg_MLoop[1])) == true )
endfunction

function Trig_bug_Copy_2_Func004002003002002 takes nothing returns boolean
    return GetBooleanAnd( Trig_bug_Copy_2_Func004002003002002001(), Trig_bug_Copy_2_Func004002003002002002() )
endfunction

function Trig_bug_Copy_2_Func004002003002 takes nothing returns boolean
    return GetBooleanAnd( Trig_bug_Copy_2_Func004002003002001(), Trig_bug_Copy_2_Func004002003002002() )
endfunction

function Trig_bug_Copy_2_Func004002003 takes nothing returns boolean
    return GetBooleanAnd( Trig_bug_Copy_2_Func004002003001(), Trig_bug_Copy_2_Func004002003002() )
endfunction

function Trig_bug_Copy_2_Func006Func001002 takes nothing returns nothing
    call UnitDamageTargetBJ( udg_Hero[udg_MLoop[1]], GetEnumUnit(), 5.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endfunction

function Trig_bug_Copy_2_Func006C takes nothing returns boolean
    if ( not ( udg_NumUnit > 0 ) ) then
        return false
    endif
    return true
endfunction

function Trig_bug_Copy_2_Actions takes nothing returns nothing
    set udg_MLoop[1] = 0
    set udg_MLoop[1] = ( udg_MLoop[1] + 1 )
    set udg_Striker[18] = GetUnitLoc(udg_Hero[udg_MLoop[1]])
    set udg_Unit_Groups = GetUnitsInRangeOfLocMatching(750.00, udg_Striker[18], Condition(function Trig_bug_Copy_2_Func004002003))
    set udg_NumUnit = CountUnitsInGroup(udg_Unit_Groups)
    if ( Trig_bug_Copy_2_Func006C() ) then
        call ForGroupBJ( udg_Unit_Groups, function Trig_bug_Copy_2_Func006Func001002 )
    else
    endif
    call DestroyGroup(udg_Unit_Groups)
    set udg_Unit_Groups = null
    call RemoveLocation(udg_Striker[18])
    set udg_Striker[18] = null
endfunction

//===========================================================================
function InitTrig_bug_Copy_2 takes nothing returns nothing
    set gg_trg_bug_Copy_2 = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_bug_Copy_2, 0.03 )
    call TriggerAddAction( gg_trg_bug_Copy_2, function Trig_bug_Copy_2_Actions )
endfunction

Changing
JASS:
function Trig_bug_Copy_2_Actions takes nothing returns nothing
    set udg_MLoop[1] = 0
    set udg_MLoop[1] = ( udg_MLoop[1] + 1 )
    set udg_Striker[18] = GetUnitLoc(udg_Hero[udg_MLoop[1]])
    set udg_Unit_Groups = GetUnitsInRangeOfLocMatching(750.00, udg_Striker[18], Condition(function Trig_bug_Copy_2_Func004002003))
    set udg_NumUnit = CountUnitsInGroup(udg_Unit_Groups)
    if ( Trig_bug_Copy_2_Func006C() ) then
        call ForGroupBJ( udg_Unit_Groups, function Trig_bug_Copy_2_Func006Func001002 )
    else
    endif
    call DestroyGroup(udg_Unit_Groups)
    set udg_Unit_Groups = null
    call RemoveLocation(udg_Striker[18])
    set udg_Striker[18] = null
endfunction
->
JASS:
function Trig_bug_Copy_2_Actions takes nothing returns nothing
    local group g = CreateGroup()
    set udg_MLoop[1] = 0
    set udg_MLoop[1] = ( udg_MLoop[1] + 1 )
    set udg_Striker[18] = GetUnitLoc(udg_Hero[udg_MLoop[1]])
    call GroupEnumUnitsInRangeOfLoc(g, udg_Striker[18], 750, Condition(function Trig_bug_Copy_2_Func004002003))
    set udg_NumUnit = CountUnitsInGroup(g)
    if ( Trig_bug_Copy_2_Func006C() ) then
        call ForGroupBJ( g, function Trig_bug_Copy_2_Func006Func001002 )
    else
    endif
    call DestroyGroup(g)
    set g = null
    call RemoveLocation(udg_Striker[18])
    set udg_Striker[18] = null
endfunction

And the handle count will not increase.
 
Status
Not open for further replies.
Top