Ah sorry, of course it doesn't work...that was rather naive of me.
Now after a few tries and CTDs, I can say this seems harder than I though it would be.
Okay, I'm gonna find a way. Found it.
Edit: So I got it working, there is one minor caveat. The book has to be a "learn spell" type book (maybe skill works too, didn't test that) otherwise Skyrim will happily crash. That means the player will get a notification message that he or she just learned a new spell...
Anyway here are the steps:
- Since you need a spell to learn, create an new ability spell, and a corresponding magic effect, the MGEF should be doing this:
scriptname RemoveSpellMagicEffect extends ActiveMagicEffect {Removes a specific spell from the player} ;///////////////////////////////////////////////////////////////////////////// / Properties /////////////////////////////////////////////////////////////////////////////; Spell property BoundSpell = none auto {REQUIRED -- bind via CK to MGEF} ;///////////////////////////////////////////////////////////////////////////// / Events /////////////////////////////////////////////////////////////////////////////; event OnEffectStart(Actor unusedTarget, Actor unusedCaster) if (BoundSpell != none && Game.GetPlayer().HasSpell(BoundSpell)) Game.GetPlayer().RemoveSpell(BoundSpell) endif endevent
- Make sure you set the BoundSpell property to the spell executing the script.
- create your book, and set to be a learn spell then set the learned-spell to the one you created in step 1, then attach this script:
scriptname PerkTome extends ObjectReference {NOTE: The book this script is bound to must be a "learn spell" type book!!!} ;///////////////////////////////////////////////////////////////////////////// / Properties /////////////////////////////////////////////////////////////////////////////; Book property BoundBook auto {REQUIRED -- has to be bound via the CK} Perk property BoundPerk auto {REQUIRED -- has to be bound via the CK} ;///////////////////////////////////////////////////////////////////////////// / Events /////////////////////////////////////////////////////////////////////////////; event OnEquipped(Actor unusedSource) Actor p = Game.GetPlayer() if (BoundPerk != none && p.HasPerk(BoundPerk) == false) p.AddPerk(BoundPerk) endif if (BoundBook != none && p.GetItemCount(BoundBook) > 0) p.RemoveItem(BoundBook, 1) endif endevent - profit.
Ahh...why does the forum have to screw with the formatting?! Any tips which to use tabs or spaces, if spaces how many? And line endings, \r, \n or \r\n or maybe the unicode ones?In total that makes, two little scripts, one useless spell and one somewhat less useless magic effect, plus the book of course.
Edit: somewhat better to read http://pastebin.com/eXrtMtSp also I removed the BoundBook property as the book will be removed anyway if its a learn-spell book.