SKYRIM
Bookshelves Updated SKSE Script by mdr
Skyrim » Abodes - Player homes
Added: 11/01/2014 - 11:08AM
Updated: 05/07/2014 - 12:40PM

466 Endorsements

1.3.0 Latest version

3,411 Unique D/Ls

4,269 Total D/Ls

26,608 Total Views

Uploaded by eventHandler

Description

Last updated at 12:40, 5 Jul 2014 Uploaded at 11:08, 11 Jan 2014

Working on: I'm able to add non-books to the shelf, but I have to work out how to align them to look right since right now everything is expected to be shaped like a book. Post in the comments which object types you would like to see soonest, and I will release updates in batches; I'll be picking things that seem interesting to put on shelves to me in the meantime. Hopefully each type of object is aligned the same way, so for example it would be ideal if I only have to figure out the way to place an ingot and every type of ingot whether gold or iron et cetera works. Otherwise it will take a lot longer.

This will be a feature in 1.4.0 and as I add more types of objects it will be 1.4.x versions, so you might want to track the mod.

Update 1.3.0: Improved the physics by treating large books as thin boxes, so there should be no clipping as smaller books lean against them and the large books can be moved by the player grabbing them (plus they fall down to proper height if they are higher than they should be from a glitch with the papyrus MoveTo() function). The same is done for the end book, so now it shouldn't fall over but it can still be moved by the player* (I was wrong, the end book does still tip over, but its not really noticeable if its a large book so use a large book on the end for now.)

The fixes in 1.1.0 and 1.2.0 are all things that I should have considered for the initial release, so I'm sorry for releasing it too soon and not calling the first release a beta. I've never released a mod before, so now I've learned my lesson

I will address issues that come up under special cases now that are brought to my attention as 1.3.x updates that will only be needed if you are having the issue they fix.

Note: The books are 1 unit above the shelf because that is where Bethesda put the invisible marker that tells the physics the surface is, so if I move the books down to the real surface they will just pop up to the current spot when physics is enabled (or sooner if they move before the disable script runs when placing the books). This could probably be fixed in the CK by editing the bookshelf model, so I will look at that later.

The script won't have to be changed if that is fixed, because it places the books on whatever spot is set as the surface, so it would just be a separate .esp to be loaded.

