- Joined
- Mar 14, 2008
- Messages
- 848
Hey everyone . I am pretty sure that every one of you knows the ''spellbook'' ability . So I was wondering , is it possible to have multiple pages in a spellbook ? I badly need it for my map
you make another spell book ability and put it in the other spell book like you put in abilities.how do i make a spell book in a spell book i need that too?
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