• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

the Code field in AbilityData.slk

Status
Not open for further replies.
does this code definition reside in the executable, in the .dll ?
That is what I believe. For my Warsmash project where I try to emulate the game without the executables/dlls, I created a hard-coded list.

It is also possible to edit the code of abilities without editing the raw ability SLK, although it is time consuming to set up. Last time I tried it this actually worked -- you can modify the AbilityMetaData.slk used by the World Editor to decide what properties the Abilities have. If you import the modified file into your map as well as your editor, then it will not only add a code property to abilities inside your Ability Editor GUI, but it will actually apply so that ingame the ability's C++ class will be chosen based on your editor setting instead of only the SLK column.
 
hmm, i see then.
indeed i believe it would be possible to do things like combine all aura data to obtain a super-aura ability, or combine parts of different abilities through editing AbilityMetaData.slk

well, ive gotten my hands on a 1.28.5 installation, trying to change things through .slk placed into the War3Mod.mpq
as far i can see it works, for experimental purposes have tried to remove majority of the units etc. editor is still loading and test map functions as intended.
 
Level 28
Joined
Dec 3, 2020
Messages
970
That is what I believe. For my Warsmash project where I try to emulate the game without the executables/dlls, I created a hard-coded list.

It is also possible to edit the code of abilities without editing the raw ability SLK, although it is time consuming to set up. Last time I tried it this actually worked -- you can modify the AbilityMetaData.slk used by the World Editor to decide what properties the Abilities have. If you import the modified file into your map as well as your editor, then it will not only add a code property to abilities inside your Ability Editor GUI, but it will actually apply so that ingame the ability's C++ class will be chosen based on your editor setting instead of only the SLK column.
Under while folder would the world editor AbilityMetaData.slk file be?
Also, what do you mean "import the modified .slk file into your map"?
How do you import an .slk file and make it work??
Also wouldn't it already be working if you make a map through the world editor with the modified .slk file?
 
resideshere.png


it can be found here, in either war3 or war3x .mpq, dunno where it is today.
 
Level 28
Joined
Dec 3, 2020
Messages
970
Oh okay, I knew that! But thanks!
I thought there was a special folder for the world editor or something...
Anyway tell me, have you managed to change any .slk file without warcraft giving you bugs (not loading maps/crashing)?
Let me know when you do, even if you manage to do it in 3 years :D.
 
Level 28
Joined
Dec 3, 2020
Messages
970
I see. I think perhaps it can actually work if I enable/allow local files. I have to check it out!

EDIT: I learned how to do it. Just open the .slk files in a text editor (not notepad!) And voila, all changes you do will be saved and won't crash the game.
 
Last edited:
indeed i believe it would be possible to do things like combine all aura data to obtain a super-aura ability, or combine parts of different abilities through editing AbilityMetaData.slk
Unfortunately not. This is not how the code column works.

In Warcraft 3, each unit has a list of abilities. But we can be more technically specific: each Unit "kind" has a list of 4 letter rawcode IDs in the Unit Editor, and whenever a unit of that "kind" is created then that ingame unit instance will be automatically given abilities by looking up each of those 4-letter rawcodes to find which Ability "kind" has that 4 letter rawcode as their "alias" defining key in the list of Ability "kinds."

But, the unit who is created has abilities added that are also not on the list of 4-letter IDs. In this way, it might help to distinguish the concept of the Unit Editor field "Abilities - Normal" versus the concept of an individual ingame unit's list of abilities that he has by introducing a new word. In a PTR version of Patch 1.31 for a time there was a glitch that the JASS trigger function to print an ability's name would instead print the corresponding C++ class name of the ability of the unit and I used this for fun to learn a little more about how the system works. This led me to understand the idea of the new word I wish to add to our vocabulary for a moment: "CAbility."

So, a unit in the world ingame has a list of "CAbilities," but how are they different from what you think of as Object Editor Ability "kind" types?