Description of the mod:
This is an updated version of bookshelves script SKSE by mcguffin (http://www.nexusmods.com/skyrim/mods/24359/?) to fix issues with books falling on the shelf during placement and some other bugs.

The mod re-does the way bookshelves work to allow placement of up to 48 books. In practice this number is usually never reached, because depending on book size, usually less than 30 fit in the wide bookshelves (otherwise they'd be on the floor). So you can use the entire bookshelf now is the end result.

The books appear in the order they are put into the shelf, so you have to take every book out to get a book onto the left side unfortunately. I will see if there is some way to possibly pick where to put books in the shelf order, but I am new to papyrus and skse's features and limits.

I will look into being able to place non-books on the shelf as decorations, but I haven't tested that. I know this is a feature of an older bookshelf mod (broken now) which some have been wanting back.

Requirements:
SKSE is required. This mod will work with or without any dlc, and it should work with almost all mods. It only alters two scripts, and is only called when you activate a bookshelf or remove a book from it by reading and taking without opening the shelf itself.

Mods which place new bookshelves or alter existing bookshelves may or may not work as intended. I have tested Dev Aveza and the bookshelves on board are not working with this mod. The reason is that these are normal shelves which have had the special bookshelf displays placed over them, and they don't have the trigger script for removing books by reading + take instead of opening the bookshelf and taking it from the container. As long as you don't take books directly off the shelf, they should otherwise work fine. I will work on a patch, but it will mean an esp for each house mod that has "custom" bookshelves which aren't set up properly.

Installing: Extract the folder Scripts of the 7zip file to your SkyrimData folder. You should have 2 files with .pex extensions to move to SkyrimDataScripts. The optional source folder is not needed for the mod (.psc extension) and can be deleted if you don't plan on modifying the scripts yourself. You can leave books on any bookshelves you own if you are using either vanilla or mcguffin's scripts, and the new scripts will seamlessly handle the transition.

If you are using a different mod, first remove all books from any bookshelves, save, and follow the uninstall instructions for that mod. Then install this one and start placing your books as desired.

Updating: Overwrite the old files in the same way as before, and there is no need to remove books from the bookshelf first.

Uninstalling: First remove all books from any bookshelves you are using and save the game.
Next delete the files "playerbookshelfcontainerscript.pex" and "PlayerBookShelfTriggerSCRIPT.pex" from SkyrimDataScripts

Also delete the two optional source files "playerbookshelfcontainerscript.psc" and "PlayerBookShelfTriggerSCRIPT.psc" from SkyrimDataScriptsSource if you moved them there.

Now you can load the game and it will use the old bookshelf system or any other modded system you install.

The two .psc files are included for anyone who wants to edit the scripts, and can safely be deleted at any point while using the mod because they are not used by the game.

Recommended mods:
Book Covers Skyrim by DanielCoffey at http://skyrim.nexusmods.com/mods/35399/?
The important reason to get this mod is to fix the book boundary values (which are missing or wrong on a lot of books) so that the books will fit appropriately against each other and occupy the right amount of shelf space. The added benefit is that this mod makes books look really fantastic (I recommend desaturated colors). When I first heard about it, I thought it would be adding tacky covers to the book the way they do with modern books (glossy, ugly things taped on with flashy pictures that hide the actual book), but that isn't what it does as it turns out. It makes the books look more unique and detailed, and stylish (legible) titles on the covers/spines. It changes notes and letters as well, adding many interesting varieties. This mod should be placed near the end of your load order to ensure no book fixes are overwritten.

Dragonborn Book Bounds Fix by lessens at http://skyrim.nexusmods.com/mods/39671/?
Book Covers Skyrim fixes many book boundaries, but it doesn't touch Spell Tome boundaries. That's where this mod comes in, as it has fixes on spell tomes that are useful if you plan to place them on bookshelves. Place this mod before Book Covers Skyrim in your load order or you will lose the improved book cover models/textures on many books.

Issues:
  • Sometimes the last book to the right doesn't show up if the remaining space is a close to maximum and its size is barely able to fit, but it still is treated as having fit by the code that returns books to the player, so I will work on that.
  • .
  • Sometimes the normal/smaller books (which have dynamic physics enabled) will lean into larger books which are static, and clip slightly into it. This is only a small amount, and its not as bad as would happen in the previous script when the books would sometimes "fuse together" into inseparable blobs of books.


Suggestions:
  • You can try opening a closing the bookshelf to get different results if the books shift the wrong way during rendering. Sometimes the big books fall wrong and then don't drop to the shelf before the physics is altered, so they need reset. I will try to find a way to check for whether or not they are a certain distance higher than the other books and move them automatically. With the normal/small books, you can drag them and nudge them around since they have the havok re-enabled after loading up, but it can be mixed results and mess them up worse. You only need to open and close the shelf to try again.
  • .
  • Try to find a large book with good bounds and put it after any smaller books and before any larger books (which tend to have the least accurate bounds it would seem). The normal size books tend to lean to the right, but fortunately they don't lean into the other normal/small size in most cases. The bounds + physics enabled seems to keep the normal sized books properly supported against each other, but unfortunately they lean into books set static. The problem is that the large books become distorted when they are set to use dynamic physics; the covers pop out and crease in the bidnings and the pages try to escape into the adjacent books. I am not sure if this could be fixed by adjusting the bounds on the larger books or by playing with the physics more, but I am looking into it.


More on Bookshelves
The bookshelf has a container part like any normal chest which is where the books are held (references to the books that can be used to load them into your inventory to be more precise). The the game collects the model information from the books in this container using magic and renders them on the shelf, but essentially the book (if it were a tangible object) is still safe in a chest while another copy of it is sitting proudly on display. So even if a book isn't showing up on the shelf, it's still going to be in that container and able to be retrieved by opening/activating it. Any book not actually able to be displayed (no more room for it on the shelf) should return to the player's inventory. Books that do show up on the shelf can either be picked up normally by using it or retrieved by activating the chest to look in the container. I think that's accurate information, but I'm making assumptions from looking at code and trying out things in the game.

Other notes:
Sometimes you will get an error in papyrus logs which I've posted at the bottom of this description, but it only means the script is not finishing loading a book before trying to modify the book's physics. This will happen when you have other scripts taking up resources, and isn't anything harmful aside from books possibly moving out of position. If some books fall too much and look out of place, just try opening and closing the bookshelf again until it works right. I've tried to find a balance between waiting long enough to ensure the book has rendered and not waiting too long for the book to fall out of place.

The script disables the physics of each book shortly after rendering the book, then renders the next book. After all books have been rendered, each book from left to right has its physics re-enabled (so they will appear to jump up and down a bit and shift into usually a better fit). I have decided to keep the physics on large books disabled, because they tend to distort and mess up themselves and the books around them; its best to group large books together and preferably at the end of a row. The right end book is also kept static so that it doesn't fall and acts as a bookend.

This script was tested in Breezehome, so if you have shelves it doesn't work well on, please post a comment. If the boundaries of a book are incorrect, it will possibly overlap other books or have a large gap around it depending on the amount of error. Please report any books with issues that are not covered by the recommended mods in the comments and I will try to make a patch for them.

Please post any issues in the comments, since I have only tested it on my own save game and only in Breezehome. I am using 200+ mods and a number of them are scripted, so it should work for most people. I will release any further tweaks I make to improve positioning of books or patches for book bounds/sizes or bookshelf bounds.

This error can be ignored.
Error: (FF001C6B): has no 3d, and so cannot have its motion type changed.
stack:
[ (FF001C6B)].ObjectReference.SetMotionType() - "<native>" Line ?
[ (00102A81)].playerbookshelfcontainerscript.UpdateBooks() - "PlayerBookShelfContainerScript.psc" Line 328
[ (00102A81)].playerbookshelfcontainerscript.OnActivate() - "PlayerBookShelfContainerScript.psc" Line ?