• 🏆 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!

Will these triggers leak?

Status
Not open for further replies.
Hello guys, i am going to post some triggers in order to know are they leak-free or not. Please feel free to correct any actions that can lead to problems or leaks. Also, i am going to ask a series of questions but please answer me without posting links on read this or that.

  • Pause
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in Region 057 <gen>) and do (Unit - Pause (Picked unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in Region 056 <gen>) and do (Unit - Pause (Picked unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in Region 058 <gen>) and do (Unit - Pause (Picked unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in Region 062 <gen>) and do (Unit - Pause (Picked unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in Region 064 <gen>) and do (Unit - Pause (Picked unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units of type Resurrection Obelisk) and do (Animation - Play (Picked unit)'s stand work animation)

  • Unpause attack 1
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Region 058 <gen> contains (Triggering unit)) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in Region 058 <gen>) and do (Unit - Unpause (Picked unit))
  • Hell Cannon
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Hell Cannon
    • Actions
      • Set HellPoint = (Position of (Triggering unit))
      • Unit - Cause (Triggering unit) to damage circular area after 1.42 seconds of radius 207.00 at HellPoint, dealing 300.00 damage of attack type Chaos and damage type Normal
      • Custom script: call RemoveLocation(udg_HellPoint)
  • Flame Tower
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Flame Tower
    • Actions
      • Set FlamePoint = (Position of (Triggering unit))
      • Special Effect - Create a special effect at FlamePoint using Objects\Spawnmodels\Human\HCancelDeath\HCancelDeath.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect at FlamePoint using Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_FlamePoint)
  • Draenei 1
    • Events
      • Destructible - Cage 3421 <gen> dies
    • Conditions
    • Actions
      • Set CagePoint = (Position of (Dying destructible))
      • Unit - Create 1 Draenei Harbinger for Player 9 (Gray) at CagePoint facing 270.00 degrees
      • Custom script: call RemoveLocation(udg_CagePoint)
I have 10 other similar triggers should i change the variable every time or is it OK to use the same one?


  • InfernalWheeledWarrior
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Infernal Juggernaut
    • Actions
      • Unit - Remove (Triggering unit) from the game
      • Set InPoint = (Position of (Triggering unit))
      • Unit - Create 1 Infernal Wheeled Warrior for (Owner of (Triggering unit)) at InPoint facing (Facing of (Triggering unit)) degrees
      • Custom script: call RemoveLocation(udg_InPoint)
      • Animation - Play (Last created unit)'s birth animation
      • Unit - Pause (Last created unit)
      • Wait 2.00 seconds
      • Unit - Unpause (Last created unit)
      • Animation - Reset (Last created unit)'s animation
  • ST1
    • Events
      • Unit - A unit enters Region 120 <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Trigger - Turn off (This trigger)
      • Wait 0.30 seconds
      • Animation - Play Spiked Trap (2) 3354 <gen>'s morph animation
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in Region 120 <gen>) and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 100.00))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in Region 120 <gen>) and do (Special Effect - Create a special effect attached to the origin of (Picked unit) using Objects\Spawnmodels\Undead\UndeadBlood\UndeadBloodNecromancer.mdl)
      • Wait 2.00 seconds
      • Animation - Play Spiked Trap (2) 3354 <gen>'s death alternate animation
      • Wait 0.30 seconds
      • Trigger - Turn on (This trigger)
  • Gr
    • Events
      • Unit - Power Generator 0000 <gen> Dies
      • Unit - Power Generator 0042 <gen> Dies
      • Unit - Power Generator 0097 <gen> Dies
      • Unit - Power Generator 0082 <gen> Dies
      • Unit - Magic Generator 0348 <gen> Dies
      • Unit - Magic Generator 0349 <gen> Dies
      • Unit - Power Generator 0186 <gen> Dies
      • Unit - Magic Generator 0339 <gen> Dies
      • Unit - Magic Generator 0295 <gen> Dies
      • Unit - Magic Generator 0296 <gen> Dies
      • Unit - Magic Generator 0458 <gen> Dies
      • Unit - Magic Generator 0436 <gen> Dies
      • Unit - Magic Generator 0535 <gen> Dies
      • Unit - Power Generator 0125 <gen> Dies
    • Conditions
    • Actions
      • Wait 0.10 seconds
      • Set GenPoint = (Position of (Triggering unit))
      • Animation - Play the death animation for all doodads of type RunesS within 128.00 of GenPoint
      • Special Effect - Create a special effect at GenPoint using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_GenPoint)
  • Hydra
    • Events
      • Unit - Ancient Hydra 0482 <gen> Is attacked
    • Conditions
    • Actions
      • Set AttPoint = (Position of (Attacking unit))
      • Unit - Order Ancient Hydra 0482 <gen> to Neutral Pandaren Brewmaster - Breath Of Fire AttPoint
      • Custom script: call RemoveLocation(udg_AttPoint)

