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

[Spell] Help with hashtables and MUI

Status
Not open for further replies.
Level 1
Joined
Mar 3, 2021
Messages
1
Hey, I usually use arrays to make my spells MUI, however I wanted to check out hashtables recently, since working with the handle ID of things seems like it could be very useful in a lot of cases. Arrays can also become a bit of a pain to deal with, especially if multi arrays are needed.

Hence I have read both A Complete Beginners Guide to Hashtables and Hashtables and MUI

I had no particular issue understanding those, however the examples given in them are very rudimentary and now, while trying to make a slightly more complex spell with this method, I'm a bit stuck.

Here is the spell I want recreate with hashtables to be MUI (I intentionally removed anything that isn't 100% necessary including cleaning leaks for better visibility):

unknown.png

unknown.png


My first and I suppose central problem right now is how to save the caster so it can be referenced in the loop. So any tips on that would be appreciated.

Even better would be if someone could actually make me a version of this spell with hashtables and in MUI, so I can look at it and see directly how it could be done. Or maybe if someone could just link to a spell on Hive that is somewhat similar in nature.

I will also attach a testmap that contains what is shown in the screenshots.
 

Attachments

  • hash_mui_example.w3x
    467.1 KB · Views: 17

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
You can save SpellDummy in a SpellDummyGroup. Then you save the data of the spell to the hashtable using the Handle ID of the SpellDummy as the key. Then when you need to loop through all currently active casts, simply loop over the SpellDummyGroup and access all the spell data back using the Handle ID of the Enumed Unit.
 
Level 13
Joined
Jul 12, 2018
Messages
510
Hashtable: Save unit handle is a GUI action, and then Hashtable - load unit handle to reference it.

the hashtable has to already be created when you do this of course, i create my hashtables in one of the init triggers that run at the start of the map.
 
Status
Not open for further replies.
Top