kwoodard65 Posted March 24, 2012 Share Posted March 24, 2012 Good Day, I have a book that that my Player acquired during a quest that I want to keep magically sealed until the right moment like the start of a new quest when the book is given to a NPC to dispel in order to open for reading. Please provide sample code for this purpose? I have a script running on the book in question but it only provides a pop-up when it is assessed warning the book can't be opened. Best Regards,KWITS Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted March 24, 2012 Share Posted March 24, 2012 (edited) If you put an "OnActivate" block on the book you "must" call "Activate" somewhere inside it, or the book won't open. It shouldn't be too difficult to code some condition of your choice into this."OnEquip" or "OnUnequip" shouldn't have any use with books, as they're not "equippable". Coming to think of it, I don't really know how's it working when already in the inventory. I think it's still "OnActivate" and "Activate", but I'll try to read it up again. Edited March 24, 2012 by DrakeTheDragon Link to comment Share on other sites More sharing options...
Lanceor Posted March 25, 2012 Share Posted March 25, 2012 If the book is in the world, "Activating" it reads it, but if it is in inventory, "Equipping" reads it. To stop it from opening, you'll need to have both an OnAvtivate and OnEquip block. Example: Begin OnActivate if GetStage MyQuest < 50 messagebox "The book is magically sealed." else Activate endif end Begin OnEquip Player if GetStage MyQuest < 50 messagebox "The book is magically sealed." else Activate endif end Side effect: The OnActivate block will prevent the player from adding the book to their inventory. If you want to the player to pick up the book but not open it, you might want to use Player.AddItem MyBook 1 and then disable the original one. Link to comment Share on other sites More sharing options...
kwoodard65 Posted March 25, 2012 Author Share Posted March 25, 2012 Thank you for your post! I am still trying to get this to work. It is difficult to keep a book from opening once it is in your inventory as a container item. Cheers,KWITS Link to comment Share on other sites More sharing options...
kwoodard65 Posted March 25, 2012 Author Share Posted March 25, 2012 I have tried the OnActivate and the OnEquip route but still, once the book is within the Player's inventory as a container item, it can be easily opened. Cheers,KWITS Link to comment Share on other sites More sharing options...
Lanceor Posted March 25, 2012 Share Posted March 25, 2012 Hmmm... it looks like the onequip block doesn't intercept the "reading" of the book before it is run. To be honest, I haven't tried to prevent a book opening, I've only run scripts when the book is read. I can think of two solutions - either make the "book" a clutter object so that there's nothing to open, or make it so that there's nothing but arcane symbols when opened using whatever quest explanation you like. In either case, when the quest conditions are right, you could use AddItem / RemoveItem ( or AddItemNS / RemoveItemNS if you're using OBSE) to swap it out for the real book. Link to comment Share on other sites More sharing options...
kwoodard65 Posted March 25, 2012 Author Share Posted March 25, 2012 Good Day, Presently, my updated book script appears to be functioning as designed. To avoid any more confusion over this forum topic, here is the scenario for the script: The Player encounters an apparition that speaks to him about a lost tome; this tome was rumored to exist deep in a forgotten cavern. Once the Player discovered the existence of the Tome and the apparition gives it to the Player as an inventory item, the Tome could not be opened for it was sealed by a powerful Magicka. Therefore, from the very beginning when the Tome was discovered by the Player, it could not be read but it could be carried under the Player's possession. What I want to accomplish is to prevent the Tome or book to be opened and read by the Player until another NPC can achieve this task and interpret its ancient writings. Thanks,KWITS Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted March 25, 2012 Share Posted March 25, 2012 (edited) Good Day, Presently, my updated book script appears to be functioning as designed. To avoid any more confusion over this forum topic, here is the scenario for the script: The Player encounters an apparition that speaks to him about a lost tome; this tome was rumored to exist deep in a forgotten cavern. Once the Player discovered the existence of the Tome and the apparition gives it to the Player as an inventory item, the Tome could not be opened for it was sealed by a powerful Magicka. Therefore, from the very beginning when the Tome was discovered by the Player, it could not be read but it could be carried under the Player's possession. What I want to accomplish is to prevent the Tome or book to be opened and read by the Player until another NPC can achieve this task and interpret its ancient writings. Thanks,KWITS I stand corrected as to the assumption the OnActivate block would still be in charge for inventory objects then. I knew I shouldn't make assumptions... but sometimes they just slip through. Well, in this case I'd simply make the book the player's carrying around first a Misc Item instead of an actual book. So it can only be picked up, neither read from the ground nor while in inventory. And when the NPC "unlocks" it, he gives you a "different" item, the real book, instead, which then can of course be read at every time. This solution wouldn't even involve scripting... other than so the NPC gives you a new item when you give him your's in course of his dialog. Would that work? Edited March 25, 2012 by DrakeTheDragon Link to comment Share on other sites More sharing options...
Recommended Posts