Point leaks is some serious pain in the ass. Will these actions leak too? Should i ignore that? Or correct every single one of them? Because it will take forever.

  • Cinematic - Ping minimap for (All players) at (Center of Region 080 <gen>) for 2.00 seconds
  • Camera - Pan camera for Player 1 (Red) to (Center of Region 080 <gen>) over 0.00 seconds
  • BurningSky
    • Events
      • Unit - Kael 0391 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Burning Sky
    • Actions
      • Sound - Play PhoenixYes1 <gen> at 100.00% volume, located at (Position of Kael 0391 <gen>) with Z offset 0.00
  • Flag1
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Order Orc Shipyard 0443 <gen> to Set Rally Point To (Center of Region 029 <gen>)
      • Unit - Order Barracks 0239 <gen> to Set Rally Point To (Center of Region 033 <gen>)
      • Unit - Order Barracks 0233 <gen> to Set Rally Point To (Center of Region 036 <gen>)
If i change the rally point to a random point in the desired region will that remove the leak?


  • Sound - Play ShimmeringPortalBirth <gen> at 100.00% volume, located at (Center of Region 149 <gen>) with Z offset 0.00
  • Hero - Instantly revive Moloch 0442 <gen> at (Center of Region 003 <gen>), Show revival graphics
Would anyone care to explain to me what will leaked triggers result in-game? Can we leave some leaked triggers in the map? Will that do any sort harm to gameplay? Will the moderator just run it through the leak tester (i know they do this lol) and be like hey son i found 20 leaks in your map and i don't care if you spent half your life creating it so shove it up your *ss?
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Trigger0 - leaks iiir. The action "Pick units of type X" permanently leaks. Change it instead to "Pick every unit in *somewhere*, unit-type of (matching unit) == Obelisk"

Trigger4 - you can use the same variable.

Trigger5 - there is no leak I see, however do note that after the 2 second wait a "Last Created unit" may be some other unit than the one you want.

Action1 - Action6 - all leak point
 
Trigger0 - leaks iiir. The action "Pick units of type X" permanently leaks. Change it instead to "Pick every unit in *somewhere*, unit-type of (matching unit) == Obelisk"
Sorry didn't catch that. Can you post a trigger?
Action1 - Action6 - all leak point
Do i need to set a variable to each trigger that contains actions like that? Because i have like 100 of them.
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Basically everything in WCIII is an object/widget. An object is a combination of attributes, functions, etc that associate with given object. For example a unit is an object and its attributes are (among other) health, visibility, mana, attack damage and so on. Functions are for example movement (moving from one point to another point) etc.
What is not an object: Integer, Real, boolean (hence why they don't leak) and maybe some other.

Now each object needs memory space (your RAM). The more objects, the less free memory space you have.
Imagine objects as boxes and your memory space as empty room. The more boxes you put in the room, the harder it is to operate inside the room (move around, search for boxes, etc.). What happens when you already have full room of boxes but you still need to put some more inside? You will need to take some useless boxes out of the room, so that your room is filled only with the usable ones.

A memory leak is basically an object which serves no purpose and has no meaning for us, yet we lost all reference to said object, so we cannot remove it to free memory space.
You have to pile a lot of leaks one onto another to notice anything. In game, you can see it as permanent FPS drops until the game very well freezes. This doesn't have to happen immediately, but it still destroys the fun of competitive map if it lags to you.

It is a so called "Best practices" to remove all memory leaks, because you never know on how old computer someone may be playing your map, so while your new high-tech computer may not notice any problems even if you pile up 100 000 memory leaks, an old computer may freeze solid after 50 000.


Edit:
Sorry didn't catch that. Can you post a trigger?
In the trigger change this:
  • Unit Group - Pick every unit in (Units of type Footman) and do (Actions)
    • Loop - Actions

To this:
  • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Footman)) and do (Actions)
    • Loop - Actions

Do i need to set a variable to each trigger that contains actions like that? Because i have like 100 of them.
Yes.
 
Can we leave some leaked triggers
Usually it becomes critical if you leak in triggers/functions that run very often.
If it doesn't run too often, you probably will hardly notice anything, or just nothing at all.

How ever it may cause problems, so it's good practice to prevent leaks at all.
For example in Spell section all resources must be leakless, if you want your submission approved.

If it's only for your personal map, it's up to you to clean all leaks, but I suggest you to read tutorials about memory leaks to better understand it,
even you mentioned in your opening post that you don't want be told to do so.
Once you understood it, you can probably answer most questions on your own.
 
Status
Not open for further replies.
Top