• 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] Help with Leaks and Locations

Status
Not open for further replies.
Level 10
Joined
Oct 2, 2014
Messages
215
I tried to make a Trigger that at the time 20 in-game, 6 creatures called Forgotten spawn randomly on the map. I did it, but it was extremely simple and it leaked, so I (For the first time) decided to fix the leaks, but now the Forgotten just spawn in the centre of the map.

241022-albums8225-picture106323.png


Does anyone know how to fix or make a trigger that'll spawn Forgotten randomly around the map that is leak-less?
(Random_Area= Region Variable)
 
(Playable map area) is actually a region that is initialized once at the start of the game. You don't need to remove that rect, you can keep reusing it. :)

However, (Random point in <rect>) does leak. Most points (also known as "locations") will leak if you do not clear them manually. Here is an example of how to do it:
  • For each (Integer A) from 1 to 6, do (Actions)
    • Loop - Actions
      • Set Random_Point = (Random point in (Playable map area))
      • Unit - Create 1 Forgotten for Neutral Hostile at Random_Point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_Random_Point)
Here is a great reference for memory leaks:
http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/memory-leaks-263410/
 
Level 10
Joined
Oct 2, 2014
Messages
215
Thank you! So much. Could I ask you if triggers similar to this one don't work?

Also when you destroy the Variable (In a sense) you said to RemoveLocation, but when I tried to save the map, it said it can't be converted to Rect. Should I change Location to Rect?
 
Last edited:
Status
Not open for further replies.
Top