Clearing Hashtables

Sil3nt

SUP?
Reaction score
134
I've read through a few threads but I'm still not very sure about whether or not hashtables need to be cleared, or when. Take these 2 triggers of mine for example:

Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Percentage life of (Picked unit)) Less than or equal to 40.00
    • Then - Actions
      • Special Effect - Create a special effect attached to the weapon, left of (Picked unit) using Abilities\Spells\Orc\TrollBerserk\HeadhunterWEAPONSLeft.mdl
      • Hashtable - Save Handle Of(Last created special effect) as (Key effect1) of (Key (Picked unit)) in hashTable_berserker_blood
      • Special Effect - Create a special effect attached to the weapon, right of (Picked unit) using Abilities\Spells\Orc\TrollBerserk\HeadhunterWEAPONSLeft.mdl
      • Hashtable - Save Handle Of(Last created special effect) as (Key effect2) of (Key (Picked unit)) in hashTable_berserker_blood
    • Else - Actions
      • Special Effect - Destroy (Load (Key effect1) of (Key (Picked unit)) in hashTable_berserker_blood)
      • Special Effect - Destroy (Load (Key effect2) of (Key (Picked unit)) in hashTable_berserker_blood)


Should I be clearing the special effects from the hashtable after destroying it? How would I do it?
Trigger:
  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in hashTable_berserker_blood
    • <div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code"><div class="bbCodeBlock-title">Trigger:</div><div class="wc3trigger"><ul class="wc3" id="wc3_2">
    • <li class="lastopen"><span class="default">Hashtable - Clear all child hashtables of child (Key effect1) in hashTable_berserker_blood</span>
    • <ul>
    • <li class="lasttree"><span class="default">Hashtable - Clear all child hashtables of child (Key effect2) in hashTable_berserker_blood</span></li>
    • </ul>
    • </li>
    • </ul>
    • </div></div>
    • I assume I would use the first one only, right?
    • Another trigger
    • <div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code"><div class="bbCodeBlock-title">Trigger:</div><div class="wc3trigger"><ul class="wc3" id="wc3_3">
    • <li class="lastopen"><span class="default">Fervor</span>
    • <ul>
    • <li class="open"><span class="events">Events</span>
    • <ul>
    • <li class="lasttree"><span class="unit">Unit - A unit Is attacked</span></li>
    • </ul>
    • </li>
    • <li class="open"><span class="conditions">Conditions</span>
    • <ul>
    • <li class="lasttree"><span class="default">(Level of Fervor for (Attacking unit)) Greater than 0</span></li>
    • </ul>
    • </li>
    • <li class="lastopen"><span class="actions">Actions</span>
    • <ul>
    • <li class="lastopen"><span class="if">If (All Conditions are True) then do (Then Actions) else do (Else Actions)</span>
    • <ul>
    • <li class="open"><span class="if">If - Conditions</span>
    • <ul>
    • <li class="lasttree"><span class="default">(Triggering unit) Equal to (Load (Key target) of (Key (Attacking unit)) in hashTable_fervor)</span></li>
    • </ul>
    • </li>
    • <li class="open"><span class="ifthen">Then - Actions</span>
    • <ul>
    • <li class="lasttree"><span class="unit">Unit - Increase level of Fervor (Attack Speed Bonus 20%) for (Attacking unit)</span></li>
    • </ul>
    • </li>
    • <li class="lastopen"><span class="ifelse">Else - Actions</span>
    • <ul>
    • <li class="tree"><span class="default">Hashtable - Save Handle Of(Triggering unit) as (Key target) of (Key (Attacking unit)) in hashTable_fervor</span></li>
    • <li class="lasttree"><span class="unit">Unit - Set level of Fervor (Attack Speed Bonus 20%) for (Attacking unit) to 1</span></li>
    • </ul>
    • </li>
    • </ul>
    • </li>
    • </ul>
    • </li>
    • </ul>
    • </li>
    • </ul>
    • </div></div>
    • Should I be clearing the hashtable before overwriting it with another unit?
    • What if it were a location, unit group, or something that would normally need a custom script in GUI to clean? Would I need a &#039;temp_loc&#039; or anything like that at all if I&#039;m using hashtables?
    • Any help is appreciated!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top