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

Questions about clearing hashtables/ unit groups

Status
Not open for further replies.
Level 7
Joined
Nov 19, 2015
Messages
283
Is a unit dies an effective event for clearing the child key of a hashtable?
Does a unit with an expiration timer die?
I assume unit removed from game would not count as dying??

Many of my triggers add a unit to a unit group. Is it better to create a group when it doesn't exist and then destroy it when it has no units in it.
For hashtables, would it be better to clear the parent when empty and recreate?
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
A unit removed from the game has no chance of getting the handle id from... nor anything else.

A unit dies does not always happen... for example when "Remove <unit>" is done in a trigger.

One thing that could work properly is to use a unit indexer with a proper de-index event.
However, the unit is by then already removed and you only have the index.



It is better to re-use the group every time instead of creating a new one... same for a hashtable.
 
Status
Not open for further replies.
Top