Difference between revisions of "Tutorial Bookshelves"
imported>Guabuellaitor |
imported>Guabuellaitor |
||
Line 66: | Line 66: | ||
#Create a Collision Cube by clicking the icon in the toolbar with a [C] inside a cube. Click inside the reference window and it will create a yellow box. | #Create a Collision Cube by clicking the icon in the toolbar with a [C] inside a cube. Click inside the reference window and it will create a yellow box. | ||
#Expand the box using the arrows from the origin or by the ''Bounds'' section under the ''Primitive' tab and cover the entire front of the bookshelf. The Cube can have a paper thin width but the length must cover the whole opening of the shelf(s). Also, be sure to keep it about 2 to 3 pts. away from the binding of the books to keep the larger books from getting squashed. If your bookshelf has other open areas where a book can escape, create multiple collision cubes to contain them. | #Expand the box using the arrows from the origin or by the ''Bounds'' section under the ''Primitive'' tab and cover the entire front of the bookshelf. The Cube can have a paper thin width but the length must cover the whole opening of the shelf(s). Also, be sure to keep it about 2 to 3 pts. away from the binding of the books to keep the larger books from getting squashed. If your bookshelf has other open areas where a book can escape, create multiple collision cubes to contain them. | ||
#Edit each collision cube you made and under the ''Primitive'' tab, change the Collision Layer to '''L_UNIDENTIFIED'''. This allows the player to access the books but not allow the books to pass through. | #Edit each collision cube you made and under the ''Primitive'' tab, change the Collision Layer to '''L_UNIDENTIFIED'''. This allows the player to access the books but not allow the books to pass through. | ||
Revision as of 10:04, 10 June 2012
Bookshelves
There are many bookshelves littered about Skyrim. Bookshelves provide players with a convenient and aesthetically pleasing way to store books. This tutorial covers the creation of a bookcase, setting up its critical components, testing it out, and troubleshooting. It also gives some ideas for expanding the idea of a bookshelf toward the end.
Before You Begin
This tutorial assumes the reader is familiar with working inside the Creation Kit editor and is comfortable using the Object Window, Cell View, and Render Window.
The Pieces
A fully functioning bookshelf requires these five main non-physics components:
- A visual static object that the books will rest on (this can be any piece of furniture that you want books to appear on or in)
- A container object for each shelf (this is an invisible storage container object that provides the inventory functionality for the bookcase)
- A dummy book marker for each book you want the bookshelf to keep track of (these act as placeholders where books will appear when placed on the bookshelf)
- A non-player-interactive trigger activator that must contain each dummy book marker (this allows the bookshelf to update itself when books are manually removed "by hand" as opposed to removing via the inventory menu)
- Collision cubes in order to keep books on the shelf once placed there (this is necessary to prevent the player from accidentally grabbing and dragging a book off the shelf)
Optionally, your bookshelf can use this component:
- A player-interactive click trigger activator for the player to interact with (the invisible container object above also provides player activation)
Making A Bookshelf
- Start out by opening a Cell in the desired world space.
- Pick a furniture model to serve as your visual holding place for books and place it in the area to work with. An easy one to start with is "CommonShelf01" under Static>CLUTTER.
- Find the marker for a book called DefaultBookShelfBookMarker under Items>Book>DummyItems. Be careful not to select DummyBook. Place it vertically and rotate it so it would be able to rest on the shelf. Press F to easily rest it on the surface of the shelf. Once you place it correctly, press Ctrl+D to duplicate it. Drag the duplicated marker and repeat as many times as necessary. For this shelf, 18 books should fit perfectly (Each shelf can accept only 18 books max.).
- Now, the books need a place to "be stored." Find the PlayerBookShelfContainer under WorldObjects>Container>Markers. Drag it into the render window and place it somewhere near the bookshelf.
- In order for the books to "be stored" by the newly placed container, they need to be referenced by it. So right-click on the container and select Edit (shortcut: double-click it). Under the Linked Ref tab, you should see a blank list. Right click inside the white-space and select New (shortcut: double-click inside the white-space). This will bring up the Choose Reference window. If your camera is focused on where your book markers are, you can use the Select Reference in Render Window button to choose the first book marker as your desired reference. Otherwise, you must choose the cell you're working in from the Cell drop-down box and then find the correct DefaultBookShelfBookMarker object from the Ref drop-down box. Using the Select Reference in Render Window button is much easier and less error prone, so if your book markers aren't in view, close out of the properties window and change your view in the render window until you can see your book markers. Once you have the book markers in view, repeat the previous steps until you see the Select Reference in Render Window button and then click it. A target will show up as the cursor in the render window. Hover your mouse over the first book marker. The target should turn white. Double-click the book marker and it will fill out the Cell and Ref boxes automatically. For the keyword, scroll down (or hit B) and select BookShelfBook01. Hit Okay and repeat the process until you have all your books referenced.
- Here is an example below:
Keyword | Reference | ID |
---|---|---|
BookShelfBook01 | DefaultBookShelfBookMarker | 00000001 |
BookShelfBook02 | DefaultBookShelfBookMarker | 00000002 |
BookShelfBook03 | DefaultBookShelfBookMarker | 00000003 |
BookShelfBook04 | DefaultBookShelfBookMarker | 00000004 |
Adding The Triggers
We now have a visual piece of furniture to hold our books and we have book markers representing where the books will go in their place. Our bookshelf will technically work as-is in the game. When you look at where the bookshelf container object is (the long orange box) in the game, you will get a prompt allowing you to access the bookshelf. When you place books into the bookshelf's inventory, they will plop onto where you placed the book markers. You can also remove the books via the bookshelf's inventory and the books will disappear from their locations as expected. However, at this point, there are a number of things that are wrong with the current state of our shelf. First off, if you take a book from the shelf by accessing the book directly, the book will disappear from the shelf and be placed into your player's inventory as expected, but the book will still appear in the bookshelf's inventory when you access the bookshelf itself. Since the book still exists in the bookshelf's inventory, it will reappear on the shelf after you leave the bookshelf's inventory menu and the same book will still be in your player inventory, causing the books to be duplicated. While this can be good for duplicating books, it doesn't make sense when you're trying to play the game fairly. In order to fix this issue, we need to add a special activator object called the PlayerBookShelfTrigger.
- Click on the [T] icon in the toolbar at the top to bring up the triggers and find the one called PlayerBookShelfTrigger, then press OK. Use the arrows to adjust the size (you can toggle between move and resize mode by pressing 2). Drag the arrows until the size of the trigger box completely encases all of your book markers, leaving a little space between the book markers and the inside of the box. You may also edit the dimensions of the box under the Primitive tab, in the section labeled Bounds. It's important that this trigger completely encase the book markers in order for the books to be removed from the bookshelf's inventory when you take a book from the shelf directly (as opposed to via the inventory menu).
- Edit the properties for the trigger. Under the Primitive tab, set the Collision Layer to: L_TRIGGER. Under the Linked Ref tab, make a link to the bookshelf container object. Leave the Keyword blank.
- Edit the properties for the bookshelf container. Under the Linked Ref tab, make a link to the PlayerBookShelfTrigger you created in step 1. The Keyword must be BookShelfTrigger01.
If you've set up the links properly between the PlayerBookShelfTrigger and the PlayerBookShelfContainer objects, then now when you take a book directly off the bookshelf in game, it should be properly removed from the bookshelf's inventory.
Containment of Books
The player needs some way to prevent the books from falling out of the book case and preventing the PlayerBookShelfTrigger from not working. While you can now place and remove books from the bookshelf via the inventory menu or taking a book directly, there is still a way to screw up the system. In the bookshelf's current state, you can grab a book off the shelf and move it in mid-air just like any other Havok object in the game. If you happen to grab and pull a book out of your new bookshelf and plop it on the ground for example, then take the book directly and place it into your player inventory, the book will still be in the bookshelf's inventory! This is because when you grabbed and moved the book and plopped it on the floor, the book went outside of the PlayerBookShelfTrigger box and when you take a book and put it into your player inventory when that book is not within the bounds of the PlayerBookShelfTrigger, the trigger won't recognize that the book left and therefore won't update the bookshelf's inventory. Because of this flaw in the script behind this trigger, we must find a way to contain the books inside the shelf where they belong. The solution is to create collision cubes.
- Create a Collision Cube by clicking the icon in the toolbar with a [C] inside a cube. Click inside the reference window and it will create a yellow box.
- Expand the box using the arrows from the origin or by the Bounds section under the Primitive tab and cover the entire front of the bookshelf. The Cube can have a paper thin width but the length must cover the whole opening of the shelf(s). Also, be sure to keep it about 2 to 3 pts. away from the binding of the books to keep the larger books from getting squashed. If your bookshelf has other open areas where a book can escape, create multiple collision cubes to contain them.
- Edit each collision cube you made and under the Primitive tab, change the Collision Layer to L_UNIDENTIFIED. This allows the player to access the books but not allow the books to pass through.
Making Activation More Flexible
We now have a fully functioning bookcase, you can re-position the "PlayerBookShelfContainer" to wherever you would like the player to look at in order to access the bookshelf's contents. You can make this box bigger to better fill the area you'd like but you'll notice that the box scales uniformly and that you can't just make it longer or taller. In order to precisely control where the bookshelf can be accessed, we will need to add a click trigger for our new bookshelf and link it to our bookshelf's container object.
- Create a trigger by pressing the [T] icon on the main toolbar at the top of the screen. In the window that appears, find the PlayerBookShelfClickTrigger and click OK. The Creation Kit editor can sometimes be finicky so if the window doesn't appear, you can just find the trigger under WorldObjects>Activator in the Object Window.
- Once you've added the trigger, you should see a red box in the render window. Position the new trigger and adjust its size until you have it covering the portion of the bookshelf where you want the player to be able to access it. Important: In order for the player to actually use this trigger, its "activation side" must be facing outward. If it's facing inward toward the inside of the bookshelf, then you won't get a prompt to access the bookshelf when looking at it. Unfortunately, the PlayerBookShelfClickTrigger object doesn't provide any hints as to which direction it should be facing {verification needed}, so if the activation isn't working for you in the game, simply rotate the the trigger so that another side faces outward until you have the right one and it works (oftentimes simply rotating 180° will work).
- Edit the properties of your new trigger and under the Primitive tab, check the box to enable Player Activation. Then under the Linked Ref tab, add a link to your bookshelf container, setting the Keyword to BookShelfContainer. Hit OK.
You now have a working bookshelf! If you are still experiencing problems with getting it to work or if your books are being duplicated or deleted, make sure all your links are set properly. You can use an existing player bookshelf (such as one located in the ProudspireManor or Breezehome Cells) as a model for how everything should be set up.
Summary
The following is a summary of the topics in this tutorial.
The Critical Components
- The BookShelfContainer object serves as an inventory storage for your bookshelf (much like a chest). The BookShelfContainer links to each book marker you want to place in your bookshelf and you can have a maximum of 18 book markers for every BookShelfContainer. If you want to store more than 18 books, you will need another BookShelfContainer linked to its own set of book markers. Many bookshelves in the game use multiple BookShelfContainer objects linked to multiple sets of book markers. For example, a furniture item containing two shelves could use two BookShelfContainer objects, one for each shelf. It must be linked to each of its book markers (with Keyword BookShelfBook01, BookShelfBook02, etc.) and to the PlayerBookShelfTrigger (with Keyword BookShelfTrigger01, BookShelfTrigger02, etc.) in order to work.
- The PlayerBookShelfTrigger object is necessary to ensure your books get properly removed from the bookshelf's inventory when directly taking them off the shelf (as opposed to removing via the inventory menu). It must fully encase every book marker to be effective. Like the BookShelfContainer, you will need to create one for each set of 18 books you want to store in your bookshelf. Each shelf on a book case for example would need a BookShelfContainer, a PlayerBookShelfTrigger, and a set of book markers up to a maximum of 18 per set. It must be linked to the BookShelfContainer (with no Keyword) in order to work. Its Collision layer must be set to L_TRIGGER.
- The Book Markers serve as placeholders for the books you want placed in your bookshelf. When you place a book in the bookshelf, the book is placed at the position and orientation of the book marker. They do not need to be linked to anything, but they must be linked from the BookShelfContainer. In other words, the BookShelfContainer must link to the book markers but the book markers don't need a link to the BookShelfContainer.
- The BookShelfContainer and PlayerBookShelfTrigger are the only objects that need links pointing to each other. The BookShelfContainer needs its own link pointing to the PlayerBookShelfTrigger (with Keyword BookShelfTrigger01, BookShelfTrigger02, etc.) and the PlayerBookShelfTrigger also needs its own link pointing to the BookShelfContainer (with no Keyword).
- The Collision Cubes force the books to stay in your bookshelf/bookcase so that the books can't fall out or be grabbed by the player and physically moved out. These are necessary to prevent the player from duplicating books by dragging books out of the shelf, dropping them, and then taking them. They do not need any links. Their Collision layer must be set to L_UNIDENTIFIED.
- The PlayerBookShelfClickTrigger object is useful in providing an activation spot for your bookshelf/bookcase exactly where you need it. It must be linked to the BookShelfContainer (with Keyword BookShelfContainer) and must be facing outward, away from the bookshelf/bookcase in order to work.
- If you desire more than 4 bookshelves in one cell, then you can add additional keywords under WorldData to obtain more references (BookShelfTrigger05 and so on). The 5th and so on BookShelfContainers will have to have their references manually set to the new values under Scripts in properties to the new keywords (unless you want to do some script editing).
Important Notes and Troubleshooting
- The scripts used by the triggers and containers in a bookshelf-bookcase system are dependent on the Cell being loaded (by entering it for example). Therefore, if you experience problems with your bookcase not working the way you expect, be sure to leave and re-enter the Cell before trying to use it again.
- If you're still finding your bookshelf not behaving how you expect, then try checking the following:
- Make sure all your links are setup properly.
- Make sure your PlayerBookShelfClickTrigger is facing the right way.
- Make sure your PlayerBookShelfTrigger completely surrounds your book markers.
Expanding the Bookshelf Idea
The Creation Kit is very powerful and lets you do amazing things once you get the hang of it. With the knowledge of this tutorial, you can expand on the typical idea of a bookshelf by setting up a bookshelf system using any piece of furniture you desire. Here are some ideas you could consider:
- Setting up a book pile "shelf" on top of a table. Since you can place the book markers in any position/orientation combination you wish (as long as you can surround them by the PlayerBookShelfTrigger and Collision Cubes, you can effectively create a pile of book markers on a table surface, surround the markers with the PlayerBookShelfTrigger and collision cubes, and then hook up the BookShelfContainer and other critical components together. Now when you place the books into the bookshelf container, the books will appear piled up on the table. Or if you like things a little more neat, you can arrange the book markers so that the books appear in multiple stacks on the table when placed. In this way, you can have a method for storing books in a more organic/natural way instead of always placing them in the typical bookshelf. You also wouldn't have to pick each book up manually, set them on the table, and try to get them looking just right using Havok (not to mention the issue with objects getting randomly dispersed upon coming back to your house later).
- Turn any type of furniture item into a book storage location without having to manually place a single book one at a time into it, for example you can turn an ordinary crate (that would normally just contain food or ingredients) into a book holder. Again, just arrange the book markers into the crate piece how you would like them to appear and then hook up all the other critical components.
- If you're good at scripting in Papyrus and really advanced in your knowledge of the Creation Kit, you can theoretically make "bookshelves" that can hold any type of object. You can, for instance, make a book shelf that can automatically store both books and other items like skulls or tankards, just like a bookshelf in your own real-world home. With enough effort, the concept could be expanded further to allow the creation of completely custom pieces of furniture (using existing static furniture pieces) that can automatically store and arrange any item in the game you wish. Haven't you ever wished you could just go over to the shelves at the Alchemy station in Proudspire manor and just store items in it via the inventory menu like you could with bookcases? Using the bookshelf system as a starting template, you can.
- Make book plaques that can hang on the wall and prop books upright for display as a wall decoration. Expanding the concept further with script editing, you can create custom weapon or armor plaques that you can walk up to and open via an inventory menu to place weapons or armor in just like you would with a bookcase. The weapons or armor would them be displayed automatically onto the plaque. This would be much more intuitive then the current method, which requires you to equip a weapon in-hand before placing it on the existing weapon racks in the game. Imagine a reinvented weapon rack that allows you to open up its inventory menu and place your weapons in it, then when you leave the inventory menu, all the weapons fill the rack in the order placed. Simple, easy, intuitive.
Conclusion
You can help this article grow. If you have additional ideas for creating bookshelves or information on how to more efficiently create and edit bookshelves, please feel free to modify this page to expand or change its content.
Enjoy your new bookshelf!