• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!

Trigger memory leaks?

Status
Not open for further replies.
Level 1
Joined
Oct 1, 2012
Messages
6
Could you guys tell me how I could fix this skill to not leak anymore? We occasionally get a fatal error crash on the map it was implemented to and I don't know much about triggers, and even less about what causes leaks.

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Electrical Overload
  • Actions
    • Hashtable - Create a hashtable
    • Set EO_TARGET = (Target unit of ability being cast)
    • Special Effect - Create a special effect attached to the hand, left of (Target unit of ability being cast) using Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
    • Hashtable - Save Handle Of(Last created special effect) as 1 of 3 in (Last created hashtable)
    • Special Effect - Create a special effect attached to the hand, right of (Target unit of ability being cast) using Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
    • Hashtable - Save Handle Of(Last created special effect) as 2 of 3 in (Last created hashtable)
    • Special Effect - Create a special effect attached to the chest of (Target unit of ability being cast) using Abilities\Spells\Orc\Purge\PurgeBuffTarget.mdl
    • Hashtable - Save Handle Of(Last created special effect) as 3 of 3 in (Last created hashtable)
    • Unit - Make EO_TARGET Invulnerable
    • Unit - Pause EO_TARGET
    • Wait 5.00 seconds
    • Unit - Make EO_TARGET Vulnerable
    • Unit - Unpause EO_TARGET
    • Special Effect - Destroy (Load 1 of 3 in (Last created hashtable))
    • Special Effect - Destroy (Load 2 of 3 in (Last created hashtable))
    • Special Effect - Destroy (Load 3 of 3 in (Last created hashtable))
 
Level 10
Joined
May 8, 2009
Messages
259
No need to pass through hashtables:

  • Set EO_TARGET = (Target unit of ability being cast)
  • Special Effect - Create a special effect attached to the hand, left of (Target unit of ability being cast) using Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
  • Set SpecialEffect[1] = (Last created special effect)
  • Special Effect - Create a special effect attached to the hand, right of (Target unit of ability being cast) using Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
  • Set SpecialEffect[2] = (Last created special effect)
  • Special Effect - Create a special effect attached to the chest of (Target unit of ability being cast) using Abilities\Spells\Orc\Purge\PurgeBuffTarget.mdl
  • Set SpecialEffect[3] = (Last created special effect)
  • Unit - Make EO_TARGET Invulnerable
  • Unit - Pause EO_TARGET
  • Wait 5.00 seconds
  • Unit - Make EO_TARGET Vulnerable
  • Unit - Unpause EO_TARGET
  • Special Effect - Destroy SpecialEffect[1]
  • Special Effect - Destroy SpecialEffect[2]
  • Special Effect - Destroy SpecialEffect[2]
Though if the trigger fires again within 5 seconds, the special effects won't be destroyed.
 
Level 1
Joined
Oct 1, 2012
Messages
6
Thank you. Do hashtables cause leaks? Is it better to not use them and why? Is it better to put end trigger at the end of a trigger? What's the difference if I keep it running? Will it be leak-less when I changed the hashtables for what you did? Thanks
 
Level 10
Joined
May 8, 2009
Messages
259
Do hashtables cause leaks?
No.

Is it better to not use them and why?
You have learn how to use them correctly. They are only used to store values (integer or reals). Theses values can be "attached" to anything (units/timers/destructibles/etc..)
For example: You want to know who started a timer. Then ou better use a hastable that can "attach" the value "3" to the timer if player 3 started it.


Is it better to put end trigger at the end of a trigger? What's the difference if I keep it running?
I don't understand what you're trying to say.

Will it be leak-less when I changed the hashtables for what you did? Thanks
Your trigger doesn't have any leak, it was only causing fatal error because of a wrong use of hashtable. By changing them, it will work properly.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Learn the custom scripts you can use to optimize the things you want to do. Like using X/Y instead of locations, and using DestroyEffect(AddEffect) instead of creating and destroying later, using locals, and so on...
 
Level 1
Joined
Oct 1, 2012
Messages
6
Ok, thanks for the help. But then I'm facing another problem! I get that fatal error and it isn't when that trigger was taking effect. I thought it was the memory leaks building up since it usually crashes when a spell that seems visually demanding is being casted, but since this trigger isn't leaking, what is causing the crashes? The fatal error has appeared with 2 different spells so far, yet it doesn't ALWAYS happen when those spells are casted, matter fact, it rarely does. Is it memory related you guys would say?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Sometimes if you give an ability 0duration, or 0 damage, it lags untill the game crashes. Happens with Shadow Strike and Fire Strike. Also happens with infinite loop triggers. A LOT of memory leaks (tons... dousands) are needed to crash the game, since it requires Wc3 to spend all the resources; meaning, taking aprox 4gb of memory space to run, then it crashes.
 
