Pre-populated Bookshelf

Post » Thu Jun 21, 2012 3:09 pm

I've finally managed to get a working three shelf book case sorted out which is working perfectly.

Almost.

I really would like to include books for a more lived in look which is attached to the playerbookshelfcontainer and displays the actual model on the shelf as well.

I've already tried just dropping the books in to the inventory, but two things happen, 1st. The book models don't appear in game on the shelf, and there's still the same amount of space on the shelf even though it should be full.

So how would I go about pre-populating a few books in to a book case? (Please no scripts, I wouldn't know where to start)
User avatar
Philip Rua
 
Posts: 3348
Joined: Sun May 06, 2007 11:53 am

Post » Thu Jun 21, 2012 8:49 am

Put the books in the cell. Add the "DefaultAddToLinkonLoadSCRIPT" script to them. Set their linked ref as the book shelf container.
User avatar
Sammykins
 
Posts: 3330
Joined: Fri Jun 23, 2006 10:48 am

Post » Thu Jun 21, 2012 5:24 am

Ahh awesome thank you I'll try it out, just having a crash problem with the editor and not being able to travel out of the cell. Doh! also found a duplicate bookshelf on top of each other as well, although that didn't seem to cause any issues of the graphical variety.

I think I'm going to have to create a dummy cell just for the bookshelf(s) so that it's easier to re-create.

Ahh well, thanks for the tip I'll have a really nice looking library by the end of the day. (nice looking by which I mean functional, stocked and well lit.
User avatar
SamanthaLove
 
Posts: 3565
Joined: Mon Dec 11, 2006 3:54 am

Post » Thu Jun 21, 2012 8:16 pm

Update - It works but only after the bookshelf is interacted with, is there any way to activate the bookshelf container to activate itself when the cell is loaded?

I've tried looking at the existing scripts but bit scared to use them. It's not like I want to activate a bookshelf container (that's the closest I could think of) as I don't really want a pop up as soon as it's loaded. Perhaps a behind the scenes refresh while the player is getting their bearings.

Thanks for the help knowledgeable ones.
User avatar
Robert Jackson
 
Posts: 3385
Joined: Tue Nov 20, 2007 12:39 am

Post » Thu Jun 21, 2012 4:23 pm

Sidrat2010,

I am glad you started this thread because I am trying to set up a pre-populated bookshelf too. However, like you, I found that the books did not show up until I manually activated the bookshelf.

I was finally able to get it to work without manual activation by using the following script. Note that with this script you don't need to add the books to the cell or link any books to the bookshelf container. Instead, create a FormList and then drag the books you want from the Object Window into the formlist window. You will use this formlist as a property on the script.

This script should be attached to the Bookshelf Container of the bookshelf you want to populate. Then bring up the properties window and set the FormListOfBooks property to the formlist that contains the books you want to populate onto the shelf.

Spoiler

Scriptname PrePopulateBookshelf extends ObjectReference  {This script will prepopulate a bookshelf with books from a FormList. The script should be attached to the bookshelf container of the shelf you want to populate.}FormList Property FormListOfBooks  Auto  {A FormList containing the books to populate onto the bookshelf. Make sure this FormList does not contain more books than will fit on the shelf.}ObjectReference Property ShelfContainer Auto HiddenBool Property AlreadyLoaded = False Auto HiddenEvent OnCellLoad()	If AlreadyLoaded == False		Self.AddItem(FormListOfBooks, 1, True)		Utility.Wait(1)		ShelfContainer = Self		(ShelfContainer as PlayerBookShelfContainerScript).UpdateBooks()		AlreadyLoaded = True	EndIfEndEvent

This is still not quite perfect since upon entering the cell for the first time, if the bookshelf is in sight, you will see the books pop onto the shelf. But at least you don't have to manually activate the shelf.
User avatar
Jeff Tingler
 
Posts: 3609
Joined: Sat Oct 13, 2007 7:55 pm

Post » Thu Jun 21, 2012 8:09 pm

DonB312

Thanks for the above information - Tried it once, nothing appeared - knew I made a mistake but didn't know where. Read the instructions again and voila, important to read and understand the three step process - Formlist, script and the property setting. I also had to create (so far) six book shelf containers so I could keep it unique.

I now have two bookcases with the 90 skill books sitting nicely on the shelf (15 books per shelf, easier to fit than 18).

I set the formlist in the order of the skill books themselves (skillsneak1 - skillsneak5 for example) along with the other two skill book sets, however I'm not sure how they're organised on the shelf itself in game, I would like them to appear in the same order as the formlist itself. Haven't really looked in to doing that of course as I just want to say.

Thank you.

I've actually succeeded in creating and using six scripts properly and understanding what each line was supposed to do.

Moving forward, would it be possible to populate a bookshelf only with books from a particular form list if it's in the players inventory? I'm sure it would be possible.

The aim.

Create an organised book repository based on the genre of the book itself, that the player will populate once they're found of course. Something like

Player inventory.remove() where inventory.item = formlistID


(I've done SQL database > Excel formula creating)

It would mean creating a graphical sign to guide the player to the right book case so they knew where each book lives. Oh and of course making sure each and every ingame book has an entry, but thankfully I have the Official Game Guide and can get the list from there.

Thank you again.
User avatar
Nick Pryce
 
Posts: 3386
Joined: Sat Jul 14, 2007 8:36 pm

Post » Thu Jun 21, 2012 8:07 pm

Found the thread I started about automatically sorting items, with a bit of a tweak it could be used to compare items on a formlist and only take the items if it exists in your inventory and the formlist

http://www.gamesas.com/topic/1372817-automatic-sorting-of-items/page__fromsearch__1
User avatar
Myles
 
Posts: 3341
Joined: Sun Oct 21, 2007 12:52 pm

Post » Thu Jun 21, 2012 7:30 pm

It seems it was already on the wiki

http://www.creationkit.com/Complete_Example_Scripts#Script_a_container_that_only_accepts_certain_types_of_items

That code works just as well on a book shelf or any container with a valid formlist attached as it's property setting.

So Ultimately I really want to get a button that I can press and any 3d object that I'm not wearing gets sorted in to it's own container so that the player can actually get on with the adventuring instead of looking at inventory windows.

So I believe a button will be required attached to an invisible container bookshelf container (called InventorySorterContainer or ISC) with the script removed. when the player presses the button all the players inventory is moved to the ISC where another script will be used that checks the id against a set of formlists and moves it to the right container. All remaining items in the ISC is returned back the player.

So that's two scripts, any ideas

At least the ISC will contain something like this

Spoiler


Scriptname SidWeapIron extends ObjectReference
FormList Property SidWeapIronList Auto

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
If akSourceContainer == Game.GetPlayer()
If !SidWeapIronList.HasForm(akBaseItem)
RemoveItem(akBaseItem, aiItemCount, True, akSourceContainer)
Debug.notification("This Can Only Hold Iron Weapons")
EndIf
Endif
EndEvent
User avatar
MARLON JOHNSON
 
Posts: 3377
Joined: Sun May 20, 2007 7:12 pm

Post » Thu Jun 21, 2012 8:05 pm

In relation to the above I'm having trouble fully understanding how this works


RemoveAllItems(ObjectReference akTransferTo = None, bool abKeepOwnership = false, bool abRemoveQuestItems = false)

Specifically the ObjectReference akTransferTo = None

Why does it need an object reference when it's removing all (non quest) items anyway, and what must I do in order for the items to get from the player to a chest.

For comedy purposes I have the following code

Scriptname SidEmptyPlayerInv extends ObjectReference; This will remove the players inventory and put it in to the SidAllItems chest.ObjectReference SidAllItemsEvent OnActivate(ObjectReference SidButtonSorter)              Game.getplayer().RemoveAllItems(aktransferto=SidAllItems, abKeepOwnership = True)              Debug.Notification("All Non Quest Items should have been removed and put in the chest")EndEvent

I know there's something very important I'm missing, oh of course this is attached to a button. Should I have parent/ref links to the chest item (I believe I do) just what is it??

The ultimate aim is to provide the player with several chests and containers around the room and one button which when pressed will remove all inventory items (do you know I'm not sure if it removes what's equipped as well!), and places them in specific named containers.

It will make pack rat lives much easier.
User avatar
Tania Bunic
 
Posts: 3392
Joined: Sun Jun 18, 2006 9:26 am


Return to V - Skyrim