• 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.

[Trigger] Leaks?

Status
Not open for further replies.
Level 17
Joined
Jun 12, 2007
Messages
1,261
Oke I made some triggers for my map, and I have alot of these triggers in my map (same kind). I want to know if these triggers would leak or not and if so how to fix them.
I looked at tutorials on how to remove leaks but I didn't realy get that.

First is a trigger I used for digging.
  • Essence of Outset6
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Action
          • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
          • (Item-type of (Item carried by (Triggering unit) in slot 1)) Equal to Tools: Shovel
          • (IS Outset Island Herb and Outset Essence Spawn <gen> contains Hero6Orange) Equal to True
    • Actions
      • Game - Display to Player Group - Player 6 (Orange) the text: You start digging w...
      • Special Effect - Create a special effect attached to the origin of Hero6Orange using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
      • Wait 4.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 100.00) Less than or equal to 20.00
        • Then - Actions
          • Item - Create Essence of Strenght at (Position of Hero6Orange)
          • Game - Display to Player Group - Player 6 (Orange) the text: You found something...
        • Else - Actions
          • Game - Display to Player Group - Player 6 (Orange) the text: You find nothing bu...
And second I have a trigger to respawn a unit when it dies.

  • MurlocTiderunner
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Murloc Tiderunner
    • Actions
      • Hero - Add 1 experience to (Killing unit), Show level-up graphics
      • Set UnMurlocTiderunnerLocation = (Dying unit)
      • Item - Create Murloc Tiderunner Scales at (Position of UnMurlocTiderunnerLocation)
      • Wait 20.00 seconds
      • Unit - Create 1 Murloc Tiderunner for Neutral Hostile at (Random point in IS Outset Island Murloc and Wood Spawn <gen>) facing (Random real number between 0.00 and 360.00) degrees
Thanks in advance.
 
Level 5
Joined
Sep 10, 2006
Messages
185
  • MurlocTiderunner
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Murloc Tiderunner
    • Actions
      • Hero - Add 1 experience to (Killing unit), Show level-up graphics
      • Set UnMurlocTiderunnerLocation = (Dying unit)
      • Item - Create Murloc Tiderunner Scales at (Position of UnMurlocTiderunnerLocation)
      • Wait 20.00 seconds
      • Set RandomPos = Random point in IS Outset Island Murloc and Wood Spawn.
      • Unit - Create 1 Murloc Tiderunner for Neutral Hostile at (RandomPos) facing (Random real number between 0.00 and 360.00) degrees
      • Custom Script: call RemoveLocation(udg_UnMurlocTiderunnerLocation)
      • Custom Script: call RemoveLocation(udg_RandomPos)

Anyhow, I don't think this trigger works if you kill another murloc within 20 seconds of the first, it would probably only spawn 1.
RandomPos is just the name I chose, you can use w.e
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Thanks, I'll try both things out, I hope it works ^^ and I also hope it will also work if an other murloc gets killed within 20sec or my map will be bugged later ingame xD

Edit:
I keep getting an error, what did I do wrong? =(

  • MurlocTiderunner
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Murloc Tiderunner
    • Actions
      • Hero - Add 1 experience to (Killing unit), Show level-up graphics
      • Set UnMurlocTiderunnerLocation = (Dying unit)
      • Item - Create Murloc Tiderunner Scales at (Position of UnMurlocTiderunnerLocation)
      • Wait 20.00 seconds
      • Set ReMurlocTiderunner = (Random point in IS Outset Island Murloc and Wood Spawn <gen>)
      • Unit - Create 1 Murloc Tiderunner for Neutral Hostile at ReMurlocTiderunner facing (Random real number between 0.00 and 360.00) degrees
      • Custom script: call RemoveLocation(udg_UnMurlocTiderunnerLocation)
      • Custom script: call RemoveLocation(udg_ReMurlocTiderunner)
The first variable (UnMurlocTiderunnerLocation) is a unit, and the second (ReMurlocTiderunner) is a point, that's correct right?
 
Last edited:
Level 21
Joined
Aug 21, 2005
Messages
3,699
Well you've basically answered your problem. Here's what you do:

UnMurlocTiderunnerLocation is a unit
RemoveLocation() cleans up a point leak.

RemoveLocation(udg_UnMurlocTiderunnerLocation) is cleaning up a point (in jass this is called "location", hence why it's called "RemoveLocation" instead of "RemovePoint"), but discovers that UnMurlocTiderunnerLocation is a unit. You can't remove a unit with RemoveLocation, logically.

The correct trigger is:
  • MurlocTiderunner
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Murloc Tiderunner
  • Actions
    • Hero - Add 1 experience to (Killing unit), Show level-up graphics
    • Set UnMurlocTiderunnerLocation = Position of (Dying unit)
    • Item - Create Murloc Tiderunner Scales at UnMurlocTiderunnerLocation
    • Wait 20.00 seconds
    • Custom script: call RemoveLocation(udg_UnMurlocTiderunnerLocation)
    • Set UnMurlocTiderunnerLocation = (Random point in IS Outset Island Murloc and Wood Spawn <gen>)
    • Unit - Create 1 Murloc Tiderunner for Neutral Hostile at UnMurlocTiderunnerLocation facing (Random real number between 0.00 and 360.00) degrees
    • Custom script: call RemoveLocation(udg_UnMurlocTiderunnerLocation)
This time, UnMurlocTiderunnerLocation is a POINT variable, hence the fact it's called UnMurlocTiderunner LOCATION. Always name your variables wisely. Don't call a unit variable "Location" or a location variable "Unit"...
 
Status
Not open for further replies.
Top