Jump to content

My health books won't spawn in the world?


Regisky

Recommended Posts

Hey, thanks for reading this. So first off, let me just tell you now, I have barely any programming background outside of a few classes I took in high school and modifying some mods to fit better with other's I play. However, I pretty much just researched how other literature mods worked and found that they work in the same way.

 

The issue isn't the books themselves, they work fine. But nonetheless I will post the code for them anyways, in case I overlooked something:


module HBM
{
imports
    {
        Base
    }

/* STRENGTH */


    item BookStrength1
    {
        NumberOfPages    =    220,
        Weight    =    0.8,
        Type    =    Literature,
        DisplayName    =    FBM_Str_1,
        Icon    =    FBStr,
        SkillTrained = Strength,
        LvlSkillTrained = 1,
        NumLevelsTrained = 2,
        StaticModel = Book,
    }

 

This goes on for each level of strength and fitness. As I said before, the books are in the game and recognized as items, textures work, they perform the task perfectly, but when it comes to distributing it that's what trips it up.

 

What doesn't make sense to me is that most other mods that I've looked at do the same thing and don't have any issues. Here's the HBMDistribution.lua file that I have

 


require 'Items/ProceduralDistributions'

--Bookstore/Libraries
table.insert(ProceduralDistributions["list"]["BookstoreBooks"].items, "HBM.BookStrength1");
table.insert(ProceduralDistributions["list"]["BookstoreBooks"].items, 8);
--Items cut out for redundancy's sake

table.insert(ProceduralDistributions["list"]["LibraryBooks"].items, "HBM.BookStrength1");
table.insert(ProceduralDistributions["list"]["LibraryBooks"].items, 5);
--Items cut out for redundancy's sake

 

--Living Room
table.insert(ProceduralDistributions["list"]["LivingRoomShelf"].items, "HBM.BookStrength1");
table.insert(ProceduralDistributions["list"]["LivingRoomShelf"].items, 5);
--Items cut out for redundancy's sake

 

--Lockers
table.insert(ProceduralDistributions["list"]["PoliceLockers"].items, "HBM.BookStrength1");
table.insert(ProceduralDistributions["list"]["PoliceLockers"].items, 9);
--Items cut out for redundancy's sake

table.insert(ProceduralDistributions["list"]["SchoolLockers"].items, "HBM.BookStrength1");
table.insert(ProceduralDistributions["list"]["SchoolLockers"].items, 8);
--Items cut out for redundancy's sake

[/spoiler]

 

As far as I know, these distributions should be working. I've even tested the mod with nothing but this one enabled and they still wouldn't pop up. Anybody happen to know if I missed anything somewhere?

 

Link to comment
Share on other sites

23 minutes ago, Regisky said:

Hey, thanks for reading this. So first off, let me just tell you now, I have barely any programming background outside of a few classes I took in high school and modifying some mods to fit better with other's I play. However, I pretty much just researched how other literature mods worked and found that they work in the same way.

 

The issue isn't the books themselves, they work fine. But nonetheless I will post the code for them anyways, in case I overlooked something:
 

  Reveal hidden contents

 

 

This goes on for each level of strength and fitness. As I said before, the books are in the game and recognized as items, textures work, they perform the task perfectly, but when it comes to distributing it that's what trips it up.

 

What doesn't make sense to me is that most other mods that I've looked at do the same thing and don't have any issues. Here's the HBMDistribution.lua file that I have

 

 

  Hide contents

 

require 'Items/ProceduralDistributions'

--Bookstore/Libraries
table.insert(ProceduralDistributions["list"]["BookstoreBooks"].items, "HBM.BookStrength1");
table.insert(ProceduralDistributions["list"]["BookstoreBooks"].items, 8);
--Items cut out for redundancy's sake

table.insert(ProceduralDistributions["list"]["LibraryBooks"].items, "HBM.BookStrength1");
table.insert(ProceduralDistributions["list"]["LibraryBooks"].items, 5);
--Items cut out for redundancy's sake

 

--Living Room
table.insert(ProceduralDistributions["list"]["LivingRoomShelf"].items, "HBM.BookStrength1");
table.insert(ProceduralDistributions["list"]["LivingRoomShelf"].items, 5);
--Items cut out for redundancy's sake

 

--Lockers
table.insert(ProceduralDistributions["list"]["PoliceLockers"].items, "HBM.BookStrength1");
table.insert(ProceduralDistributions["list"]["PoliceLockers"].items, 9);
--Items cut out for redundancy's sake

table.insert(ProceduralDistributions["list"]["SchoolLockers"].items, "HBM.BookStrength1");
table.insert(ProceduralDistributions["list"]["SchoolLockers"].items, 8);
--Items cut out for redundancy's sake

[/spoiler]

 

 

As far as I know, these distributions should be working. I've even tested the mod with nothing but this one enabled and they still wouldn't pop up. Anybody happen to know if I missed anything somewhere?

 

 

Looks like you are using the code that worked before update 41.53

Use this instead:

 

local function preDistributionMerge()
    table.insert(ProceduralDistributions.list.BookStoreBooks.items, "HBM.BookStrength1");
    table.insert(ProceduralDistributions.list.BookStoreBooks.items, 8);
    table.insert(ProceduralDistributions.list.LibraryBooks.items, "HBM.BookStrength1");
    table.insert(ProceduralDistributions.list.LibraryBooks.items, 5);
end
Events.OnPreDistributionMerge.Add(preDistributionMerge);

 

The above code is how you add new items to the procedural distributions in 41.53 and above, just make sure your rolls are sufficient to get them to spawn often enough, it's also a good idea to use sandbox mode and set loot options to abundant, this should make it easier to find your items in places you added them.

Link to comment
Share on other sites

 

6 hours ago, RingoD123 said:

 

Looks like you are using the code that worked before update 41.53

Use this instead:

 

local function preDistributionMerge()
    table.insert(ProceduralDistributions.list.BookStoreBooks.items, "HBM.BookStrength1");
    table.insert(ProceduralDistributions.list.BookStoreBooks.items, 8);
    table.insert(ProceduralDistributions.list.LibraryBooks.items, "HBM.BookStrength1");
    table.insert(ProceduralDistributions.list.LibraryBooks.items, 5);
end
Events.OnPreDistributionMerge.Add(preDistributionMerge);

 

The above code is how you add new items to the procedural distributions in 41.53 and above, just make sure your rolls are sufficient to get them to spawn often enough, it's also a good idea to use sandbox mode and set loot options to abundant, this should make it easier to find your items in places you added them.

 

This still didn't seem to work, even with other mods off and sandbox settings set to abundant. Do I still need to require items/ProceduralDistribution?

Link to comment
Share on other sites

1 hour ago, Regisky said:

 

 

This still didn't seem to work, even with other mods off and sandbox settings set to abundant. Do I still need to require items/ProceduralDistribution?

No. The lists you are adding your books to already have a lot of items in them with a relatively small amount of rolls. You could try upping the rolls of the lists you are adding to or significantly raise the weight you are attributing to your items to make them a lot more likely to be rolled.

Also, make sure your HBMdistribution.lua is placed in your mods "media\lua\server\items" folder.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...