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

Destroy location and hashtable

Status
Not open for further replies.
Level 4
Joined
Jan 5, 2014
Messages
79
I have something like this:

Set TempPoint1 = somewhere
Create 1 unit of some type at TempPoint1
Save Handle of TempPoint1 as 0 of last created unit in Hash
call RemoveLocation(udg_TempPoint1)

and the custom script seems to erase even the point from the hashtable. Is it really possible, or have I done something else wrong?
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Yes it works like that.
Variables just point to things they are assigned to - in this case, the variable TempPoint1 points to the location you created.

If you do "Save Handle of TempPoint1 as 0 in Hash" then both TempPoint and the handle saved in Hashtable point to the same thing. So if you delete the location via custom script, both variable and the handle inside hash will point to nothing (since the location has been destroyed).
 
Level 4
Joined
Jan 5, 2014
Messages
79
And if i did this:

Set TempPoint1 = somewhere
Create 1 unit of some type at TempPoint1
Save Handle of TempPoint1 as 0 of last created unit in Hash
Set TempPoint1 = somewhere else
call RemoveLocation(udg_TempPoint1)

Than it wouldn't erase it from the hash, am I right?
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
yes it wouldn't erase the one in hashtable, but there's no reason to create new location and delete it.

If you don't want TempPoint1 to point anywhere once you save the location inside hashtable, then change this
  • Custom script: call RemoveLocation(udg_TempPoint1)
into this line:
  • Custom script: set udg_TempPoint1 = null
The line I wrote will make TempPoint1 point to nothing, but the location it previously pointed to will remain.
 
Level 4
Joined
Jan 5, 2014
Messages
79
yes it wouldn't erase the one in hashtable, but there's no reason to create new location and delete it.

If you don't want TempPoint1 to point anywhere once you save the location inside hashtable, then change this
  • Custom script: call RemoveLocation(udg_TempPoint1)
into this line:
  • Custom script: set udg_TempPoint1 = null
The line I wrote will make TempPoint1 point to nothing, but the location it previously pointed to will remain.

OK, thank you
 
Status
Not open for further replies.
Top