The Issue with Morph Abilities
After numerous tests and some research, I have found the cause of the disappearing spellbook; the morph process itself.
Apparently when morphing, [POST=1155294]all abilities added via triggers are reset[/POST] unless they are given permanence using the Jass native
UnitMakeAbilityPermanent
. Therefore if you're adding a disabled spellbook to a unit dynamically, making it permanent will prevent this problem. The catch: the abilities inside the spellbook also have to be made permanent.
This isn't necessarily a problem; more of a nuisance. There is the possibility of avoiding this mess thanks to Ceday's post in this year-old thread:
Metamorphosis and Bear Form Remove Abilities. By changing the event to
Unit - A unit Finishes casting an ability and checking the unit-type of the triggering unit, you can add the disabled spellbook without worrying about permanence at all.
For those moments when there is no need to add a spellbook dynamically, adding it to the alternate unit in the object editor will also work; just make sure to disable it in the triggers!
