One of the things that has annoyed me with vanilla Fallout 3 is the static placement of all the skill books. Which means that if you have the list, you can make beelines to those locations to get your skills up quickly. That's not really fun in the long run, and finding skill books laying around becomes a bit of a "ho-hum" experience on repeat plays.

I've always enjoyed the "Random Bobbleheads" mod. It takes all 20 bobbleheads, and then moves them to 1 of 5 random locations at the start of each game. That makes finding them a lot harder, and a much more pleasant surprise when you do stumble across one.

Last year, I had considered creating something similar for all of the skillbooks. But there are 13 variants and each has been placed at 23-25 locations in the world. To add another 75 locations for each of the 13 would have been insane. And the script to dig through all 1300 locations would have been a real CPU-hog, as it's an order of magnitude more difficult then the random bobblehead problem. So I looked at it, decided I didn't feel like placing almost 1000 books into the world and didn't feel like verifying the almost 375 already in-game; and shelved the concept.

Well, I've been doing some reading recently now that I finished "Deadlier Explosive Traps". It turns out that there's a fairly easy method to script each book individually and have it randomly turn itself off as you enter the cell for the first time (using the OnLoad block). With a bit of "flag magic" where you set a variable specific to that object and then check to make sure that it's still zero, you can fire off a one-time event whenever OnLoad is called. Typically, OnLoad only ever gets called once for a particular object, but the "flag magic" is still used to make doubly sure.

There's a minor glitch with quest-given books, however. Such as the book that you get from Moira when you finish at the RobCo factory. When a book is received directly into the player's inventory, OnLoad has yet to run. So when the player drops it to the ground, both OnDrop and OnLoad will fire. This meant that there was a random chance that in the process of dropping to the ground, my Big Book of Science that I got from Moira would vanish. Amusing, but not what I wanted. So I turned on the magic flag during the OnDrop event, which seems to run before the OnLoad event. There aren't too many quest-given books, however, so I'm not going to worry about it much. If it does stay an issue, I will change those quests to give unique copies of the books (just like Tulip in Underworld gives you "Paradise Lost" instead of the generic speech book).

Since books are only evaluated when the cell is first visited - this also lets me put into play the concept that a player's Luck attribute will control whether or not the book has a greater/lesser chance of appearing in that location. Players with low luck (Luck 1) will only find 15-16 copies of each book while players with high luck (Luck 10) will find 22-23 copies. An average player (Luck 5) will find about 19 copies of each book. Of course, the RNG may decide to be overly generous or decide not to drop any books at all, but with enough locations, it should work out in the long run.

This also means that I can roll this mod out in stages. Initially, with the default of about 24 book locations per type, I can set the base chance at 60%, plus 3% for every point of player Luck. Which will max out at around 90% or 93% (Luck 11). So a low-luck player will see ~15 books and a max-luck player sees ~22 of each type. As I add more book locations to the world, I can change those values to that we stay in the 15-22 range. At least, as long as I add even amounts of book spawns across all 13 book types.

So, the initial plan is:

1) Test out the code (mostly done, it's very simple code) and identify any basic issues (like quest-given skillbooks or skillbooks placed in containers such as Shalebridge).

2) Place 2 copies of every book in Megaton. This sounds like a bit of a cheat, but once I finish populating the rest of the wastes, you might only find a handful of books in Megaton. Especially if the player has a low Luck value at the start. But it also gives me a good test location.

3) Place 1-2 copies of every book in the places that young players visit. So Greyditch, Marigold Station, Springvale, Jury Street, etc. My ultimate goal is that there will be 10-12 additional copies of every book placed in the outer wastes. Places like Rivet City and Tenpenny Tower will probably receive 2 copies of every book.

If I get Megaton and the surroundings done, as well as Rivet City and TPT done (so there are now 5 extra copies of every book), then this will probably be the 1.00 release.

4) Tackle the metro tunnels. My goal here is to place 5-8 copies of every book in the metro tunnels.

5) Tackle the downtown locations. Hopefully I can fit another 5-8 copies of every book.

If I manage to get that far, it will mean that instead of 24 locations for every book, there will be closer to 50 locations. And since I don't have to do it all at once, I'm less likely to get burned out. With 50 locations and a goal of 15-22 books, that means the base Luck chance can change to 30% with a 1.5% increase for every point of Luck (46.5% for Luck 11). That will be a low enough chance that book placement will appear to be a lot more random then before.

Example of the OnDrop vs OnLoad issue:

It turns out that the OnLoad event gets called whenever OnDrop gets called. And since the book was inserted directly into my inventory by the quest, OnLoad had never been called before.

The numbers in the top left of the screen is output from a debug message that I use to keep track of what the RNG is doing and whether the book passed the luck test.

In the first try (where I discovered that OnLoad was being called), the RND value is less then the ChanceMin, so the book drops to the ground. In the second try, I specifically set the RND to 100; which means the book vanishes as it drops to the ground.