The answer is that although there is no Jass/Trigger system to sensibly interact with CAbilities, I believe they are state containers and are unit specific, using subclassing in C++ where the subclasses have virtual method overrides that define what the ability does and are permitted to operate on the ability state.

So, for example, although Town Hall does not have anything related to training peasants in its "Abilities - Normal" Unit Editor setting, in that very first 1.31.0 PTR with this bug that can print out CAbility names for all of the CAbilities on a unit we can see that if we create a Town Hall then this unit ingame has CAbilityQueue.

The CAbilityQueue is a little bit like Spellbook in that it offers multiple icons, although these icons are not hidden behind a menu and correspond to unit types or available researches. If I have two Town Hall units in my game world, each one has its own CAbilities. In fact, due to a jass trigger behavior in "Scripts\Blizzard.j" it is the case that the first Town Hall that I ever had (created on startup for human players) will have the CAbilityCallToArms even though other Town Hall type units that I construct do not have this ability during play.
So, each Town Hall has its own list of CAbilities and these lists are independent. That is what I am using the word CAbility herein to refer to.

With that in mind, if I tell my first Town Hall to train three Peasants in the queue of up to 7 items then his CAbilityQueue will be storing the current progress of creating a peasant, as well as two other array entries for what it is going to train next. The CAbility is a state container, and CAbilityQueue literally has this queue of up to 7 items stored within it. So, if I click the Town Hall at my second Gold Mine location and tell this unit to research Backpack, then he will be storing the progress of Backpack inside of his CAbilityQueue. And so the two Town Halls in the code end up doing something different because they have distinct lists of CAbilities, and each CAbility that they have is a particular C++ class derived from the base CAbility class who implements its particular function.

"Thanks Retera for stating the obvious, but why are you telling us this?" you might ask me if you read this far. The answer is that CAbilityQueue::OnTick in the code is a derived method that pushes forward the progress of the front-most item in the queue on each tick of the lockstep game simulation: namely, it does not iterate the list of nearby units and add buffs to them. Again, maybe I am stating the obvious to you but I think at some point you may come to understand the derived sunclasses of CAbility and why this is relevant.

Although some CAbilities like CAbilityQueue and CAbilityHero are added to the unit based on editor settings other than the "Abilities - Normal" world editor field, the case you have asked about with regards to auras and their properties is the standard case handled by "Abilities - Normal," and so for example if I have a Footman copy unit named "Aura Captain" who has his "Abilities - Normal" set to contain A000, what does this mean?
If we assume that A000 is something I made in Ability Editor by copy-and-pasting Devotion Aura to make my own custom aura, the way the copy definition works is to inherit all properties of the original ability that I copied from, regardless of whether I can see them in Ability Editor. So, although it is possible to edit Units\AbilityMetaData.slk in Microsoft Excel and for example copy the Data - Effect Ability setting from the item orb abilities, then change this to modify code column instead of a data property, which would create a stat showing Devotion Aura for my custom A000 ability in this theoretical modified Ability Editor with the theoretical slk, what I'm saying is that my custom A000 ability will have the property code='AHad' regardless of whether I can actually see or change this property. And this hidden property is present even in the vanilla Ability Editor.

The reason that I bring this up is that when my "Aura Captain" is created into the world, at the moment that we add a CAbility to this unit for A000 the code class in the C++ is decided based on code='AHad' and this happens to correspond to CAbilityDevotion which is a C++ derived class from CAbility whose virtual override function CAbilityDevotion::OnTick is set to enumerate nearby units and then add an ability to those units which happens to be named CBuffDevotion although despite the name this is actually just another CAbility who adds armor when added to a unit and removes armor when removed from the unit.

Because it is written in the C++ code that CAbilityDevotion::OnTick shall periodically enumerate units within a radius of the unit who has this CAbility and then add a CAbility to units found of a class CBuffDevotion that has some function like CBuffDevotion::OnAdd that increases armor and CBuffDevotion::OnRemove that decreases armor, it will not be possible for you to make an instance of the C++ class CAbilityDevotion be an aura that provides armor and also movement speed, or some other property.

