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

Hashtables and MUI

Level 5
Joined
Jan 27, 2007
Messages
154
I pretty understood how hashtable works thanks to this tut.. But the problem is when you do things by your own, im completely clueless how to work hastable out.

And what happens if you clear the parent hash? and what's the difference of clearing parent and child? isn't it better to clear the child? also, if you would just delete a point/location then does it mean that hashtable is usesless when your trigger contains point/location? So you'll just use indexing for the point? But then again isn't Hash better..

It really gets confusing when you're doin the hash alone.

Or I would just post my spell and ask people how to screw the hash on it?
 
Last edited:
So... if this does what i think it does... it can be used as a save system for orpg maps? O.ô

If you're thinking about saving the data in the hashtable, quit the game then start again and type a load code or something to retrieve the data... then NO... I heard the data stored in the hashtable is deleted after the game ends so you cannot retrieve anything you stored in the hashtable after quiting the game....

You cannot even use hashtables for transitions in campaigns..
 
Level 2
Joined
Mar 4, 2008
Messages
26
And I've been using custom value of unit in array variables to keep track of data for specific units in my map... thanks for the tutorial.
 
Level 12
Joined
Feb 23, 2008
Messages
587
Eh, I dont fully get it.
I learned in class hash tables were primarily used to accuses data quickly, but that is not in order.
Is the concept of using this better for MUI purposes? Storing more things that's allowed then in a array?
I don't fully see the advantages in using it in a warcraft map. I also dont fully understand them. Ill try to reread what he has Typed down again...

*I found some stuff nm.
The major advantages of the hashtables are:

1) no limit on the index, arrays are limited to a max of 8190.

2) it's two dimensional

3) you can get the handle Id of most any object.

4) If your not sure where your value is stored in a array, using a hash tables can bring you straight to it.

5) For GUI Easier To get MUI Functions.
 
Level 4
Joined
Jan 29, 2007
Messages
98
how do you set "keys"? when I try to use the hashtable and pick the preset key is looks for some handle variable, then I try to create a handle variable but I can only set it to another handle variable..... I don't kinda understand, but take note that I haven't tried to proceed from there...

Yeah, I don't either understand how you go the "(Key (Target unit of ability being cast))" here:
  • Hashtable - Save 10.00 as 0 of (Key (Target unit of ability being cast)) in hashTable
Since if I check that, even in the Hashtable Tutorial map in the first post, I still can't pick "(Target unit of ability being cast)"... What is wrong ?!
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Select Hashtable - Get Handle ID, and then click on Key (Last Created Unit). Browse for Event Response - Target unit of..

inst_1.jpg


If that does not work then try reisntalling.
 
Reinstalling what ?! :S

I've now been told that the GUI hashtables doesn't work with Newgen :S
Is that true ? :eek:

I think so because Newgen is what I use and when I click the Key(GetHandleID) the only menu that is present is that of the variables.... but anyways it works fine with JASS though the TESH i'm using right now doesnt have a list of the hashtable functions, I needed to make them in a blank GUI trigger then convert to custom script to get the functions....
 
Level 15
Joined
Nov 26, 2005
Messages
1,151
Ok, that tutorial is Really helpful!! Thanks to the creater! (+rep)

But I have 2 questions:
1. WE Unlimited does not support hastables and does not load a map with these functions. Is there a version of WEU that does support them ?

2. Edit: Figured it out.
 
Level 9
Joined
Sep 28, 2004
Messages
365
There is one thing i don't get it. RemainingTime is global var. So if i cast a 2nd healing over time within 10seconds. the 1st unit who benefit from it will get have its Healing over time reset to 10? Since storing the hashtable value to a global var which is 10 and it will reset the condition. Correct me if i am wrong.
 
There is one thing i don't get it. RemainingTime is global var. So if i cast a 2nd healing over time within 10seconds. the 1st unit who benefit from it will get have its Healing over time reset to 10? Since storing the hashtable value to a global var which is 10 and it will reset the condition. Correct me if i am wrong.

If I'm right....

If you are talking about if casting the spell into another unit will reset the first unit's timer then no because the actions of the periodic event happens in a loop with instant actions so every run will not override the other..... and for every run of the loop the variable RamainingTime gets its value changed depending on the stored value in the hashtable that are specific for each unit..

but if you're asking about if the spell is casted into the same unit then the timer will go back to 10 for that unit....
 
Level 1
Joined
Feb 7, 2010
Messages
2
oh! then in that case i think i know why, its because it creates a key for every single unit that casts the spell but it wont leak beacuse u kill the child keys. then... its damn powerful....
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
The healing doesn't stack, meaning you won't get 2x HP. The timer gets renewed if the heal is still going on, since you overwrite the timer value. So if you have 2 seconds of healing time left and the spell is cast on the same unit again, the timer will be set to 10 again.

