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

Hashtable - Save Ability

Status
Not open for further replies.
SaveAbilityHandleBJ() is the one.

But that isn't what you're looking for. The "ability" object isn't actually used for anything. The only function that makes an "ability" handle is GetSpellAbility(), but there aren't any other functions that deal with that type (apart from hashtables). Hence, it is mostly useless.

Almost all functions pertaining to abilities will actually use integers, or more specifically, the rawcodes of the abilities. If you navigate to the object editor, press CTRL+D to show the rawcode value of objects. For example, 'hfoo' is footman. When you create a new ability, it usually starts off at 'A000' unless you specify otherwise.

As such, you only need to save the rawcode. That is all you'll be using for GUI and JASS. Even those GUI functions that bring up a big list of abilities will just translate to rawcodes.

P.S. Moved to WEHZ. JASS Class is for questions pertaining to the actual forum/class. ;)
 
Level 5
Joined
Sep 11, 2010
Messages
56
SaveAbilityHandleBJ() is the one.

But that isn't what you're looking for. The "ability" object isn't actually used for anything. The only function that makes an "ability" handle is GetSpellAbility(), but there aren't any other functions that deal with that type (apart from hashtables). Hence, it is mostly useless.

Almost all functions pertaining to abilities will actually use integers, or more specifically, the rawcodes of the abilities. If you navigate to the object editor, press CTRL+D to show the rawcode value of objects. For example, 'hfoo' is footman. When you create a new ability, it usually starts off at 'A000' unless you specify otherwise.

As such, you only need to save the rawcode. That is all you'll be using for GUI and JASS. Even those GUI functions that bring up a big list of abilities will just translate to rawcodes.

P.S. Moved to WEHZ. JASS Class is for questions pertaining to the actual forum/class. ;)

Okay. My spell involves loading variables from the hashtable, which requires loading an Ability.

How can i register an ability via that?
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
It would be easier to help if you could be more specific about what you are trying to do with a spell/custom ability.

In any case, you can use a general unit event like unit casts a spell, check the spells rawcode against what you are looking for, and then do whatever arbitrary code you wish to make the spell effect/ability.

For saving variables, you can use global data structures like a global hashtable, or if you are feeling lazy, you could just use Bribe's Table.
 
Level 5
Joined
Sep 11, 2010
Messages
56
It would be easier to help if you could be more specific about what you are trying to do with a spell/custom ability.

In any case, you can use a general unit event like unit casts a spell, check the spells rawcode against what you are looking for, and then do whatever arbitrary code you wish to make the spell effect/ability.

For saving variables, you can use global data structures like a global hashtable, or if you are feeling lazy, you could just use Bribe's Table.

Making a constant. I just have to register a specific ability, upon a hashtable.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Use the ability's integer id (rawcode) as a hashtable key, for example, for saving an integer value: call SaveInteger(udg_HashTable, Ability_Id, 0, integer value).

