What kind of event do u use to run a script on a spellbook

Post » Thu Aug 25, 2016 2:41 pm

I want a note to be added to the players inventory when the book is read/spell is learned.



I know there's an event OnRead(), and that it only works when the book ui opens. I'm wondering if there's an appropriate event for books that teach a spell. "Consumable books."

User avatar
Kayleigh Mcneil
 
Posts: 3352
Joined: Thu Jun 29, 2006 7:32 am

Post » Thu Aug 25, 2016 9:46 am

Have you checked if OnRead definitely only fires on the UI? It might be worth giving it a shot, just in case it'll work anyway.



Beyond that, it looks like maybe you could try 'OnItemRemoved'--the Wiki says that a consumed Item's Destination and Reference will both return NONE, which might help you identify when the Spell Book has actually been read, rather than just dropped.

User avatar
Your Mum
 
Posts: 3434
Joined: Sun Jun 25, 2006 6:23 pm

Post » Thu Aug 25, 2016 11:26 am

You could also try the OnEquipped event. The event is triggered even for miscellaneous items (typically junk that you can pick up in the game like bones) despite the fact that such items do not have a slot that they occupy like armors or weapons do.

User avatar
BaNK.RoLL
 
Posts: 3451
Joined: Sun Nov 18, 2007 3:55 pm

Post » Thu Aug 25, 2016 12:30 am


yeah just tried it. on read doesnt work on spellbooks. but since it does work on regular books i might be able to go a different rout and addspell the spell.

User avatar
Pumpkin
 
Posts: 3440
Joined: Sun Jun 25, 2006 10:23 am

Post » Thu Aug 25, 2016 6:16 am

I can confirm that spell books behave like misc items when it comes to events, OnEquip and OnActivate trigger fine, no OnRead.

User avatar
Brooke Turner
 
Posts: 3319
Joined: Wed Nov 01, 2006 11:13 am

Post » Thu Aug 25, 2016 2:59 am

orly? awesome. thatl come in handy.

User avatar
Breautiful
 
Posts: 3539
Joined: Tue Jan 16, 2007 6:51 am


Return to V - Skyrim