• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[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

Last edited:
  • 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.
 
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

Status
Not open for further replies.
Back
Top