Here's an exhaustive list of what type the hashtable can store:
JASS:
native SaveInteger takes hashtable table, integer parentKey, integer childKey, integer value returns nothing
native SaveReal takes hashtable table, integer parentKey, integer childKey, real value returns nothing
native SaveBoolean takes hashtable table, integer parentKey, integer childKey, boolean value returns nothing
native SaveStr takes hashtable table, integer parentKey, integer childKey, string value returns boolean
native SavePlayerHandle takes hashtable table, integer parentKey, integer childKey, player whichPlayer returns boolean
native SaveWidgetHandle takes hashtable table, integer parentKey, integer childKey, widget whichWidget returns boolean
native SaveDestructableHandle takes hashtable table, integer parentKey, integer childKey, destructable whichDestructable returns boolean
native SaveItemHandle takes hashtable table, integer parentKey, integer childKey, item whichItem returns boolean
native SaveUnitHandle takes hashtable table, integer parentKey, integer childKey, unit whichUnit returns boolean
native SaveAbilityHandle takes hashtable table, integer parentKey, integer childKey, ability whichAbility returns boolean
native SaveTimerHandle takes hashtable table, integer parentKey, integer childKey, timer whichTimer returns boolean
native SaveTriggerHandle takes hashtable table, integer parentKey, integer childKey, trigger whichTrigger returns boolean
native SaveTriggerConditionHandle takes hashtable table, integer parentKey, integer childKey, triggercondition whichTriggercondition returns boolean
native SaveTriggerActionHandle takes hashtable table, integer parentKey, integer childKey, triggeraction whichTriggeraction returns boolean
native SaveTriggerEventHandle takes hashtable table, integer parentKey, integer childKey, event whichEvent returns boolean
native SaveForceHandle takes hashtable table, integer parentKey, integer childKey, force whichForce returns boolean
native SaveGroupHandle takes hashtable table, integer parentKey, integer childKey, group whichGroup returns boolean
native SaveLocationHandle takes hashtable table, integer parentKey, integer childKey, location whichLocation returns boolean
native SaveRectHandle takes hashtable table, integer parentKey, integer childKey, rect whichRect returns boolean
native SaveBooleanExprHandle takes hashtable table, integer parentKey, integer childKey, boolexpr whichBoolexpr returns boolean
native SaveSoundHandle takes hashtable table, integer parentKey, integer childKey, sound whichSound returns boolean
native SaveEffectHandle takes hashtable table, integer parentKey, integer childKey, effect whichEffect returns boolean
native SaveUnitPoolHandle takes hashtable table, integer parentKey, integer childKey, unitpool whichUnitpool returns boolean
native SaveItemPoolHandle takes hashtable table, integer parentKey, integer childKey, itempool whichItempool returns boolean
native SaveQuestHandle takes hashtable table, integer parentKey, integer childKey, quest whichQuest returns boolean
native SaveQuestItemHandle takes hashtable table, integer parentKey, integer childKey, questitem whichQuestitem returns boolean
native SaveDefeatConditionHandle takes hashtable table, integer parentKey, integer childKey, defeatcondition whichDefeatcondition returns boolean
native SaveTimerDialogHandle takes hashtable table, integer parentKey, integer childKey, timerdialog whichTimerdialog returns boolean
native SaveLeaderboardHandle takes hashtable table, integer parentKey, integer childKey, leaderboard whichLeaderboard returns boolean
native SaveMultiboardHandle takes hashtable table, integer parentKey, integer childKey, multiboard whichMultiboard returns boolean
native SaveMultiboardItemHandle takes hashtable table, integer parentKey, integer childKey, multiboarditem whichMultiboarditem returns boolean
native SaveTrackableHandle takes hashtable table, integer parentKey, integer childKey, trackable whichTrackable returns boolean
native SaveDialogHandle takes hashtable table, integer parentKey, integer childKey, dialog whichDialog returns boolean
native SaveButtonHandle takes hashtable table, integer parentKey, integer childKey, button whichButton returns boolean
native SaveTextTagHandle takes hashtable table, integer parentKey, integer childKey, texttag whichTexttag returns boolean
native SaveLightningHandle takes hashtable table, integer parentKey, integer childKey, lightning whichLightning returns boolean
native SaveImageHandle takes hashtable table, integer parentKey, integer childKey, image whichImage returns boolean
native SaveUbersplatHandle takes hashtable table, integer parentKey, integer childKey, ubersplat whichUbersplat returns boolean
native SaveRegionHandle takes hashtable table, integer parentKey, integer childKey, region whichRegion returns boolean
native SaveFogStateHandle takes hashtable table, integer parentKey, integer childKey, fogstate whichFogState returns boolean
native SaveFogModifierHandle takes hashtable table, integer parentKey, integer childKey, fogmodifier whichFogModifier returns boolean
native SaveAgentHandle takes hashtable table, integer parentKey, integer childKey, agent whichAgent returns boolean
native SaveHashtableHandle takes hashtable table, integer parentKey, integer childKey, hashtable whichHashtable returns boolean
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
rawcodes are integers, don't worry, e.g.:
JASS:
call SaveInteger(udg_HashTable, Ability_Id, 0, 'Avul')
 
