• 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] Remove stored handles in hashtable

Status
Not open for further replies.
thats what i have but a mod says i need to remove locations before this..?

Ohh, but that's just simple leak fixing...
If you are using hashtables to store locations, you'd better store the coördinates...

I'll give you an example:


  • Actions
    • Hashtable - Save Handle Of(Center of (Playable map area)) as 0 of (Key (Triggering unit)) in (Last created hashtable)

OR:


  • Actions
    • Set Location = (Center of (Playable map area))
    • Hashtable - Save Handle OfLocation as 0 of (Key (Triggering unit)) in (Last created hashtable)
Well, in any case: you can't remove that location since you store it.
From the moment you remove the location, the stored location will also be removed, thus the entire spell (or whatever it is you are doing) fails.
However, reals aren't removed when a location is removed, thus it's best to do something like this:


  • Actions
    • Set Location = (Center of (Playable map area))
    • Hashtable - Save (X of Location) as 0 of (Key (Triggering unit)) in (Last created hashtable)
    • Hashtable - Save (Y of Location) as 1 of (Key (Triggering unit)) in (Last created hashtable)
    • Custom script: call RemoveLocation(udg_Location)
Now it removes the leak caused by the handle (in this case the location), while the stored data still remains.

To recall the data, simply do something like this:

  • Actions
    • Set Location = (Point((Load 0 of (Key (Picked unit)) from (Last created hashtable)), (Load 1 of (Key (Picked unit)) from (Last created hashtable))))
(this can be done with the "Convert coördinates to point" function).

(If you did not know about removing leaks yet, leaks are the main cause of lag and may slow down the game or even make it crash.
Read this post to see what leaks and how to fix it).


If I am completely wrong, please explain a bit further ^^
 
Status
Not open for further replies.
Back
Top