Level 1
Joined
Oct 1, 2012
Messages
6
Is the lag noticeable? Because here nothing is noticed until the ''visually demanding'' spells go off and then Bam! Fatal Error for the 10 players in the game

Thanks for the useful informations Spart. I'll look into that. I am not using shadowstrike/flamestrike but it could be an infinite loop trigger.

Sorry I'm bad at this. Infinite loop trigger is a loop trigger that goes off with time intervals?
 
Last edited by a moderator:
Level 20
Joined
Jul 14, 2011
Messages
3,213
What abilities are crashing your game, and what are the units / triggers involved in with the abilities?

Infinite loop trigger is:

- A unit enters Region
- Move unit instantly to random point in Region

The unit wil enter, and enter, and enter, and enter, and crash.

- Unit A is damaged by unit B
- Order B to damage A

B will damage A, and trigger, and damage A, and trigger, and crash.
 
Level 1
Joined
Oct 1, 2012
Messages
6
The abilities crashing the game are not in the trigger editor in world editor and I cannot find them. They are not just modified regular abilities neither. Both are similar in a way: It's an effect that comes from ''the sky'' and lands on the ground causing damage. One is at repeated intervals for 10 hits I think and the other one is a single nuke.

Would it make sense that because of an infinite loop trigger, those 2 abilities would make the game crash even if they are not related to the infinie loop trigger? Those 2 abilities are used and have been used for years on the original open source map without causing this crash, so I'm thinking it has to be something I have implemented.

