The purpose of this tutorial is to introduce spellbooks and teach how to create and manipulate them.
- An authentic copy of Warcraft 3: The Frozen Throne
TABLE OF CONTENTS
Chapter one – What's a spellbook&how to create one
Frequently Asked Questions
- How to add spells to a spellbook with triggers
- How to order a unit to open a spellbook
- How to cast spells inside a spellbook with triggers
- How to add passive spells to a unit without an icon showing up
- Why do the spells „jump around“ in my spellbook after casting/learning them
- Why do my spells disappear from the spellbook after transformation/metamorphism etc
- How can I detect if the spellbook is open or closed?
CHAPTER ONE – WHAT'S A SPELLBOOK&HOW TO CREATE ONE
A spellbook is quite simply what it states, a book containing magic spells, which allows a hero to bypass the limit of 5 hero spell.
There have been a lot of myths about creating a spellbook, for example, one has to know JASS in order to create a spellbook. That's not true.
Spellbook is actually an ability, accessible from Object Editor without the help of any triggering. Now, lets create our own spellbook.
Open Object Editor (F6) and go to the „Abilities“ tab. Next, search for the abilities folder „Special“ and open the „Items“ sub-folder. Scroll almost to the very bottom until you see the ability „Spell Book“. Select the ability and copy&paste it.
The first thing you want to do, is to make the spellbook a unit ability (or a hero ability). Change the field „Item Ability – true“ to false. This allows you do add tooltips for your spellbook.
Next, you have to change the „Data – Base Order ID“ field to something different than „spellbook“. By changing this option, you remove the possibility of colliding two or more spellbooks with the same ID (when they collide, things will get buggy and they will inherit each others spells). It's wise to choose those abilities from the list, which are rarely or not at all used in your map.
After that, you need to modify the „Data – Shared Spell Cooldown“ field and change it to false. This allows you to open the spellbook and cast other spells, when some spells are in their cooldown state.
Proceed by locating the „Data – Spell List“ field. This is here where the magic happens. Choose your spells and add them all there.
[INDENT]NOTE #1: You can add a maximum of 11 spells, which show up in the spellbook, nevertheless the UI has 12 slots. One slot is reserved by the game for the „Cancel“ ability which allows you to exit the spellbook.
Lastly, if you've added all the needed spells, count them and change the „Data – Maximum Spells“ field to that number. This ensures all the added spells actually show up when you open the spellbook. You can change the „Data – Minimum Spells“ to 1.
NOTE #2: The value entered to the minimum field cannot be greater than the one entered to the maximum field. The number of spells shown in the spellbook will be still equal to the value entered to the maximum field.
Now, you've set up your very own spellbook! You might want to do some finishing touches, like changing the icon, adding tooltips or even make the spellbook level-able.
FREQUENTLY ASKED QUESTIONS
HOW TO ADD SPELLS TO A SPELLBOOK WITH TRIGGERS
You need two spellbooks and the actual spell for that.
Firstly, create the spellbooks and name one of them „dummy“ and the other one the way you want it to display on the unit. Make sure the „Data – Base Order ID“ field is the same for both of them. Next, add the spell you want to give to the unit to the „dummy“ spellbook and add the real spellbook the unit.
After that, go the the Trigger Editor and make a trigger where you disable the „dummy“ spellbook.
This ensures the „dummy“ spellbook icon will not show up on the hero when you add the spell.
Now, you've done the setup process and the only thing left to do is to learn how to add the spell to the right spellbook.
The trick lies in the bug I wrote about earlier – spellbooks with the same ID will collide and inherit spells. Meaning, if you add the disabled „dummy“ spellbook to the unit with the real spellbook, the real spellbook will inherit the spell(s) inside the „dummy“ book. The same goes for removing: if you remove the „dummy“ spellbook ability, the real spellbook will lose all the inherited abilities.
[INDENT] TIP #1: Check out this thread to see a system which makes this process easier and enables spell levelling inside a spellbook.