I have a YouTube video where I use the source code and recompile from source after changing CBuffDevotion::OnAdd to make the unit invulnerable and CBuffDevotion::OnRemove to make the unit vulnerable (so, this code is probably the same as CBuffBigBadVoodoo or CAbilityInvulnerable) and as a result then I have Invulnerable Aura without any further work. But it is the having of the source code part of my video that makes this modification possible. Essentially, I can do it in the toy example in my brain, but we cannot include this feature in a map because there is no API for it. Not even by changing SLKs, because the SLKs are just a data control for the properties loaded by the C++ code.

If you wanted Devotion Aura to add movement speed, if you modify the hidden property for A000 to be code='AOae' then the game engine will create a CAbilityEndurance as the C++ class for this ability, and that will interpret the data fields of the ability as movement speed or attack speed. I am in bed away from my computer so I am not in a place to check whether DataA or DataB is the movement or attack data for CAbilityEndurance but I would certainly imagine the movement data is one or the other. So, if you modify Units\AbilityMetaData.slk regardless of whether you (a) Add the Data - Movement Speed Bonus (%) field to AHad devotion aura based skills, or (b) Add the Data - Code Ability ('code') field to AHad devotion aura based skills... Both times either way you go about it, you cannot make an aura that provides both armor and movement speed. And this is for the same reason you cannot make Invulnerable Aura. In fact, because the DataA property is used for a different purpose in CAbilityDevotion (code='AHad') versus in CAbilityEndurance (code='AOae'), they will most certainly conflict. If you add Data - Movement Speed Bonus (%) or whatever it is to your AHad based skill, then this Data parameter (or maybe its friend, the attack speed parameter, depending on which uses DataA) will simply again modify the amount of armor gained by units in the area, per the code inside CAbilityDevotion.cpp that you're not allowed to read or modify. Likewise, if you manage to convince your ability to let you change the hidden property and specify code='AOae' then it will use CAbilityEndurance.cpp and the ability will no longer provide armor no matter what you do. At that point Data - Armor Bonus or whatever will simply modify the attack speed or move speed or whatever the conflicting endurance parameter happens to be.

If you want to see an example of this from the vanilla Ability Editor without touching any SLK files, you can actually spawn abilities with a different code setting via the Engineering Upgrade ability. Essentially, prior to Reforged 1.32+ when the Engineering Upgrade skill went haywire due to the Reforged programmers breaking the fundamental backbone of how SLKs and typing works and splitting it into insane pieces that cause Engineering Upgrade to go haywire even in melee maps, if you use Engineering Upgrade on an old patch like 1.28 that you mentioned then you can use it to change all the properties of an ability, including the code hidden property, but this property swap does not remove and re-add the CAbility and as a result the code parameter is mostly ignored because the C++ class is already constructed. And it makes sense for what Engineering Upgrade does that it would have to be this way; for example, if we swap Cluster Rockets (Upgrade Level 1) with hero skill Level 3 to now be Cluster Rockets (Upgrade Level 2) with hero skill level 3, the hero skill level is one of the state values in the CAbilityClusterRockets state container on that unit and needs to be kept. I don't know for sure because cooldowns are weird but I wouldnt be surprised if active cooldowns on the skill were also stored in that CAbility, and we know that Engineering Upgrade is not intended to reset the hero level of affected skills, nor reset their cooldown. So, it does not destroy/remove nor create/add the CAbilityClusterRockets from the hero. Instead, it simply switches the property map being used by the ability from within the list of property maps (the Ability "kinds" list) that Ability Editor controls and adds to.

Accordingly, this switching of the property map has a funny and fantastical side effect when used in conjunction with the hidden code property and CAbilityHero (an ability added automatically to units whose 4 letter rawcode begins with a capital letter): As it happens, the CAbilityHero class in C++ does destroy/remove and create/add the CAbility on the unit when learning a skill or using Tome of Retraining, and this means that if the unit currently has Engineering Upgrade to switch out the property maps from the perspective of that unit, then CAbilityHero will honor the hidden code field for the switched out ability.

