• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Trigger Leaks

Status
Not open for further replies.
Level 2
Joined
Jul 19, 2010
Messages
6
Hello,

I have to ask something about leaks in triggers:

This is my trigger and I wanted to know if I did correctly so it doesn't leak:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (DamageEventSource has buff The Hand of Ares ) Equal to Wahr
    • Then - Actions
      • Set VariableSet HandofAresCount = 0
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by DamageEventSource of type |cffffff00The Hand of Ares|r)) Equal to (Item-type of (Item carried by DamageEventSource in slot (Integer A)))
            • Then - Actions
              • Set VariableSet HandofAresCount = (HandofAresCount + 1)
            • Else - Actions
      • Set VariableSet MapLocation = (Center of (Playable map area))
      • Unit - Create 1 DAMAGEDUMMY for (Owner of DamageEventSource) at MapLocation facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_MapLocation)
      • Unit - Cause (Last created unit) to damage DamageEventTarget, dealing (200.00 x (Real(HandofAresCount))) damage of attack type Chaos and damage type Normal
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Special Effect - Create a special effect attached to the chest of DamageEventTarget using Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmDamage.mdl
      • Special Effect - Destroy (Last created special effect)
    • Else - Actions

And another one about that group:
  • Boss Event
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Number of units in (Units in PlayableArea <gen> owned by Player 12 (Brown))) Less than or equal to 0
    • Actions
      • Set VariableSet BossCheck = (BossCheck + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BossCheck Greater than or equal to 2
        • Then - Actions
          • Set VariableSet BossCheck = 0
          • Trigger - Turn off (This trigger)
          • Game - Display to (All players) for 20.00 seconds the text: |cffff0000An evil b...
          • Cinematic - Ping minimap for (All players) at (Center of Spawn Boss <gen>) for 20.00 seconds, using a Warning ping of color (100.00%, 100.00%, 100.00%)
          • Trigger - Turn on Boss Spawn <gen>
        • Else - Actions

If they leak, can you show my where and how I can avoid it?

Thanks you.
 
Level 29
Joined
May 14, 2021
Messages
1,137
There are some solutions here in the link below. Remember, you'll have to identify some triggers which can cause instability of the game:

 
  • empty.gif
    empty.gif
    line.gif
    join.gif
    cam.gif
    Cinematic - Ping minimap for (All players) at (Center of Spawn Boss <gen>) for 20.00 seconds, using a Warning ping of color (100.00%, 100.00%, 100.00%)

This part leaks a location/point.
This can be solved similar to how "MapLocation" is used in the first trigger.

Other than that, there is only a "dummy unit leak", but I usually don't recommend people caring about it, because it's probably more work than it's worth to care about (depending on situation ofc).
More info on that: Dummy Recycler v1.25
 
Level 2
Joined
Jul 19, 2010
Messages
6
Thanks man, didn't know if the Condition in the second trigger would cause a leak.

joinbottom.gif
if.gif
(Number of units in (Units in PlayableArea <gen> owned by Player 12 (Brown))) Less than or equal to 0
 
Thanks man, didn't know if the Condition in the second trigger would cause a leak.

joinbottom.gif
if.gif
(Number of units in (Units in PlayableArea <gen> owned by Player 12 (Brown))) Less than or equal to 0
Ohh, I missed that one. It leaks a group.

(I'm in a meeting at work, so slightly distracted :p)

This can be solved by putting a custom script with "set bj_wantDestroyGroup = true" before an "if/then/else multiple" with that condition, and put everything in that if.
 
Last edited:
Level 2
Joined
Jul 19, 2010
Messages
6
Hey man,
thank you very much for your help =)

  • Boss Event
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet MapGroup = (Units in PlayableArea <gen> owned by Player 12 (Brown))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in MapGroup) Less than or equal to 0
        • Then - Actions
          • Set VariableSet BossCheck = (BossCheck + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • BossCheck Greater than or equal to 2
            • Then - Actions
              • Set VariableSet BossCheck = 0
              • Trigger - Turn off (This trigger)
              • Game - Display to (All players) for 20.00 seconds the text: |cffff0000An evil b...
              • Set VariableSet MapLocation = (Center of Spawn Boss <gen>)
              • Cinematic - Ping minimap for (All players) at MapLocation for 20.00 seconds, using a Warning ping of color (100.00%, 100.00%, 100.00%)
              • Custom script: call RemoveLocation(udg_MapLocation)
              • Trigger - Turn on Boss Spawn <gen>
            • Else - Actions
        • Else - Actions
      • Custom script: call DestroyGroup(udg_MapGroup)
I hope this is leakless. I think i start to understand it.
 
Status
Not open for further replies.
Top