It is possible to code it to stack by using integers for example, to keep track how many instances of the spell are running on the unit at the same time.
 
Level 10
Joined
Feb 20, 2008
Messages
448
well i have read the whole tutorial and i found it uncomplete : i tryed few time to make complicated spell in hashtable which caused strange but like : if there is no picked unit in group the part of the spell wont run and the spell will end + hashtable has been found slower than integer , they arent so e-z to use or any faster : The dynamic index found in hanke template can made spell mui in a copy, paste and variable renaming.....

hashtable are good but i still think poeple should learn indexing or index their hashtable or even BETTER USE vJass :D
 
Level 13
Joined
Sep 29, 2008
Messages
671
I have an problem, i can't get that handle ID like picked unit or target unit of ability being cast.

you meant this?:
newgenhash.gif


maybe you could try this:
I don't know if this will work but you can try extracting the UI folder from war3patch.mpq and placing it in your warcraft folder.
This should update your GUI functions and such.
As for an updated TESH, download horus. It's just a lame name for an updated TESH.

I tried updating that Tesh and it worked for a while but suddenly it bugs again that's why i just use normal WE when using hastables now. but it might work for you hopefully... :D
 
Level 5
Joined
May 27, 2007
Messages
162
probably the most informative tutorial on this site.

I only do War3 modding in GUI. But I do know some scripting and programming languages, just havn't been so bothered with Jass.

So, thanks to this, I can now do fancy stuff in my maps without having to bother Pharaoh_ or other people who reply to me on the World Editor Help Zone :).
 
Level 9
Joined
Oct 11, 2009
Messages
477
Not only with healing and knockback spells Hashtables will do..... But also you can create a GUI MUI Tree Revival System like this and it only requires 2 triggers and one(1) Hashtable global:

  • Initialize Tree Revival Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set TreeRevivalHashtable = (Last created hashtable)
      • Destructible - Pick every destructible in (Entire map) and do (Actions)
        • Loop - Actions
          • Hashtable - Save 0 as (Key tree counter) of (Key (Picked destructible)) in TreeRevivalHashtable
  • Tree Revival
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Set EntireMap = (Entire map)
      • Destructible - Pick every destructible in EntireMap and do (Actions)
        • Loop - Actions
          • Set TreeRevivalLocation = (Position of (Picked destructible))
          • Set TreeRevivalGroup = (Units within 300.00 of TreeRevivalLocation matching (((Matching unit) is alive) Equal to True))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in TreeRevivalGroup) Equal to 0
              • ((Picked destructible) is dead) Equal to True
            • Then - Actions
              • Custom script: call RemoveLocation(udg_TreeRevivalLocation)
              • Custom script: call DestroyGroup(udg_TreeRevivalGroup)
              • Hashtable - Save ((Load (Key tree counter) of (Key (Picked destructible)) from TreeRevivalHashtable) + 3) as (Key tree counter) of (Key (Picked unit)) in TreeRevivalHashtable
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load (Key tree counter) of (Key (Picked destructible)) from TreeRevivalHashtable) Greater than TIME INTERVAL OF TREE REVIVAL
                • Then - Actions
                  • Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Show birth animation
                  • Hashtable - Save 0 as (Key tree counter) of (Key (Picked destructible)) in TreeRevivalHashtable
                • Else - Actions
            • Else - Actions
              • Custom script: call RemoveLocation(udg_TreeRevivalLocation)
              • Custom script: call DestroyGroup(udg_TreeRevivalGroup)
      • Custom script: call RemoveRect(udg_EntireMap)
 
Last edited:
Level 5
Joined
May 27, 2007
Messages
162
Couldn't you do the exact same thing with:

Every 3 minutes of game time
custom script set bj want destroy group = true
pick every destructible matching, type equal to tree and matching, condition boolean:: dead equal to true
replace picked destructible with tree living.
 
Level 9
Joined
Oct 11, 2009
Messages
477
Couldn't you do the exact same thing with:

Every 3 minutes of game time
custom script set bj want destroy group = true
pick every destructible matching, type equal to tree and matching, condition boolean:: dead equal to true
replace picked destructible with tree living.



Picking destructibles is not like picking units... When you are trying to revive a destructible, the WC3 engine understood that the destructible is a tree because trees are the only destructible can be revived. The condition of the trees must be in another loop and why did you created that damn custom script line: set bj_wantDestroyGroup = true since the objects I picked are not units. So don't create that line for two reasons:
1. They are not units
2. Picking destructibles don't create irritating leaks... Got it?
 
Last edited:
Level 2
Joined
Jun 22, 2010
Messages
7
Greate tutorial. I have tried to find a good MUI tutorial in the last couple of days, but it was with arrays and i didn't understand the hole thing.. I total understood this, so thank you very much. Can finally create MUI spells :thumbs_up:...
 
Top