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

Status
Not open for further replies.
Level 11
Joined
Dec 8, 2006
Messages
334
I just found out I can't use certain actions involving hashtables. Mostly when trying to save some types of handles (for example, Hashtable - Save ability handle)
I can open the action window:

Hashtable - Save handle of Ability as Value of Value in (Last created hashtable)

When I click to fill Ability value, the World Editor just crashes.

I tried to google for solution and found out that there are some more people having the same problem, but solution was nowhere to be found.
Does anyone know what's going on?

Also, how would I put that action into a custom script? Maybe it won't crash then
 
Last edited:
This the way:
  • Custom script: set udg_Ability = GetSpellAbilityId() //Ability is an Integer variable, so the next action is Hashtable - Save Integer.
  • Hashtable - Save Ability as (Key rawcode) of (Key (YourKey)) in Hashtable
Load example:
  • Custom script: call UnitAddAbility (udg_Unit1, (LoadInteger(udg_Hashtable, GetHandleId(udg_Unit), StringHash("rawcode"))))
"Unit" is a Handle variable.

And yes, those problems occur to every World Editor; it's because Blizzard never finished them.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
Its cause the designer of GUI had some problem and messed up big time. When the poor patch team went to maintain it they added what would be logical but it turned out that GUI did not support those types cause of what I said eariler. Thus it crashes cause of an error due to the types not existing.

What in GUI is called an ability in real life (the jass WC3 uses) is actually an integer, while what the hashtable refers to as an ability is infact an ability type. Ability type was not fully implimented and even in JASS has no real use but it is totally unusable in GUI (nothing for it is present) however the hashtable actions represent this form of Ability instead of the rewrapped integer that GUI calls an ability.

A simple mistake. If the maker of GUI made it more logically this would never have happened.

Its just like what GUI calls regions are actually rects while regions are comprised of cells and rects and are a totally different type.
 
Level 11
Joined
Dec 8, 2006
Messages
334
Cool, thanks! I almost re-installed the warcraft, silly me!
But one thing I don't get:
  • Custom script: set udg_Ability = GetSpellAbilityId()
What do I put in there? The custom script gets Ability ID, but how do I choose which Ability ID I need?

What I'm aiming for: I need to declare ability types when player picks a hero... Currently it looks like this

  • Set AbilityType[1] = Abolish Magic
  • Set AbilityType[2] = Cripple
  • Set AbilityType[3] = Polymorph
  • Set AbilityType[4] = Rejuvenation
And so on...

I just need 2-dimensional array, cuz I have more than just one player
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
The formula for a 2D array is.
D1*DM2+D2
D# = the index
DM# - the max number of indicies for a demension

like wise for 3D arrays.
D1*DM2*DM3+D2*DM3+D3

This is better for small scoop indicies with common fixed demensions. For example I advise this if you have 5 abilities per hero and X number of heroes. In that case the formula would be heroindex*5+abilityindex where heroindex is in the range of 0 to 1637 (inclusive) and abilityindex in the range of 0 to 4 (inclusive).
 
Status
Not open for further replies.
Top