RingoD123 Posted July 21, 2021 Posted July 21, 2021 (edited) Here is an example of a simple map mod using custom room definitions, custom loot zones and custom procedural distribution lists using the new loot distribution system (41.51+). 3 gas stations have been placed in a cell intended to be added to the vanilla map via a map mod, the Northern most station has a custom loot zone placed over it as shown below: It's best to use lootZone names that will be unique to your map mod to stop any possible conflict with other map mods which could cause unintended loot to spawn. The Southern most station has a pre-existing roomDef that is already defined in the Distributions.lua file, the top 2 both have a custom roomDef as shown below: Again it's best to use roomdefinitions that will be unique to your map mod, otherwise other map mods might use the same as you and may cause conflicts, causing one or more maps to start spawning unintended loot. We have also added a new item into the game, a lootable map of this new area as per this guide: , but instead of adding the item to an existing procedural distribution entry or room def, we are instead going to add a custom procedural distribution entry along with a custom room definition to take advantage of the custom roomDef we used in the top 2 gas stations and the custom loot zone we placed on the Northern most station. First create and save a custom procedural distributions lua file such as MyMapModNameProceduralDistributions.lua in your mods "media/lua/server/items" folder, then use the following code: Spoiler local function preDistributionMerge() ProceduralDistributions.list.MagazineRackMapsRingo = { rolls = 6, items = { "MuldraughMap", 5, "WestpointMap", 5, "MarchRidgeMap", 5, "RosewoodMap", 5, "RiversideMap", 5, "BedfordMap", 5, "BedfordMap", 5, }, } end Events.OnPreDistributionMerge.Add(preDistributionMerge); In the above example we have added a new procedural distributions entry named "MagazineRackMapsRingo", we have specified how many rolls it gets and the items it rolls from, in this case the new lootable map we added as well as the base game maps, as well as the "weight" of each item, with a higher number being more likely to be rolled. Adding an item in multiple times is another good way of getting it to roll more than others. The next thing we need to do is create the new room Definition in a custom distributions lua file, like above, create and save a custom distributions lua file, such as MyMapModNameDistributions.lua in your "media/lua/server/items" folder, the use the following code, wherever you see "bedford", use your map mod name or something unique instead: Spoiler local bedforddistributionTable = { bedfordgasstation = { shelvesmag = { procedural = true, procList = { {name="MagazineRackMapsRingo", min=5, max=10, forceForZones="Unique", weightChance=100}, {name="MagazineRackMixed", min=2, max=5, forceForZones="Unique", weightChance=100}, {name="MagazineRackMapsRingo", min=1, max=5, weightChance=100}, {name="MagazineRackNewspaper", min=1, max=1, weightChance=100}, {name="MagazineRackMixed", min=0, max=99, weightChance=100}, } }, }, all = { shelvesmag = { procedural = true, procList = { {name="MagazineRackMaps", min=1, max=5, weightChance=100}, {name="MagazineRackNewspaper", min=1, max=1, weightChance=100}, {name="MagazineRackMixed", min=0, max=99, weightChance=100}, {name="MagazineRackMapsRingo", min=1, max=5, weightChance=100}, } }, } } table.insert(Distributions, 2, bedforddistributionTable); In the above example we have added a new entry for the "bedfordgasstation" roomDef we used in buildingEd and then defined what containers we would like it have rules for, in this case "shelvesmag" (any other containers in this room will take thier loot pulls from the "all" definition as we have not specified rules for them in this custom definition). We have then set it to procedural and defined it's procList. You can see that the first two lines of the procList use the forceForZones option which in this case is set to use the custom zone (Unique) we placed over the Northern most gas station, meaning that particular gas station has a different set of loot than the middle one, which has the exact same roomDef. The next 4 lines will govern the loot for the middle gas station as it has the same custom roomDef but not the custom lootZone. In this example the changes are small but you can imagine how you could make them wildly different and include rules for many more containers. Lastly we have also added an updated proclist for the existing shelvesmag containers in the "all" room definition to also pull from our new Procedural Distributions entry, this will apply to the Southern most gas station as it still uses the fossoil room def which does not have any rules for the shelvesmag container so therefore pulls it shelvesmag loot from the "all" definition. This is just a basic example, but hopefully with a bit of imagination you can see how you can now define your map mod and loot as much as you like. There is also a brilliant visual guide by @TheCommanderwhich can be found here: Edited July 11, 2022 by RingoD123 added weightchance to distributions.lua
Erivan Posted August 5, 2021 Posted August 5, 2021 (edited) Is there a tutorial available somwhere that shows how to add a custom procedural distribution list to an existing room definition? I can't seem to find one, and i feel like ive hit a wall trying to acomplish this. Edited August 5, 2021 by Erivan
RingoD123 Posted August 5, 2021 Author Posted August 5, 2021 7 hours ago, Erivan said: Is there a tutorial available somwhere that shows how to add a custom procedural distribution list to an existing room definition? I can't seem to find one, and i feel like ive hit a wall trying to acomplish this. The above guide does. First create and save a custom procedural distributions lua file such as MyMapModNameProceduralDistributions.lua in your mods "media/lua/server/items" folder, then use the following code: local function preDistributionMerge() ProceduralDistributions.list.MagazineRackMapsRingo = { rolls = 6, items = { "MuldraughMap", 5, "WestpointMap", 5, "MarchRidgeMap", 5, "RosewoodMap", 5, "RiversideMap", 5, "BedfordMap", 5, "BedfordMap", 5, }, } end Events.OnPreDistributionMerge.Add(preDistributionMerge); That is an example of a new Procedural Distributions entry. Then you want to add that new entry to existing definitions: Like above, create and save a custom distributions lua file, such as MyMapModNameDistributions.lua in your "media/lua/server/items" folder, the use the following code, wherever you see "bedford", use your map mod name or something unique instead: local bedforddistributionTable = { all = { shelvesmag = { procedural = true, procList = { {name="MagazineRackNewspaper", min=1, max=5}, {name="MagazineRackMixed", min=2, max=99}, {name="MagazineRackMapsRingo", min=2, max=5}, } }, } } table.insert(Distributions, 2, bedforddistributionTable); In this example these two files will add a new Procedural Distribution definition and then add that new ProcDis to the existing shelvesmag container in the all room definition.
Erivan Posted August 5, 2021 Posted August 5, 2021 Hey Ringo, Thanks for taking the time to reply. If above code is working, i must simply be misunderstanding somthing. I have impletemented code extacly as specified, but the room definition to which i have added my custom procedural distribution list to, does'nt seem to pull from the list, even though i have specifically written (for testing purposes) that at least 1 of each item should spawn at least once in the container. local function preDistributionMerge() ProceduralDistributions.list.CustomList = { rolls = 1, items = { "CustomItemFile.CustomItem1", 100, "CustomItemFile.CustomItem2", 100, "CustomItemFile.CustomItem3", 100, "CustomItemFile.CustomItem4", 100, "CustomItemFile.CustomItem5", 100, }, } end Events.OnPreDistributionMerge.Add(preDistributionMerge); local customDistTable = { pharmacystorage = { metal_shelves = { procedural = true, procList = { {name="CustomList", min=1, max=6}, } }, } } table.insert(Distributions, 2, customDistTable); Is it simply a matter of checking enough containers till the items start showing up? Ive restarted a number of times and checked viable containers, but i still havnt seen the custom items. Any insights would be appreciated.
RingoD123 Posted August 5, 2021 Author Posted August 5, 2021 24 minutes ago, Erivan said: Hey Ringo, Thanks for taking the time to reply. If above code is working, i must simply be misunderstanding somthing. I have impletemented code extacly as specified, but the room definition to which i have added my custom procedural distribution list to, does'nt seem to pull from the list, even though i have specifically written (for testing purposes) that at least 1 of each item should spawn at least once in the container. local function preDistributionMerge() ProceduralDistributions.list.CustomList = { rolls = 1, items = { "CustomItemFile.CustomItem1", 100, "CustomItemFile.CustomItem2", 100, "CustomItemFile.CustomItem3", 100, "CustomItemFile.CustomItem4", 100, "CustomItemFile.CustomItem5", 100, }, } end Events.OnPreDistributionMerge.Add(preDistributionMerge); local customDistTable = { pharmacystorage = { metal_shelves = { procedural = true, procList = { {name="CustomList", min=1, max=6}, } }, } } table.insert(Distributions, 2, customDistTable); Is it simply a matter of checking enough containers till the items start showing up? Ive restarted a number of times and checked viable containers, but i still havnt seen the custom items. Any insights would be appreciated. Your procedural Distribution specifies that only 1 item total will be rolled per container, not one of each. Your distribution specifies that it only has to roll for a single container of that type within a pharmacystorage roomdef, and up to a max of 6 containers. So the way you currently have it means that it would only spawn a single CustomItem each on anywhere between 1 to 6 metal shelves.
GunNut Posted August 12, 2021 Posted August 12, 2021 (edited) Hello i've tried this code, but it doesn't work. What could possibly be wrong? Is there any other way to modify already existing vanilla procedural distribution entries? Disregard the 100 chance its for testing purposes only. Quote local function preDistributionMerge() ProceduralDistributions.list.BarCounterWeapon = { rolls = 4, items = { }, junk = { rolls = 3, items = { --"Bag_ShotgunDblSawnoffBag", 5, --"BaseballBat", 50, "VarmintRifle", 100, } } }, ProceduralDistributions.list.CampingStoreGuns = { rolls = 2, items = { "DoubleBarrelShotgun", 5, "Shotgun", 5, "Mossberg590", 5, "Remington870Wood", 5, "Winchester94", 5, "Winchester73", 5, "HuntingRifle", 3, "Rugerm7722", 5, "VarmintRifle", 3, "223Box", 40, "308Box", 40, "22LRBox", 40, "Bullets44Box", 40, "4440Box", 40, "ShotgunShellsBox", 40, }, junk = { rolls = 2, items = { "Sling", 5, "Sling_Leather", 5, "IronSight", 5, "x2Scope", 8, "x4Scope", 5, "x8Scope", 5, "ChokeTubeFull", 5, "ChokeTubeImproved", 5, "RecoilPad", 2, "ExtendedRecoilPad", 2, "Rifle_Bipod", 5, "GunToolKit", 2, "Solvent", 2, } } }, ProceduralDistributions.list.CrateCamping = { rolls = 2, items = { "DoubleBarrelShotgun", 5, "Shotgun", 5, "Mossberg590", 5, "Remington870Wood", 5, "Winchester94", 5, "Winchester73", 5, "HuntingRifle", 3, "Rugerm7722", 5, "VarmintRifle", 3, "223Box", 40, "308Box", 40, "22LRBox", 40, "Bullets44Box", 40, "4440Box", 40, "ShotgunShellsBox", 40, }, junk = { rolls = 2, items = { "Sling", 5, "Sling_Leather", 5, "IronSight", 5, "x2Scope", 8, "x4Scope", 5, "x8Scope", 5, "ChokeTubeFull", 5, "ChokeTubeImproved", 5, "RecoilPad", 2, "ExtendedRecoilPad", 2, "Rifle_Bipod", 5, "GunToolKit", 2, "Solvent", 2, } } }, ProceduralDistributions.list.StoreShelfMechanics = { items = { "Solvent", 5, } }, ProceduralDistributions.list.MechanicShelfMisc = { items = { "Solvent", 5, }, }, ProceduralDistributions.list.FirearmWeapons = { rolls = 2, items = { "Bag_WeaponBag", 8, "MP5", 3, "UZI", 3, "AssaultRifle", 2, "FN_FAL", 2, "M24Rifle", 2, "Mossberg590Tactical", 3, }, junk = { rolls = 4, items = { "223Box", 40, "308Box", 40, "Bullets45Box", 40, "Bullets9mmBox", 40, "22LRBox", 40, "Bullets44Box", 40, "4440Box", 40, "ShotgunShellsBox", 40, } } }, ProceduralDistributions.list.LockerArmyBedroom = { rolls = 4, items = { "Pistol", 1.5, "PistolCase1", 0.5, "Bullets9mmBox", 4, "HolsterSimple", 4, "HuntingKnife", 4, "Bag_ALICEpack_Army", 1, "Trousers_ArmyService", 1, "Shorts_CamoGreenLong", 1, "Trousers_CamoDesert", 1, "Trousers_CamoGreen", 1, "Trousers_CamoUrban", 1, "Shirt_CamoDesert", 1, "Shirt_CamoGreen", 1, "Shirt_CamoUrban", 1, "Tshirt_CamoDesert", 1, "Tshirt_CamoGreen", 1, "Tshirt_CamoUrban", 1, "Vest_BulletArmy", 0.5, "Jacket_CoatArmy", 1, "Jacket_ArmyCamoDesert", 1, "Jacket_ArmyCamoGreen", 1, "Shoes_ArmyBoots", 1, "Shoes_ArmyBootsDesert", 1, } }, ProceduralDistributions.list.PlankStashGun = { rolls = 6, items = { "PistolCase1", 15, "PistolCase2", 10, "PistolCase3", 6, } }, ProceduralDistributions.list.WardrobeMan = { rolls = 6, items = { "Pistol", 100, "Pistol2", 100, "Pistol3", 100, "Glock17", 100, "Glock17Mag", 100, "ColtPeacemaker", 100, "Revolver", 100, "Revolver_Long", 100, "Revolver_Short", 100, "Bullets38Box", 100, "Bullets44Box", 100, "Bullets45Box", 100, "Bullets9mmBox", 100, "4440Box", 100, "44Clip", 100, "45Clip", 100, "9mmClip", 100, "Shotgun", 100, "DoubleBarrelShotgun", 100, "Mossberg590", 100, "Winchester73", 100, "Winchester94", 100, "Rugerm7722", 100, "HuntingRifle", 100, "VarmintRifle", 100, "308Box", 100, "223Box", 100, "22LRBox", 100, "4440Box", 100, "Bullets44Box", 100, "ShotgunShellsBox", 100, }, junk = { rolls = 2, items = { "ClosedUmbrellaRed", 0.3, "ClosedUmbrellaBlue", 0.3, "ClosedUmbrellaBlack", 0.3, "ClosedUmbrellaWhite", 0.3, "AlarmClock2", 2, "Disc", 0.5, "CDplayer", 0.5, "Earbuds", 0.5, "Headphones", 0.5, "VideoGame", 0.5, "Pillow", 9, "Belt2", 6, "Socks_Ankle", 4, "Socks_Ankle", 4, "Socks_Long", 2, } } }, ProceduralDistributions.list.WardrobeManClassy = { rolls = 6, items = { "Pistol", 100, "Pistol2", 100, "Pistol3", 100, "Glock17", 100, "Glock17Mag", 100, "ColtPeacemaker", 100, "Revolver", 100, "Revolver_Long", 100, "Revolver_Short", 100, "Bullets38Box", 100, "Bullets44Box", 100, "Bullets45Box", 100, "Bullets9mmBox", 100, "4440Box", 100, "44Clip", 100, "45Clip", 100, "9mmClip", 100, "Shotgun", 100, "DoubleBarrelShotgun", 100, "Mossberg590", 100, "Winchester73", 100, "Winchester94", 100, "Rugerm7722", 100, "HuntingRifle", 100, "VarmintRifle", 100, "308Box", 100, "223Box", 100, "22LRBox", 100, "4440Box", 100, "Bullets44Box", 100, "ShotgunShellsBox", 100, }, junk = { rolls = 2, items = { "ClosedUmbrellaRed", 0.3, "ClosedUmbrellaBlue", 0.3, "ClosedUmbrellaBlack", 0.3, "ClosedUmbrellaWhite", 0.3, "AlarmClock2", 2, "Disc", 0.5, "CDplayer", 0.5, "Earbuds", 0.5, "Headphones", 0.5, "VideoGame", 0.5, "Pillow", 9, "Belt2", 6, "Socks_Ankle", 4, "Socks_Ankle", 4, "Socks_Long", 2, } } }, ProceduralDistributions.list.WardrobeRedneck = { rolls = 6, items = { "Pistol", 100, "Pistol2", 100, "Pistol3", 100, "Glock17", 100, "Glock17Mag", 100, "ColtPeacemaker", 100, "Revolver", 100, "Revolver_Long", 100, "Revolver_Short", 100, "Bullets38Box", 100, "Bullets44Box", 100, "Bullets45Box", 100, "Bullets9mmBox", 100, "4440Box", 100, "44Clip", 100, "45Clip", 100, "9mmClip", 100, "Shotgun", 100, "DoubleBarrelShotgun", 100, "Mossberg590", 100, "Winchester73", 100, "Winchester94", 100, "Rugerm7722", 100, "HuntingRifle", 100, "VarmintRifle", 100, "308Box", 100, "223Box", 100, "22LRBox", 100, "4440Box", 100, "Bullets44Box", 100, "ShotgunShellsBox", 100, }, junk = { rolls = 2, items = { "Disc", 0.5, "CDplayer", 0.5, "Earbuds", 0.5, "Headphones", 0.5, "VideoGame", 0.5, "Pillow", 9, "Belt2", 6, "Socks_Ankle", 4, "Socks_Ankle", 4, "Socks_Long", 2, } } }, ProceduralDistributions.list.WardrobeWoman = { rolls = 6, items = { "Pistol", 100, "Pistol2", 100, "Pistol3", 100, "Glock17", 100, "Glock17Mag", 100, "ColtPeacemaker", 100, "Revolver", 100, "Revolver_Long", 100, "Revolver_Short", 100, "Bullets38Box", 100, "Bullets44Box", 100, "Bullets45Box", 100, "Bullets9mmBox", 100, "4440Box", 100, "44Clip", 100, "45Clip", 100, "9mmClip", 100, "Shotgun", 100, "DoubleBarrelShotgun", 100, "Mossberg590", 100, "Winchester73", 100, "Winchester94", 100, "Rugerm7722", 100, "HuntingRifle", 100, "VarmintRifle", 100, "308Box", 100, "223Box", 100, "22LRBox", 100, "4440Box", 100, "Bullets44Box", 100, "ShotgunShellsBox", 100, }, junk = { rolls = 2, items = { "Purse", 2, "Handbag", 2, "ClosedUmbrellaRed", 0.3, "ClosedUmbrellaBlue", 0.3, "ClosedUmbrellaBlack", 0.3, "ClosedUmbrellaWhite", 0.3, "AlarmClock2", 2, "Disc", 0.5, "CDplayer", 0.5, "Earbuds", 0.5, "Headphones", 0.5, "VideoGame", 0.5, "Pillow", 9, "Belt2", 6, "Socks_Ankle", 4, "Socks_Ankle", 4, "Socks_Long", 2, } } }, ProceduralDistributions.list.WardrobeWomanClassy = { rolls = 6, items = { "Pistol", 100, "Pistol2", 100, "Pistol3", 100, "Glock17", 100, "Glock17Mag", 100, "ColtPeacemaker", 100, "Revolver", 100, "Revolver_Long", 100, "Revolver_Short", 100, "Bullets38Box", 100, "Bullets44Box", 100, "Bullets45Box", 100, "Bullets9mmBox", 100, "4440Box", 100, "44Clip", 100, "45Clip", 100, "9mmClip", 100, "Shotgun", 100, "DoubleBarrelShotgun", 100, "Mossberg590", 100, "Winchester73", 100, "Winchester94", 100, "Rugerm7722", 100, "HuntingRifle", 100, "VarmintRifle", 100, "308Box", 100, "223Box", 100, "22LRBox", 100, "4440Box", 100, "Bullets44Box", 100, "ShotgunShellsBox", 100, }, junk = { rolls = 2, items = { "ClosedUmbrellaRed", 0.3, "ClosedUmbrellaBlue", 0.3, "ClosedUmbrellaBlack", 0.3, "ClosedUmbrellaWhite", 0.3, "AlarmClock2", 2, "Disc", 0.5, "CDplayer", 0.5, "Earbuds", 0.5, "Headphones", 0.5, "VideoGame", 0.5, "Pillow", 9, "Belt2", 6, "Socks_Ankle", 4, "Socks_Ankle", 4, "Socks_Long", 2, } } }, ProceduralDistributions.list.GarageGuns = { rolls = 2, items = { "Pistol", 100, "Pistol2", 100, "Pistol3", 100, "Glock17", 100, "ColtPeacemaker", 100, "Revolver", 100, "Revolver_Long", 100, "Revolver_Short", 100, "Shotgun", 100, "DoubleBarrelShotgun", 100, "Mossberg590", 100, "Winchester73", 100, "Winchester94", 100, "Rugerm7722", 100, "HuntingRifle", 100, "VarmintRifle", 100, }, junk = { rolls = 2, items = { "308Box", 100, "223Box", 100, "22LRBox", 100, "4440Box", 100, "Bullets38Box", 100, "Bullets44Box", 100, "Bullets45Box", 100, "Bullets9mmBox", 100, "ShotgunShellsBox", 100, "44Clip", 100, "45Clip", 100, "9mmClip", 100, "Glock17Mag", 100, } } }, end Events.OnPreDistributionMerge.Add(preDistributionMerge); -- -- all = clothingStores; -- -- clothesstore = clothingStores; --table.insert(ProceduralDistributions, proceduralList); --for mod compat: --ProceduralDistributions = distributionTable; Edited August 12, 2021 by GunNut
RingoD123 Posted August 12, 2021 Author Posted August 12, 2021 5 hours ago, GunNut said: Hello i've tried this code, but it doesn't work. What could possibly be wrong? Is there any other way to modify already existing vanilla procedural distribution entries? Disregard the 100 chance its for testing purposes only. In what way does it not work? Are you getting any errors from it in your console log? Some of your entries don't have rolls in them, some only have a small amount of rolls (meaning they will only spawn 1-2 items at max). 100 does not mean a 100% chance, it is a weight, meaning it will be more likely to be rolled than items with a smaller weight. All of these values are also changed by your games loot settings, for example if using sandbox mode and you set all loot to rare, you will get less loot spawning than the values in your distribution entries.
GunNut Posted August 13, 2021 Posted August 13, 2021 I don't get errors, the .log from users/zomboid folder says that merging was correct, but i can't find these items! Only when i edit the original proceduraldistributions from zomboid folder i get everything working correctly. For example "sidetable" entry works correctly in my mod, because its in distributions.lua, but anything i put in my proceduraldistributions file, the one from my earlier post is not showing. I really don't understand this. I check wardrobes in bedrooms, and i can't find any guns/items i've listed. I assume they should spawn in these big two container wardrobes that are sometimes found in bedrooms.
RingoD123 Posted August 13, 2021 Author Posted August 13, 2021 1 hour ago, GunNut said: I don't get errors, the .log from users/zomboid folder says that merging was correct, but i can't find these items! Only when i edit the original proceduraldistributions from zomboid folder i get everything working correctly. For example "sidetable" entry works correctly in my mod, because its in distributions.lua, but anything i put in my proceduraldistributions file, the one from my earlier post is not showing. I really don't understand this. I check wardrobes in bedrooms, and i can't find any guns/items i've listed. I assume they should spawn in these big two container wardrobes that are sometimes found in bedrooms. So you have a "media/lua/server/items" folder in your mod structure yes? and you have both a "mydistributions.lua" file and a "myproceduraldistributions.lua file in there? The code in your "mydistributions.lua" works but you cant find the items you're adding through your "myproceduraldistributions.lua" file in bedroom wardrobes? Have you tried adding an edited version of the "bedroom" "Wardrobe" definition in your "mydistributions.lua" file to increase the "min" values to 1 or more on the proclist entries?
Nebula Posted August 15, 2021 Posted August 15, 2021 SMDistribution.lua local function preDistributionMerge() -- Smoker mod Trash ProceduralDistributions.list.SmokerModItemsTrash = { rolls = 7, items = { "SM.SMButt", 10, "SM.SMButt2", 10, "SM.SMEmptyPack", 10, "SM.SMEmptyPackLight", 10, "SM.SMEmptyPackMenthol", 10, "SM.SMEmptyPackGold", 10, "SM.EmptyMatchbox", 10, }, } -- Smoker mod Zombie Items ProceduralDistributions.list.SmokerModZombieItems = { rolls = 1, items = { "SM.Matches", 100, "SM.SMPack", 100, "SM.SMPackLight", 100, "SM.SMPackMenthol", 100, "SM.SMPackGold", 100, }, } end Events.OnPreDistributionMerge.Add(preDistributionMerge); SMPoceduralDistribution.lua local SmokerModDistTable = { all = { bin = { procedural = true, procList = { {name="SmokerModItemsTrash", min=1, max=10}, } }, inventorymale = { procedural = true, procList = { {name="SmokerModZombieItems", min=0, max=1}, } }, inventoryfemale = { procedural = true, procList = { {name="SmokerModZombieItems", min=0, max=1}, } }, } } table.insert(Distributions, 2, SmokerModDistTable); Yes, the item distribution is finally working, but I have questions. In killed zombies, the entire list of items specified in SmokerModZombieItems appears, how to limit, for example, two items? Another oddity is that objects in zombies that are killed outside (outside the premises) never appear, while when killing zombies indoors, objects are guaranteed to appear, the same applies to dumpsters.
GunNut Posted August 19, 2021 Posted August 19, 2021 Thank you @RingoD123i've removed commas between ProceduralDistributions.list entries, added rolls where they were missing, upped the min and max values in distributions.lua and not everything works just fine.
weisspure Posted November 30, 2021 Posted November 30, 2021 I have a question about the following line: Why position 2 in distributions? Is there consideration that needs to be taken for what other mods authors are doing in regards to the distribution tables? table.insert(Distributions, 2, customDistTable); I've noticed the following lines of code in one mod breaks distribution for another, any idea why? Apologies for my inexperience, I usually write with c# and JS so lua is new to me: table.insert(Distributions, 1, distributionTable); --for mod compat: SuburbsDistributions = distributionTable;
RingoD123 Posted December 2, 2021 Author Posted December 2, 2021 On 11/30/2021 at 11:22 AM, weisspure said: I have a question about the following line: Why position 2 in distributions? Is there consideration that needs to be taken for what other mods authors are doing in regards to the distribution tables? table.insert(Distributions, 2, customDistTable); I've noticed the following lines of code in one mod breaks distribution for another, any idea why? Apologies for my inexperience, I usually write with c# and JS so lua is new to me: table.insert(Distributions, 1, distributionTable); --for mod compat: SuburbsDistributions = distributionTable; Using 2 in that line guarantees that your mod gets added to the loot tables after the vanilla items do.
weisspure Posted December 3, 2021 Posted December 3, 2021 (edited) I see, so in lua table.insert() will handle the other table's record's indexes and a quick google search confirmed that, this makes sense. Edit: One thing actually I'm not clear on: If the Vanilla loot tables are [0] what's in [1]? Or vice versa Thanks for your reply! One last question relatedto this topic Is SuburbsDistribution still a valid table as I didn't see it on the new containers list for 41.53? Edited December 3, 2021 by weisspure
Dazer Posted July 10, 2022 Posted July 10, 2022 I have 1 error When i see the conteiners in this room i made called "modihospitalroom" (in BE), all are empty. And i dont know why. Only the bathroom mirror have items and its not in my modihospitalroom code. 4 file pics to show my error.
RingoD123 Posted July 10, 2022 Author Posted July 10, 2022 Testing in debug can help a lot as it can show you what room definition a container is in, so you can make sure your room def is showing up correctly in game. You can also raise the loot settings in sandbox mode to make it more likely that loot will spawn in the containers you are wanting to test. Dazer 1
Dazer Posted July 10, 2022 Posted July 10, 2022 (edited) 1 hour ago, RingoD123 said: Testing in debug can help a lot as it can show you what room definition a container is in, so you can make sure your room def is showing up correctly in game. You can also raise the loot settings in sandbox mode to make it more likely that loot will spawn in the containers you are wanting to test. How can I do that? I know how to enter debug mode, but how can I see if my roomdef is showing up correctly? Some kind of window will show me that information? Update: "location_hospitality_Sunstarmotel_02_16" could that be the error? the floor i use in the room? even when a i specified "modihospitalroom" with BuildingE like a room Edited July 10, 2022 by Dazer update
RingoD123 Posted July 10, 2022 Author Posted July 10, 2022 1 hour ago, Dazer said: How can I do that? I know how to enter debug mode, but how can I see if my roomdef is showing up correctly? Some kind of window will show me that information? Update: "location_hospitality_Sunstarmotel_02_16" could that be the error? the floor i use in the room? even when a i specified "modihospitalroom" with BuildingE like a room When in game in debug mode press F2, the right hand window will show you what room def and zone your cursor is hovering over.
Dazer Posted July 11, 2022 Posted July 11, 2022 (edited) 8 hours ago, RingoD123 said: When in game in debug mode press F2, the right hand window will show you what room def and zone your cursor is hovering over. Well, all is perfect. The room def is the same and the zone is the correct. So why do I have an error? Something curious that I have noticed is that every time I add a new room or modify roomdef to the personalized distributions file, all the container that I add to that code end up without having anything inside. as if something was wrong in the code or something. For example: if i add "hospitalroom" and specify the conteiner and the loot inside them, all the conteiner always are empty when i play. but if i add 3 of the 4 containers on the room, that one container that i didn't add to the distribution.lua have items inside, but the other 3 no. The code is okay, I copied it from this same post. Edited July 11, 2022 by Dazer update
RingoD123 Posted July 11, 2022 Author Posted July 11, 2022 48 minutes ago, Dazer said: Well, all is perfect. The room def is the same and the zone is the correct. So why do I have an error? Something curious that I have noticed is that every time I add a new room or modify roomdef to the personalized distributions file, all the container that I add to that code end up without having anything inside. as if something was wrong in the code or something. For example: if i add "hospitalroom" and specify the conteiner and the loot inside them, all the conteiner always are empty when i play. but if i add 3 of the 4 containers on the room, that one container that i didn't add to the distribution.lua have items inside, but the other 3 no. The code is okay, I copied it from this same post. Just had a check myself and I need to update the guide. We need to be adding "weightChance=100" (or whatever you want the value to be) to the end of our "{name=" lines, so using my guide in the OP (which I will update) my distributions.lua would look like this: local bedforddistributionTable = { bedfordgasstation = { shelvesmag = { procedural = true, procList = { {name="MagazineRackMapsRingo", min=5, max=10, forceForZones="Unique", weightChance=100}, {name="MagazineRackMixed", min=2, max=5, forceForZones="Unique", weightChance=100}, {name="MagazineRackMapsRingo", min=1, max=5, weightChance=100}, {name="MagazineRackNewspaper", min=1, max=1, weightChance=100}, {name="MagazineRackMixed", min=0, max=99, weightChance=100}, } }, }, all = { shelvesmag = { procedural = true, procList = { {name="MagazineRackMaps", min=1, max=5, weightChance=100}, {name="MagazineRackNewspaper", min=1, max=1, weightChance=100}, {name="MagazineRackMixed", min=0, max=99, weightChance=100}, {name="MagazineRackMapsRingo", min=1, max=5, weightChance=100}, } }, } } table.insert(Distributions, 2, bedforddistributionTable);
RandomSelection Posted November 17 Posted November 17 local delta12distributionTable = { generalmaintenance = { locker = { procedural = true, procList = { {name="workClothing", min=30, max=99, weightChance=100}, {name="toolBags", min=5, max=99, weightChance=70}, } }, crate = { procedural = true, procList = { {name="cleaningTools", min=5, max=99, weightChance=10}, {name="cleaningLiquids", min=5, max=99, weightChance=10}, {name="emergencyEquipments", min=5, max=99, weightChance=10}, {name="dailyConsumptions", min=5, max=99, weightChance=10}, {name="electronicConsumptions", min=30, max=99, weightChance=10}, {name="otherTools", min=5, max=99, weightChance=10}, {name="repairMaterials", min=5, max=99, weightChance=20}, {name="doorLocks", min=1, max=99, weightChance=1}, {name="pestTraps", min=1, max=99, weightChance=1}, } }, metal_shelves = { procedural = true, procList = { {name="cleaningTools", min=5, max=99, weightChance=13}, {name="cleaningLiquids", min=5, max=99, weightChance=13}, {name="emergencyEquipments", min=5, max=99, weightChance=8}, {name="dailyConsumptions", min=5, max=99, weightChance=13}, {name="toolBags", min=3, max=99, weightChance=6}, {name="electronicConsumptions", min=5, max=99, weightChance=10}, {name="otherTools", min=5, max=99, weightChance=10}, {name="repairMaterials", min=5, max=99, weightChance=1}, {name="doorLocks", min=1, max=99, weightChance=3}, {name="pestTraps", min=1, max=99, weightChance=3}, {name="safetyEquipments", min=1, max=99, weightChance=8}, } }, }, bathroommaintenance = { metal_shelves = { procedural = true, procList = { {name="cleaningTools", min=1, max=99, weightChance=13}, {name="cleaningLiquids", min=1, max=99, weightChance=13}, {name="emergencyEquipments", min=0, max=99, weightChance=4}, {name="dailyConsumptions", min=1, max=99, weightChance=13}, {name="toolBags", min=0, max=99, weightChance=4}, } }, counter = { procedural = true, procList = { {name="cleaningTools", min=5, max=99, weightChance=13}, {name="cleaningLiquids", min=5, max=99, weightChance=13}, {name="emergencyEquipments", min=5, max=99, weightChance=4}, {name="dailyConsumptions", min=5, max=99, weightChance=13}, {name="toolBags", min=3, max=99, weightChance=4}, } }, locker = { procedural = true, procList = { {name="workClothing", min=1, max=99, weightChance=100}, {name="toolBags", min=1, max=99, weightChance=70}, } }, shelves = { procedural = true, procList = { {name="cleaningLiquids", min=1, max=99, weightChance=100}, {name="dailyConsumptions", min=1, max=99, weightChance=100}, } }, }, } table.insert(Distributions, 2, delta12distributionTable); This code works on the corresponding rooms. But meanwhile other rooms have become all empty. Why?
RandomSelection Posted November 18 Posted November 18 @RingoD123 Hello. It turns out to be: when insert myMapModDistributionTable to Distributions, it will empty all other contents in vanilla Distributions, what should we do for that? delta12Distributions.lua delta12ProceduralDistributions.lua
Hugo Qwerty Posted November 18 Posted November 18 1 hour ago, RandomSelection said: @RingoD123 Hello. It turns out to be: when insert myMapModDistributionTable to Distributions, it will empty all other contents in vanilla Distributions, what should we do for that? delta12Distributions.lua 387 B · 0 downloads delta12ProceduralDistributions.lua 1.42 kB · 0 downloads If it helps, this is how I insert items into loot tables: table.insert(SuburbsDistributions["all"]["crate"].items, "Hugo.HandDrill") table.insert(SuburbsDistributions["all"]["crate"].items, 0.1) table.insert(SuburbsDistributions["all"]["metal_shelves"].items, "Hugo.HandDrill") table.insert(SuburbsDistributions["all"]["metal_shelves"].items, 0.1) table.insert(SuburbsDistributions["all"]["Outfit_McCoys"].items, "Hugo.HandDrill") table.insert(SuburbsDistributions["all"]["Outfit_McCoys"].items, 4) It doesn't need to be fired inside an event, as all modded code runs after the vanilla code, so the loot table will already exist. The modding section on here is very quiet, so you might want to ask on Chuck's modding discord - which lots of modders use. https://discord.com/invite/SReMnbV4V7 You'll need a verified account to actually post anything.
RandomSelection Posted November 19 Posted November 19 19 hours ago, Hugo Qwerty said: If it helps, this is how I insert items into loot tables: table.insert(SuburbsDistributions["all"]["crate"].items, "Hugo.HandDrill") table.insert(SuburbsDistributions["all"]["crate"].items, 0.1) table.insert(SuburbsDistributions["all"]["metal_shelves"].items, "Hugo.HandDrill") table.insert(SuburbsDistributions["all"]["metal_shelves"].items, 0.1) table.insert(SuburbsDistributions["all"]["Outfit_McCoys"].items, "Hugo.HandDrill") table.insert(SuburbsDistributions["all"]["Outfit_McCoys"].items, 4) It doesn't need to be fired inside an event, as all modded code runs after the vanilla code, so the loot table will already exist. The modding section on here is very quiet, so you might want to ask on Chuck's modding discord - which lots of modders use. https://discord.com/invite/SReMnbV4V7 You'll need a verified account to actually post anything. Thanks a lot mate. Anyway I'm just curious why my codes aren't working. I'll seek for more supports on discord though. Hugo Qwerty 1
FES2329 Posted November 26 Posted November 26 I am currently developing a mod following your kind guide. However, when I set the LootZone to the second floor or above, the forceForZones parameter does not work. I believe the issue is caused by the code on line 70 of SpawnRateChecker.lua: local metaZones = getWorld():getMetaGrid():getZonesAt(container:getSourceGrid():getX(), container:getSourceGrid():getY(), 0) As seen in the above code, the Z-coordinate for the zones recognized by forceForZones is fixed at 0. If this is modified, would it work correctly?
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