HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Order of icons in spellbook when adding spells

03-06-2006, 11:09 PM#1
karukef
UPDATE: This post does NOT have the correct solution. Keep reading the second post for what I believe is the real solution!

First when I saw Vexorians truly amazing discovery of how to add abilities to spellbook i was awed: no wonder it took years to discover such an insanely peculiar behaviour, but my oh my how useful it is!

But, I did come across one very time consuming problem. The order of icons in the spellbook.

The only clue I had to start with was a comment in Vexorian's testmap:

Quote:
- There is one little problem, the order of the skills shown in the spell book seems to depend on the order you created them in the object editor...

Ok, I assumed this meant the order of the abilities depended on the raw-code of either the disabled-spellbook (the ability that 'adds') or the ability being added. So I fired up a fancy namescheme and ordered all my abilities cleverly using the widegtizer to rename ability-raw-codes. It looked good until I started realizing that hey... the ability-raw-code has nothing to do with the order at all! It was just me coming to a hasty conclusion.

Next I decided to take Vexorians suggestion a bit more literally: The order the editor puts items in AbilityData.slk. I went as far as to re-order the abilities using OpenOffice, saving it as .slk, realizing War3 couldn't read that .slk format, wrote a python parser to RE-FORMAT the entire thing to something war3 COULD read, and then in the end I discovered that this had nothing to do with the order of icons in the spellbook either...

I am just terribly stupid. After all, Vexorian only wrote that it SEEMED to depend on an order in the editor. Having completely ridden myself of the notion that editor-order or ability-id had anything to do with the order, I started trying more simple approaches, and finally I had success.

The answer is just terribly simple, and I am sure anyone else would have found it faster than me, but here it is anyway for the record:

The order of abilities when added to a spellbook through Vexorian's discovery is based on when it was first added to the spellbook. Lets say we have abilities A, B, C, D. Then we add B and D to the spellbook, in that order. They will appear as B in slot 0 and D in slot 1. If we then add the ability A to the spellbook, it will end up in slot 2.

If we decide to REMOVE B and D before adding A, then obviously, A will be in slot 0 (because it is the only ability). But, re-adding ability B will cause B to take slot 0 (where it originally was) and pushing A to slot 1. Re-adding D will push A to slot 2 again. Adding C will put C in slot 3, leaving A in slot 2.

So basically, the FIRST TIME an ability is added to a spellbook, it is given a number that is remembered seemingly forever. The first spell ever added to a spellbook will always have the lowest number, the second spell added will have the second lowest number, etc.

This makes it very easy to manage order in a spellbook. Simply add all spells into the spellbook once, in the order you want them to have, then remove them. Any later additions and removals will then make sense.



Personally, I am using this system to be able to have "blanks". I first add Blank 0 to the spellbook, then any abilities I want to have slot 0. Then I add Blank 1 followed by any abilities that I later may want to have slot 1 and so on. I can then for example have ability A in slot 0, ability B in slot 1 and by removing A and adding Blank 0, ability B STAYS in slot 1.


Well, I am sure this was way too much talking about things almost no-one cares about. :)
03-18-2006, 01:41 AM#2
karukef
EUREKA!

Sheesh, just let me release a huge sigh! I have worked so hard to figure out what REALLY determines the order of icons in the spellbook, and finally, I have it all figured out. For real this time!

The order of icons in spellboks is determined by the order War3 LOADS the abilities for the first time. Man oh man did I fall for many peculiar solutions that only ALMOST worked.

But basically, when adding spells to a spellbook using the order-id bug, the order of the spells within the spellbook will always be based on whichever ability was loaded into the engine first.

So, if you happen to have an Arch-mage standing on the map when you start, and then later create a Blademaster, then proceed to add Summon Water Elemental and Windwalk to a spellbook, Summon Water Elemental will ALWAYS appear before Windalk in any added-to spellbook, because it was the ability that the engine loaded first.

Phew. My map uses two spellbooks, both with some rather complicated requirements for ordering spells added to it, so I am thrilled to finally have figured out this! Hope it will save someone else the trouble later.
04-05-2006, 07:23 PM#3
BertTheJasser
Wow! This sloved me really big trouble! Thx. +Rep
04-05-2006, 08:47 PM#4
karukef
Quote:
Originally Posted by BertTheJasser
Wow! This sloved me really big trouble! Thx. +Rep

After the hours and hours of crazy experimenting, it sure is good to know someone else can benefit from this!!

Maybe we will see more fancy systems using spellbooks soon, that would be awesome :)
04-06-2006, 05:07 PM#5
BertTheJasser
Your way with the dummy abilities is very good(I guess so), but can I use abilities with no icon or would that have no effect at the counting of the next ability?
05-02-2006, 11:53 AM#6
karukef
Quote:
Originally Posted by BertTheJasser
Your way with the dummy abilities is very good(I guess so), but can I use abilities with no icon or would that have no effect at the counting of the next ability?

Sorry, I somehow missed this question.

I use abilities with blank icons and tooltips as the dummy abilities. Probably based on something like Gyrocopter bombs (although I don't remember). The only thing that will show when you hover the mouse over one of these "empty" icons is the "almost empty" tooltip.
05-02-2006, 05:04 PM#7
BertTheJasser
Thx, this is the answer I expected. Thx anyways.
05-18-2006, 06:24 PM#8
BertTheJasser
That's not the hole truth. Some abilities apear in the 2nd row of a spellbook, even when the 1st is completly emtied or was never filled (I used commands aura and played around with xy of the button)
05-18-2006, 06:35 PM#9
Mezzer
I had no problems with abilities using [0][0], so why not just use that?
05-19-2006, 12:27 PM#10
BertTheJasser
Hmm, yes ... but ... if we find a way how to use the xy pos of the buttons, we wouldn't need to create any dummy abilities which show weierd buttons.

EDIT:
The standard XY Position of a ability works ONLY for passive skills at least for all auras! So If you wanna add a aura to a specific position, no mater when it is loaded.

Here 2 screenshoots:
10-29-2010, 05:17 PM#11
Desktop_General
This is exactly what I was looking for. Thank you!

(I spent about 6 hours trying to create ways to control the order of the abilities in the spellbook. It should have occurred to me to add ALL of the spellbook abilities I was going to use like you said. I guess it may have been a larger task than I would have wanted to conceive of because I'm going to have a lot of abilities. Still, it will work well. Also I'm glad you found out that it had to do with the order the ability shows up in the game and not just the spellbook. I never would have made that connection.)

I just wanted you to know that your efforts helped me a lot. I will definitely credit you in my map. You'll have helped all my players too. I will make at least the system for my equipment system public, so you'll have helped all the people that use it and their players too.