Is this an infinite loop trigger, or is it not because it ends?

  • Omnislash
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Omnislash
    • Actions
      • -------- Indexing Start --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MUI_1 Equal to 0
        • Then - Actions
          • -------- If there are currently no instances running, we turn on the loop. --------
          • Trigger - Turn on Omnislash Loop <gen>
        • Else - Actions
      • -------- Increase the indexes --------
      • Set MUI_1 = (MUI_1 + 1)
      • -------- End of Indexing --------
      • -------- Start of Dynamic Indexing --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MUI_1 Greater than Max_Index
        • Then - Actions
          • -------- Indexing ~~ --------
          • Set MUI_2[MUI_1] = MUI_1
          • Set Max_Index = MUI_1
        • Else - Actions
      • -------- End of Dynamic Indexing --------
      • -------- Makes it easier to read and cleaner. --------
      • Set Temp = MUI_2[MUI_1]
      • -------- The MUI boolean --------
      • -------- Setting The Caster --------
      • Set CL_Caster[Temp] = (Triggering unit)
      • -------- Setting the Player --------
      • Set CL_Player[Temp] = (Owner of (Triggering unit))
      • -------- Setting the Targeted unit --------
      • Set CL_Target[Temp] = (Target unit of ability being cast)
      • -------- Setting the ability level for the caster --------
      • Set CL_AbilityLevel[Temp] = (Level of Omnislash for (Triggering unit))
      • -------- ***Here you can change the number of slashes*** --------
      • Set CL_Slashes[Temp] = (1 + (1 x CL_AbilityLevel[Temp]))
      • -------- ***Here you can change the damage dealt*** --------
      • Set CL_Damage[Temp] = (60 x CL_AbilityLevel[Temp])
      • -------- ***Here you can change the AOE in which the hero teleports*** --------
      • Set CL_AOE[Temp] = 500.00
      • -------- ***Here you can change the effect on the weapon of the hero*** --------
      • Special Effect - Create a special effect attached to the weapon of CL_Caster[Temp] using Abilities\Weapons\IllidanMissile\IllidanMissile.mdl
      • -------- This is used to count the slashes --------
      • Set CL_Count[Temp] = 0
      • -------- *** Change this to "False" if you dont want the targeted unit to get slashed first, instead a random unit near him. --------
      • Set CL_FirstTarget[Temp] = True
      • -------- Storing the effect --------
      • Set CL_Special[Temp] = (Last created special effect)
      • -------- Pausing the Caster --------
      • Unit - Pause CL_Caster[Temp]
      • -------- Adding some vertex coloring and transparency (fade). --------
      • Animation - Change CL_Caster[Temp]'s vertex coloring to (40.00%, 40.00%, 40.00%) with 40.00% transparency
      • -------- Changes animation speed for smooth slashing. --------
      • Animation - Change CL_Caster[Temp]'s animation speed to 200.00% of its original speed
      • -------- --------------------------------------------------------- --------
  • Omnislash Loop
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • For each (Integer MUI_3) from 1 to MUI_1, do (Actions)
        • Loop - Actions
          • -------- Makes it easier to read and cleaner. --------
          • Set Temp = MUI_2[MUI_3]
          • -------- Counting the number of slashes --------
          • Set CL_Count[Temp] = (CL_Count[Temp] + 1)
          • -------- Setting loc to prevent leak --------
          • Set CL_Loc[1] = (Position of CL_Target[Temp])
          • -------- Setting the group in which the hero warps --------
          • Set CL_Group[1] = (Units within CL_AOE[Temp] of CL_Loc[1] matching ((((Matching unit) is A flying unit) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of CL_Player[Temp]) Equal to True))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CL_FirstTarget[Temp] Equal to True
            • Then - Actions
              • -------- Moving hero to target --------
              • Unit - Move CL_Caster[Temp] instantly to CL_Loc[1]
              • -------- Making the hero face the target --------
              • Unit - Make CL_Caster[Temp] face CL_Loc[1] over 0.00 seconds
              • -------- Damaging the target --------
              • Unit - Cause CL_Caster[Temp] to damage CL_Target[Temp], dealing (Real(CL_Damage[Temp])) damage of attack type Normal and damage type Normal
              • -------- Attack animation for eye candy --------
              • Animation - Play CL_Caster[Temp]'s attack animation
              • -------- The "Blink" effect. You may change this. --------
              • Special Effect - Create a special effect attached to the origin of CL_Caster[Temp] using Abilities\Spells\Items\AIam\AIamTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • -------- Setting the boolean to false else the target will get hit the whole time. --------
              • Set CL_FirstTarget[Temp] = False
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (CL_Caster[Temp] is alive) Equal to True
                  • CL_Count[Temp] Less than or equal to CL_Slashes[Temp]
                  • (Number of units in CL_Group[1]) Greater than 0
                • Then - Actions
                  • -------- Setting the next target of the hero --------
                  • Set CL_Victim[Temp] = (Random unit from CL_Group[1])
                  • -------- Setting the loc of the target to prevent leak --------
                  • Set CL_Loc[2] = (Position of CL_Victim[Temp])
                  • Set CL_Loc[3] = (CL_Loc[2] offset by 50.00 towards (Random angle) degrees)
                  • -------- Moving hero to target --------
                  • Unit - Move CL_Caster[Temp] instantly to CL_Loc[3]
                  • -------- Making the hero face the target --------
                  • Unit - Make CL_Caster[Temp] face CL_Loc[2] over 0.00 seconds
                  • -------- Damaging the target --------
                  • Unit - Cause CL_Caster[Temp] to damage CL_Victim[Temp], dealing (Real(CL_Damage[Temp])) damage of attack type Normal and damage type Normal
                  • -------- Attack animation for eye candy --------
                  • Animation - Play CL_Caster[Temp]'s attack animation
                  • -------- The "Blink" effect. You may change this. --------
                  • Special Effect - Create a special effect attached to the origin of CL_Caster[Temp] using Abilities\Spells\Items\AIam\AIamTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • -------- Removing Point Leaks --------
                  • Custom script: call RemoveLocation( udg_CL_Loc[2] )
                  • Custom script: call RemoveLocation( udg_CL_Loc[3] )
                • Else - Actions
                  • -------- Destroying his weapon effect --------
                  • Special Effect - Destroy CL_Special[Temp]
                  • -------- Unpausing the caster --------
                  • Unit - Unpause CL_Caster[Temp]
                  • -------- Resetting the casters animations --------
                  • Animation - Change CL_Caster[Temp]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
                  • Animation - Reset CL_Caster[Temp]'s animation
                  • -------- Recycling all the indexes --------
                  • Set MUI_2[MUI_3] = MUI_2[MUI_1]
                  • Set MUI_2[MUI_1] = Temp
                  • Set MUI_1 = (MUI_1 - 1)
                  • Set MUI_3 = (MUI_3 - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • MUI_1 Equal to 0
                    • Then - Actions
                      • -------- Turning off this trigger. Pointless to keep running --------
                      • Trigger - Turn off (This trigger)
                      • -------- --------------------------------------------------------- --------
                    • Else - Actions
          • -------- Removing Point Leaks --------
          • Custom script: call RemoveLocation( udg_CL_Loc[1] )
          • -------- Removing Group Leak --------
          • Custom script: call DestroyGroup( udg_CL_Group[1] )
Thanks for your time
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Omnislash is an ability that has to be somewhere in the editor.

By the way... have you tried disabling some triggers to check precisely wich one is causing the crash?
 
Level 1
Joined
Oct 1, 2012
Messages
6
Omnislash is not one of the abilities crashing the game, I just wondered if it was infinite loop. Hm, well here's the deal, the crash seems to happen in strong encounters where everyone is casting their ults and to me, it seems to be at the most demanding points. I havn't had the chance to disable triggers and do the testing because I can barely fill a game now that the community playing it knows it's susceptible to crashing, and the game does not crash when it's only me in it. I've tried casting the ults that normally cause the crash when I was by myself and no crash happened.

To all: what are the known factors that could cause a fatal error to All the players inside a game?
 
Last edited:
Status
Not open for further replies.
Top