As the title suggests, I've been trying to pre-stock the bookshelves in my player home with some goodies. I've discovered that adding them in directly to the bookshelf container results in them not displaying or counting towards the total. Likewise, adding them to the shelf and the container results in duplicate books when the container is updated in-game.
To get around this, I've written a script that can be added to the bookshelf container that adds the books using OnCellLoad - this does about half the job: the container count is accurate, and the books are in the container, but I still can't get them to display. I ended up pillaging a bunch of code from the original PlayerBookshelfContainer script to try to make the books display, and it all compiles, but still the books won't display until after the player activates the shelf for the first time.
I've attached the full script, since posting it seems to trigger Cloudfare to fight me.
And here's the breakdown of the bits in question, as well as the troubleshooting I've done so far:
- This If statement is firing correctly, and Book01 is correctly defined, since the book is being added to the container:
If Book01 ThisChest.AddItem(Book01, 1, true) BookMarker01.PlaceAtMe(Book01) endIf
- BookMarker01 is defined as an ObjectReference, and BookShelfBook01 as a Keyword it references, same as in the default script:
Keyword Property BookShelfBook01 Auto ObjectReference Property BookMarker01 Auto Hidden
- Also just like in the original script, the connection between the two is defined inside the Event, like this:
BookMarker01 = GetLinkedRef(BookShelfBook01)
- And all the referenced Keywords are on the object like they should be, as you can see here:
As far as my amateur eyes can see, this should all be working, and as I said, it compiles fine, so my syntax appears to be correct. Any idea what I'm doing wrong? If not, is there a more elegant way to do this?
As always, thanks so much for your help!