Level 5
Joined
Sep 11, 2010
Messages
56
rawcodes are integers, don't worry, e.g.:
JASS:
call SaveInteger(udg_HashTable, Ability_Id, 0, 'Avul')

I still don't get it.

And why is that, it only has 1 number? It was supposed to have 2, and why is that it has a "avul"?

Will you please just put this in a demo map? it's very very confusing. And again, the constant must be loaded in the hashtable.
 
I still don't get it.

And why is that, it only has 1 number? It was supposed to have 2, and why is that it has a "avul"?

Will you please just put this in a demo map? it's very very confusing. And again, the constant must be loaded in the hashtable.

Go to your Object Editor in Ability tab and hit Ctrl + D. Those are the rawcodes of the ability and they are integers. Avul for example is the Invulnerable unit ability.
Therefore, as Purgeandfire and chobibo said, you will use SaveInteger and then LoadInteger to load the ability.
 
Level 5
Joined
Sep 11, 2010
Messages
56
Go to your Object Editor in Ability tab and hit Ctrl + D. Those are the rawcodes of the ability and they are integers. Avul for example is the Invulnerable unit ability.
Therefore, as Purgeandfire and chobibo said, you will use SaveInteger and then LoadInteger to load the ability.

I know how to do that ctrl + d thing, i don't get is how their codes work.
 
I know how to do that ctrl + d thing, i don't get is how their codes work.

Then you need to know more about hashtables.
SaveInteger (whichHashtable, whereToBeSaved, howIsItSaved, whatIsSaved).

  • whichHashtable: your hashtable
  • whereToBeSaved: a handle, e.g. a unit, an item, the playable map area or even a static integer
  • howIsItSaved: the recognizing integer (or string) that allows you to identify which stored object is associated with it. Let's say 0 is for a unit, 1 is for the level of the ability, 2 is for the damage. This is useful upon loading ((LoadInteger (udg_Hash, GetHandleId(GetEnumUnit()), 0) --> according to the example values above, this will retrieve a unit; if "0" is "1", it will retrieve the level of the ability instead).
  • whatIsSaved: what are you saving, the level of the ability, the ability rawcode, the number of units created, etc.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
'Avul' is a number represented in the 256-character number system that blizzard's jass use, that must be the reason to as why you are confused about it bearing letters. It's just like hexadecimal numbers if you are aware of those, that system uses A,B,C,D,E and F to represent the value 10 to 15.

Anyway, are you using GUI triggers?
 
Level 5
Joined
Sep 11, 2010
Messages
56
'Avul' is a number represented in the 256-character number system that blizzard's jass use, that must be the reason to as why you are confused about it bearing letters. It's just like hexadecimal numbers if you are aware of those, that system uses A,B,C,D,E and F to represent the value 10 to 15.

Anyway, are you using GUI triggers?

Yes, i'm using GUI triggers. Anyways it's all good now; http://www.hiveworkshop.com/forums/spells-569/gui-take-aim-dynamic-range-change-254595/
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
why is that it has a "avul"?

Blizzard has a (somewhat) productive language for naming the standard objects, sort of based on the object's in game name (unam, anam, bnam, dnam, etc.).

In general it appears many abilities use the prefix "A" followed by three letters that seem to correlate with the syllable receiving the primary stress.

Thus the invulnerability ability is really "Ability Invulnerable" which would then be 'Avul.'

Likewise, the wander ability is 'Awan.'

I'm not sure how far you can get with their systems of prefixes. I would always check the rawcode of the object in the editor rather than guess it smartly, but its useful to know if you want to try to interpret some rawcodes that you haven't seen before.
 
Status
Not open for further replies.
Top