• 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.

Multiple pages for a spellbook ?

Status
Not open for further replies.
Level 17
Joined
May 6, 2008
Messages
1,598
Noooooooooo.

First you have a god damned Spellbook, then you add the second spellbook inside the spellbook, not that hard, eh?
 
Level 15
Joined
Feb 15, 2006
Messages
851
Yes you can, but it's a little bit tricky. Check this bible: http://www.wc3campaigns.net/showthread.php?t=81742

Aspb (Spellbook): The spellbook is basically a container for up to 11 other abilities. It can hold active spells as well as autocast and passive spells and even hero skills. The first wonderful thing about the spellbook is that it gives you the effect of passive abilities in it even if the spellbook ability itself is disabled for the player. So it can be used to hide the icon of whichever passive ability you want and to save slots on the command card. The other wonderful thing is that you can add spells to a spellbook at runtime and remove them again. That is done by giving the unit a second spellbook with the spell that should be added and disabling this second spellbook. That way the skill will show up on the first spellbook but the second one can't be seen on the unit. To make this work both spellbook abilities must have the same base order id. For each skill you want to add at runtime you will need such an adder ability. The third cool thing is that hero abilities in spell books are levelable via the levelup menu. The problem is that they will start at level 1 and not at level 0 if they are in the spellbook from the beginning. That's easy to fix with triggers. Just normally give them to the hero first in the object editor. Then catch when level 1 is learned, remove the skill and add it to the spellbook.

JASS:
function Learn_Actions takes nothing returns nothing
  if GetLearnedSkillLevel() == 1 and GetLearnedSkill() == <hero skill> then
    call UnitRemoveAbility(GetTriggerUnit(), GetLearnedSkill())
    call UnitAddAbility(GetLearningUnit(), <adder spellbook ability>)
    call MakeUnitAbilityPermanent(u, <adder spellbook ability>)
    call MakeUnitAbilityPermanent(u, <ability inside spellbook>)
  endif
endfunction

function Learn takes nothing returns nothing
  local trigger t = CreateTrigger()
  call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_HERO_SKILL)
  call TriggerAddAction(t, function Learn_Actions)
endfunction

Of course the adder ability has to be disabled from the beginning for the owner of the unit. To prevent bugs the number of minimum skills in a spellbook should equal the maximum number of skills. Unfortunately there are also some tiny problems. Active abilities in spellbooks can't be used from triggers it seems. Also the tome of retraining will totally mess your system up if you have hero skills in the spellbook. And spells added at runtime won't turn the spellbook icon blue if there's not enough mana. But these small drawbacks usually don't matter.
 
ty moyack but how do i decide what skill there comes into the spell book

........................ did you even open object editor, i got the feeling you didnt.
1.Open object editor
2.Open abilities
3.Right click on "custom abilities" crate new ability
4. you have an option to hero/unit/item ability Chose "item"
5. search foe spell book, click on it , give it a name "spell book 1", press ok
6.You have an spell book now click on it with right mouse button, select "copy ability "
7.Right mouse click "paste ability "
8. rihgt click on copied spell book "reaname custom ability" to "spell book 2"
9.Left click on spell book 1 " data - maxsimum spells 1" data - minimum spells 1"
10. shared cooldown - felse
11. data - spell list SPELL BOOK 2 <-----------------SEEEEEEEEEEEEEEE!!!!!!!!???????
spellbook.jpg
 
Status
Not open for further replies.
Top