As an example, if you make a custom ability copied from Engineering Upgrade in the Ability Editor and you set this ability to replace A000:AHad (a copy of devotion aura) with A001:AOae (a copy of endurance aura) then you will observe the following behaviors:

If a custom hero with A000 (and the custom engineering upgrade) learns the skill A000 then the CAbilityHero will first look and see the hidden property code=AHad in the settings for A000 so it will create the C++ class CAbilityDevotion as the skill on our hero. If he then learns the custom Engineering Upgrade skill, at that time the property map will switch to A001 for the hero's instance of CAbilityDevotion but the CAbility is not destroyed or created. So now our hero will have a skill that looks like Endurance Aura A001 for all its property values (icon, description, etc) but it will add some amount of armor to nearby units based on the conflicted stats of endurance aura. As I said before I am writing this from a phone in bed and do not have a means to easily check, but if Endurance Aura maybe is using DataA as the movement speed, and if our example hero has Level 1 of the aura, maybe if Endurance Aura adds 0.10 (interpreted as 10%) movement then maybe now our CAbilityDevotion still on the hero will add 0.10 armor or whatever. It will be reading the DataA field and applying that to armor of nearby units according to the code of CAbilityDevotion because that's what it is, but it will decide how much armor to add based on the DataA stat from within A001 which the Ability Editor will present to you as though it was going to be an Endurance Aura based skill.
So, the skill ingame in that case would be a mimic for the same outcome as if you didnt use Engineerimg Upgrade and instead edit AbilityMetaData.slk and expose the hidden code field and set it to code=AHad so that A001 is a copy of Endurance Aura but who uses C++ class CAbilityDevotion ingame and adds armor.

But the really fantastical and weird thing about CAbilityHero when combined with Engineering Upgrade in this case is that if you reset the same test map with the test hero described above, but if you specifically learn the Engineering Upgrade skill first and then afterwards learn the aura skill, at that time when you first learn the aura skill its hidden code property will already be swapped to code=AOae from within A001 (this is assuming you used a vanilla editor still, not the case I interjected with about hacking the hidden code property) and as a result if you learn the hero skills in this other order then it will give the hero a new CAbilityEndurance and not CAbilityDevotion because the hidden code property was swapped prior to CAbilityHero creating and adding the CAbility!! This is fascinating because when it was discovered prior to Reforged era jass upgrades, this was the only way to change what hero skills were available to a hero. Indeed, by the system I just described, we have a hero with a working Endurance Aura (it adds movement speed and attack speed!) who can pick up Tome of Retraining and learn his skills in a different order and go back to having an aura that provides armor instead (CAbilityDevotion). When this was first discovered, it became the fundamental backbone for "Create your Hero" maps that would let the player choose which hero skills their hero had available to learn. Reforged probably added a trigger action to add and remove hero skills from a hero, but back then there was no such action.

So, again, although it may at first seem off-topic I described this understanding of the game system to hopefully make things clearer to you. Perhaps now you will understand why you cannot make an aura with all the properties of all the auras.

Frustrated by the limitation of not being able to make our own CAbility derived classes in maps, among other limitations, I have worked for a few years on an open source remake of Warcraft III wherein it is possible to recompile the game with modifications and experience ideas like Invulnerable Aura made without triggers by just editing these fundamentals described above. So, the knowledge described above is focused on how I think the game should work as a result of playing it, and not actually the result of ever having access to the original game code, which I have never had. In addition, some of the descriptions above do not align with how my open source remake currently works because of abilities and systems that are not finished or are using temporary hacks. Nevertheless, I believe this information to be theoretically accurate about Blizzards game despite the fact that I am not affiliated with Blizzard in any way.
 
Last edited:
Status
Not open for further replies.
Top