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

Well I was trying to create a hashtable per unit every time it casted the spell so a spell is MUI and SUI (Same Unit Instanceable).

How would you create only 1 hashtable per spell??? Explain everything! :grin:
This was the original question about this whole indexing thing. He wants one unit be able to cast the spell more than once at the same time.

And I got my hashtable information from that first news thread about it I think. I think DSG said hashtables are at least two times slower than arrays.
 

Rmx

Rmx

Level 19
Joined
Aug 27, 2007
Messages
1,164
I only know that if you Recycle the indexes it will be much better.

Recycling indexes is very good and also i am 100% sure that Paladon system Recycles those indexes, but only when there is no active instance, and it isn't Dangerous at all.

Also if you are efficiency freak, you could recycle the indexes much faster way, the usual reducing indexes until it reaches 0 and turn off, diffrent than Paladon's sys.

And if you are SO Freakich in efficiency and you have a very LARGE map, then go use hashtables or purplepoot indexing kinda spell.
 
Level 2
Joined
Feb 13, 2009
Messages
20
Hashtables can have an infinite number of indices, however, which is more than you can say for vJass 2D arrays.

the hashtable has 2 indices, parent value and child value, so is a 2d array

unlimited yes but still a 2d array

There are some things which are quite hard to do with just structs, for example if you need a separate timer for each instance of the spell. These things are much easier to do with hashtables.

since strict is really a sophisticated indexing system.
you can put the timer in the struct and have a timer for each instance of the spell


the biggest advantage I see to hashtables is that you can use the unit handle as your index, thus eliminating the need to somehow keep track of your index
 
Last edited:
the hashtable has 2 indices, parent value and child value, so is a 2d array

unlimited yes but still a 2d array
I didn't say "a hashtable can have an unlimited number of dimensions", I said "a hashtable can have an unlimited amount of indices". Get your English right.

since strict is really a sophisticated indexing system.
you can put the timer in the struct and have a timer for each instance of the spell


the biggest advantage I see to hashtables is that you can use the unit handle as your index, thus eliminating the need to somehow keep track of your index
No, the struct is not a really sophisticated indexing system, and what I meant by what I said, is that you can easily use hashtables to attach structs to units, timers, etc.
 
Level 6
Joined
Mar 8, 2007
Messages
192
Awesome, i just created withih 5 minutes an "system" with that i can set the duration of a buff and call it whenever i want.
Now i can set the duration of a buff and even stack buffs and other awesome things, without even breaking a sweat. More awesome spells here i come.
 
Level 10
Joined
Sep 21, 2007
Messages
517
Hmm, interesting; though a personal question, even though i dont use UMSWE and such improved WE´s, i want to ask just what exactly are all the advantages does this have over UnitIds (GetUnitID etc)? Since you can store variables by attaching ids and recycling them by removing them and or replace them.

Thanks for your time.
 
Level 2
Joined
Feb 13, 2009
Messages
20
Hmm, interesting; though a personal question, even though i dont use UMSWE and such improved WE´s, i want to ask just what exactly are all the advantages does this have over UnitIds (GetUnitID etc)? Since you can store variables by attaching ids and recycling them by removing them and or replace them.

Thanks for your time.

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.
 
Level 2
Joined
Feb 13, 2009
Messages
20
Interesting, thank u very much, but does it really have no limit? because that may be the motive for me to use hashtables and dl umswe!

Thanks for ur time once again t.t

yes, the index is unlimited, so you can directly use a handle ID as your index.

HashTables functions are native code and included in the GUI .......... USMWE isn't required, nor NewGen

Just log in to B.net to get the autopatch to 1.24
 
Level 1
Joined
May 24, 2009
Messages
6
Great tutorital :) I got all about hashtables now. It´s very usefull indeed.

I am going to use hashtables in my maps from now on.
 
Level 8
Joined
Nov 2, 2007
Messages
160
Great Tut but there is a memory leak in the sixth trigger:

  • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by KnockbackDistance towards KnockbackAngle degrees)
Should be:

  • Set temp_point = (Position of (Picked unit)
  • Unit - Move (Picked unit) instantly to temp_point offset by KnockbackDistance towards KnockbackAngle degrees)
  • Custom script: call RemoveLocation (udg_temp_point)
 
Level 16
Joined
Jun 25, 2008
Messages
1,043
Yeah.. and he also wrote this under it:
As a final note, these triggers are merely examples. As you may or may have not noticed, the knockback trigger would require memory leak fixing since it leaks 25 locations each second for every unit that is being knocked backward. I intentionally left the triggers how they are so they would be easier to understand. Those who wish to use these kinds of triggers in their maps should make sure to fix any memory leaks that were not cleaned up in the examples.
 
Level 2
Joined
Aug 7, 2009
Messages
13
all i can say is WOW this was easy with your tut!!! I played with it and I was able to create Healing and Damaging using 2 different hashtables.
please consider doing a whole series of tut using the hashtables for us beginners/learners

thanks
 
Level 18
Joined
Mar 13, 2009
Messages
1,411
Warning: First off, in order for the code in this tutorial to work you must be using the beta 1.24 patch available on the Westfall server. This tutorial covers a new type introduced in the upcoming patch that is not currently available in the current patch (1.23).

You might want to adjust this now since it's old news :p
 
Top