Staller2000 Posted July 2, 2022 Share Posted July 2, 2022 I'm trying to make a simple mod to add car windows to the loot pools for mechanics / car supply stores. I have a file called CarWindowProceduralDistributions.lua under media>lua>server>items here local function preDistributionMerge() ProceduralDistributions.list.CarWindowsAll = { rolls = 10, items = { "FrontWindow1", 50, "RearWindow1", 50, "RearWindshield1", 50, "Windshield1", 50, "FrontWindow2", 50, "RearWindow2", 50, "RearWindshield2", 50, "Windshield2", 50, "FrontWindow3", 50, "RearWindow3", 50, "RearWindshield3", 50, "Windshield3", 50, } } end Events.OnPreDistributionMerge.Add(preDistributionMerge); and CarWindowDistributions.lua, also under media>lua>server>items local carWindowDistributionTable = { all = { crate = { procedural = true, procList = { {name="CarWindowsAll", min=3,max=5}, } }, metal_shelves = { procedural = true, procList = { {name="CarWindowsAll", min=3,max=5}, } }, shelves = { procedural = true, procList = { {name="CarWindowsAll", min=3,max=5}, } }, } } table.insert(Distributions, 2, carWindowDistributionTable); But none of the items are appearing in-game. I don't see any obvious syntax errors, and no errors are being logged. All loots settings on the world are set to abundant so I would assume at least one roll would land. Any help would be appreciated. Thanks! Link to comment Share on other sites More sharing options...
RingoD123 Posted July 3, 2022 Share Posted July 3, 2022 Your proceduraldistributions.lua is missing a comma after the closing bracket for the items, it should look like this: "Windshield3", 50, }, } Apart from that it looks like it should work as long as you have actually added your items to the game using a base script as outlined at the start of this guide: If so then all i'd say is that the only place you are telling the new items to spawn is in rooms that do not have a specific room definition and also contain a shelf, metal shelf or a crate, which is probable not many places, if any. Link to comment Share on other sites More sharing options...
Staller2000 Posted July 3, 2022 Author Share Posted July 3, 2022 (edited) Thanks for your help. All the windows I'm trying to spawn are vanilla items, am I maybe not referencing them correctly or do I still need to add a script for them? I fixed the missing comma, updated the distribution to include carsupply and mechanic roomdefs (I think I did that correctly,) but I'm still not seeing any spawns. I posted the updated code below for reference. require 'Items/ProceduralDistributions' local function preDistributionMerge() ProceduralDistributions.list.CarWindowsAll = { rolls = 10, items = { "FrontWindow1", 200, "RearWindow1", 200, "RearWindshield1", 200, "Windshield1", 200, "FrontWindow2", 200, "RearWindow2", 200, "RearWindshield2", 200, "Windshield2", 200, "FrontWindow3", 200, "RearWindow3", 200, "RearWindshield3", 200, "Windshield3", 200, }, } end Events.OnPreDistributionMerge.Add(preDistributionMerge); require 'Items/Distributions' local carWindowDistributionTable = { mechanic = { crate = { procedural = true, procList = { {name="CarWindowsAll", min=3,max=5}, } }, metal_shelves = { procedural = true, procList = { {name="CarWindowsAll", min=3,max=5}, } }, shelves = { procedural = true, procList = { {name="CarWindowsAll", min=3,max=5}, } }, }, carsupply = { crate = { procedural = true, procList = { {name="CarWindowsAll", min=3,max=5}, } }, metal_shelves = { procedural = true, procList = { {name="CarWindowsAll", min=3,max=5}, } }, shelves = { procedural = true, procList = { {name="CarWindowsAll", min=3,max=5}, } }, }, } table.insert(Distributions, 2, carWindowDistributionTable); Edited July 3, 2022 by Staller2000 Found answer Link to comment Share on other sites More sharing options...
RingoD123 Posted July 3, 2022 Share Posted July 3, 2022 Yeah just realised they are vanilla items, no script needed. Try removing the "require" lines from both files. Also in your CarWindowDistributions.lua add "weightChance=100" to each of your procList entries so that they all look like this: procList = { {name="CarWindowsAll", min=3,max=5, weightChance=100}, If you are still having trouble seeing them in game then remember you can use debug mode to make sure you are in a correct roomdef for the items to spawn. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now