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

[Trigger] Any Leaks In These Triggers?

Status
Not open for further replies.
Level 5
Joined
Dec 21, 2008
Messages
101
I have never thought of removing leaks until now.. i should learn something :) can anyone spot anymore leaks in these triggers? or if anyone of them could have been scripted or triggered better? i have also attached the sample map

  • Camera Distance
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Camera - Set (Picked player)'s camera Distance to target to 2000.00 over 0.00 seconds)
Is there a need to remove groups for this one into this?

  • Camera Distance
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Players = (All players)
      • Player Group - Pick every player in (All players) and do (Camera - Set (Picked player)'s camera Distance to target to 2000.00 over 0.00 seconds)
      • Custom script: call DestroyForce(udg_Players)
  • Visibility
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
      • Trigger - Turn off (This trigger)
  • Instant Respawn
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set ReviveLocation = (Position of (Triggering unit))
      • Hero - Instantly revive (Triggering unit) at ReviveLocation, Show revival graphics
      • Custom script: call RemoveLocation(udg_ReviveLocation)
  • Spawn Hero
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set SpawnLocation = (Random point in (Playable map area))
      • Unit - Create 1 Blood Mage for Player 1 (Red) at SpawnLocation facing SpawnLocation
      • Unit - Create 1 Blood Mage for Player 2 (Blue) at SpawnLocation facing SpawnLocation
      • Unit - Create 1 Blood Mage for Player 3 (Teal) at SpawnLocation facing SpawnLocation
      • Unit - Create 1 Blood Mage for Player 4 (Purple) at SpawnLocation facing SpawnLocation
      • Custom script: call RemoveLocation(udg_SpawnLocation)
or

  • Spawn Hero
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set SpawnLocation = (Random point in (Playable map area))
      • Unit - Create 1 Blood Mage for Player 1 (Red) at SpawnLocation facing SpawnLocation
      • Custom script: call RemoveLocation(udg_SpawnLocation)
      • Set SpawnLocation = (Random point in (Playable map area))
      • Unit - Create 1 Blood Mage for Player 2 (Blue) at SpawnLocation facing SpawnLocation
      • Custom script: call RemoveLocation(udg_SpawnLocation)
      • Set SpawnLocation = (Random point in (Playable map area))
      • Unit - Create 1 Blood Mage for Player 3 (Teal) at SpawnLocation facing SpawnLocation
      • Custom script: call RemoveLocation(udg_SpawnLocation)
      • Set SpawnLocation = (Random point in (Playable map area))
      • Unit - Create 1 Blood Mage for Player 4 (Purple) at SpawnLocation facing SpawnLocation
      • Custom script: call RemoveLocation(udg_SpawnLocation)
Lastly.. are there any difference between these 2?
  • Trigger - Turn off (This trigger)
and
  • Custom script: call DestroyTrigger(gg_trg_Visibility)
 

Attachments

  • Leak Check.w3x
    16.7 KB · Views: 26
Last edited:
Level 10
Joined
Oct 31, 2009
Messages
352
  • Camera Distance
    • Events
    • Map initialization
    • Conditions
    • Actions
    • Player Group - Pick every player in (All players) and do (Camera - Set (Picked player)'s camera Distance to target to 2000.00 over 0.00 seconds)

Is there a need to remove groups for this one into this?


  • Camera Distance
  • Events
  • Map initialization
  • Conditions
  • Actions
  • Set Players = (All players)
  • Player Group - Pick every player in (All players) and do (Camera - Set (Picked player)'s camera Distance to target to 2000.00 over 0.00 seconds)
  • Custom script: call DestroyForce(udg_Players)

I remember reading somewhere that All Players doesn't leak, only when you specifiy a specific group of players

_________________________________________________________________________


  • Spawn Hero
  • Events
  • Map initialization
  • Conditions
  • Actions
  • Set SpawnLocation = (Random point in (Playable map area))
  • Unit - Create 1 Blood Mage for Player 1 (Red) at SpawnLocation facing SpawnLocation
  • Unit - Create 1 Blood Mage for Player 2 (Blue) at SpawnLocation facing SpawnLocation
  • Unit - Create 1 Blood Mage for Player 3 (Teal) at SpawnLocation facing SpawnLocation
  • Unit - Create 1 Blood Mage for Player 4 (Purple) at SpawnLocation facing SpawnLocation
  • Custom script: call RemoveLocation(udg_SpawnLocation)
The above doesn't leak

________________________________________________________________

Didn't see leaks in any of the other triggers.

Fraid I can't answer that last question :(
 
No, All Players is a preset function, so it leaks once. If you destroy it afterwards, All Players reference will not be anymore available.

This trigger:
  • Spawn Hero Events
    • Map initialization
  • Conditions
  • Actions
    • Set SpawnLocation = (Random point in (Playable map area))
    • Unit - Create 1 Blood Mage for Player 1 (Red) at SpawnLocation facing SpawnLocation
    • Unit - Create 1 Blood Mage for Player 2 (Blue) at SpawnLocation facing SpawnLocation
    • Unit - Create 1 Blood Mage for Player 3 (Teal) at SpawnLocation facing SpawnLocation
    • Unit - Create 1 Blood Mage for Player 4 (Purple) at SpawnLocation facing SpawnLocation
    • Custom script: call RemoveLocation(udg_SpawnLocation)
can be merged as:
  • Spawn Hero
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set SpawnLocation = (Random point in (Playable map area))
    • For each (IntegerA) from 1 to 4, do (Actions)
      • Loop - Actions
        • Unit - Create 1 Blood Mage for Player(IntegerA) at SpawnLocation facing SpawnLocation
    • Custom script: call RemoveLocation(udg_SpawnLocation)
What is more, the action "Trigger - Turn off (This trigger)" in a trigger that has "Map Initialization" as an event is unecessary.
 
Level 14
Joined
Aug 31, 2009
Messages
775
The "Destroy Trigger" literally destroys the trigger and makes it completely unusable ever again, so make sure you only use that on something you're absolutely never going to use again.

And as Pharaoh_ says, there's no need to turn a trigger off it it's not going to be triggered again anyway.
 
Level 5
Joined
Dec 21, 2008
Messages
101
Umm.. Is this better? or could be better? hehe

  • Camera Distance
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Camera - Set (Picked player)'s camera Distance to target to 2000.00 over 0.00 seconds)
Removed 'Players Variable'
Removed 'Set Players = (All players)'
Removed 'Custom script: call DestroyForce(udg_Players)'

  • Visibility
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
Removed 'Trigger - Turn off (This trigger)'

  • Instant Respawn
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set ReviveLocation = (Position of (Triggering unit))
      • Hero - Instantly revive (Triggering unit) at ReviveLocation, Show revival graphics
      • Custom script: call RemoveLocation(udg_ReviveLocation)
No Changes

  • Spawn Hero
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set SpawnLocation = (Random point in (Playable map area))
      • For each (Integer A) from 1 to 4, do (Unit - Create 1 Blood Mage for (Player((Integer A))) at SpawnLocation facing SpawnLocation)
      • Custom script: call RemoveLocation(udg_SpawnLocation)
Removed all 4 repeating actions and merge them into one line.
Previously..
Code:
Unit - Create 1 Blood Mage for Player 1 (Red) at SpawnLocation facing SpawnLocation
Unit - Create 1 Blood Mage for Player 2 (Blue) at SpawnLocation facing SpawnLocation
Unit - Create 1 Blood Mage for Player 3 (Teal) at SpawnLocation facing SpawnLocation
Unit - Create 1 Blood Mage for Player 4 (Purple) at SpawnLocation facing SpawnLocation

If everything looks good then solved :) Reps given.
Also, uploaded the new map if anyone needs it and for future reference :p
Thanks guys
 

Attachments

  • Leak Check.w3x
    16.6 KB · Views: 27
Status
Not open for further replies.
Top