sweetcandyflip Posted June 11, 2015 Share Posted June 11, 2015 Hey!I am trying to rework the loot tables from the base game so every Container in the world spawns the all items. The loot amount / container should be like:Very rare: 0-1Rare: 0-2Normal:0-3and so on.....You can imagine it like the random (not logic) loot sandbox option for replayability.Now to my Problem:I adjusted the items in suburbsdistribution.lua with the full item list from pzwiki.net.Here is an example for the conveniencestore, the rarity number 0.5 is just for testing so i will definitely want to adjust this later on when i have a good amount of item spawns in the containers:SuburbsDistributions = {conveniencestore ={fridge ={rolls = 1,items = {"Base.Garbagebag", 0.5,"Base.Plasticbag", 0.5,"Base.Bandaid", 0.5,"Base.Mugl", 0.5,"Base.Bowl", 0.5,"Base.Pan", 0.5,"Base.Kettle", 0.5,"Base.BakingPan", 0.5,"Base.BakingSheet", 0.5,"Base.RoastingPan", 0.5,"Base.Pot", 0.5,"Base.WaterBowl", 0.5,"Base.Bowl", 0.5,"Base.BucketWaterFull", 0.5,"Base.BucketEmpty", 0.5,"Base.Pot", 0.5,"Base.WaterPot", 0.5,"Base.Kettle", 0.5,"Base.FullKettle", 0.5,"Base.Mugl", 0.5,"Base.Mugl", 0.5,"Base.PopBottleEmpty", 0.5,"Base.WaterPopBottle", 0.5,"Base.WaterBottleEmpty", 0.5,"Base.WaterBottleFull", 0.5,"Base.WhiskeyEmpty", 0.5,"Base.WhiskeyWaterFull", 0.5,"Base.Flour", 0.5,"Base.Coffee", 0.5,"Base.Sugar", 0.5,"Base.Teabag", 0.5,"Base.Yeast", 0.5,"Base.Apple", 0.5,"Base.Banana", 0.5,"Base.BerryBlack", 0.5,"Base.BerryBlue", 0.5,"Base.Grapes", 0.5,"Base.BerryGeneric1", 0.5,"Base.BerryGeneric2", 0.5,"Base.BerryGeneric3", 0.5,"Base.BerryGeneric4", 0.5,"Base.BerryGeneric5", 0.5,"Base.Cherry", 0.5,"Base.Lemon", 0.5,"Base.Orange", 0.5,"Base.Pineapple", 0.5,"Base.Peach", 0.5,"farming.Strewberrie", 0.5,"Base.Watermelon", 0.5,"Base.Avocado", 0.5,"Base.BellPepper", 0.5,"Base.Broccoli", 0.5,"farming.Cabbage", 0.5,"Base.Carrots", 0.5,"Base.Corn", 0.5,"Base.Eggplant", 0.5,"Base.Leek", 0.5,"Base.Lettuce", 0.5,"Base.MushroomGeneric1", 0.5,"Base.MushroomGeneric2", 0.5,"Base.MushroomGeneric3", 0.5,"Base.MushroomGeneric4", 0.5,"Base.MushroomGeneric5", 0.5,"Base.MushroomGeneric6", 0.5,"Base.MushroomGeneric7", 0.5,"Base.Onion", 0.5,"Base.Peas", 0.5,"farming.Potato", 0.5,"Base.Pumpkin", 0.5,"farming.RedRadish", 0.5,"Base.Tofu", 0.5,"farming.Tomato", 0.5,"Base.Zucchini", 0.5,"farming.Bacon", 0.5,"farming.BaconBits", 0.5,"farming.BaconRashers", 0.5,"Base.Chicken", 0.5,"Base.Egg", 0.5,"Base.FishFillet", 0.5,"Base.FishFillet", 0.5,"Base.Ham", 0.5,"Base.MeatPatty", 0.5,"Base.MuttonChop", 0.5,"Base.PorkChop", 0.5,"Base.Rabbitmeat", 0.5,"Base.Salmon", 0.5,"Base.Smallanimalmeat", 0.5,"Base.Smallbirdmeat", 0.5,"Base.Steak", 0.5,"Base.Butter", 0.5,"Base.Cheese", 0.5,"Base.Milk", 0.5,"Base.Processedcheese", 0.5,"Base.Yoghurt", 0.5,"Base.WhiskeyFull", 0.5,"Base.Wine", 0.5,"Base.Wine2", 0.5,"Base.TinnedBeans", 0.5,"Base.OpenBeans", 0.5,"Base.CannedCarrots2", 0.5,"Base.CannedCarrotsOpen", 0.5,"Base.CannedCorn", 0.5,"Base.CannedCornOpen", 0.5,"Base.CannedCornedBeef", 0.5,"Base.CannedCornedBeefOpen", 0.5,"Base.CannedMushroomSoup", 0.5,"Base.CannedMushroomSoupOpen", 0.5,"Base.CannedPeas", 0.5,"Base.CannedPeasOpen", 0.5,"Base.CannedPotato2", 0.5,"Base.CannedPotatoOpen", 0.5,"Base.CannedSardines", 0.5,"Base.CannedSardinesOpen", 0.5,"Base.TinnedSoup", 0.5,"Base.TinnedSoupOpen", 0.5,"Base.CannedTomato2", 0.5,"Base.CannedTomatoOpen", 0.5,"Base.Dogfood", 0.5,"Base.DogfoodOpen", 0.5,"Base.TunaTin", 0.5,"Base.TunaTinOpen", 0.5,"Base.BeefJerky", 0.5,"Base.Cereal", 0.5,"Base.PopBottle", 0.5,"Base.Crisps", 0.5,"Base.Chocolate", 0.5,"Base.Cupcake", 0.5,"Base.CookieJelly", 0.5,"Base.Ramen", 0.5,"Base.Icecream", 0.5,"Base.Popcorn", 0.5,"Base.Lollipop", 0.5,"Base.MintCandy", 0.5,"Base.Modjeska", 0.5,"Base.PeanutButter", 0.5,"Base.Peanuts", 0.5,"Base.Pickles", 0.5,"Base.TVDinner", 0.5,"Base.Pop", 0.5,"Base.Popcorn", 0.5,"Base.Ketchup", 0.5,"farming.MayonnaiseFull", 0.5,"Base.Mustard", 0.5,"Base.Pepper", 0.5,"farming.RemouladeFull", 0.5,"Base.Salt", 0.5,"Base.EmptyJar", 0.5,"Base.JarLid", 0.5,"Base.Vinegar", 0.5,"Base.CannedTomato", 0.5,"Base.CannedCarrots", 0.5,"Base.CannedPotato", 0.5,"Base.CannedEggplant", 0.5,"Base.CannedLeek", 0.5,"Base.CannedRedRadish", 0.5,"Base.CannedBellPepper", 0.5,"Base.CannedCabbage", 0.5,"Base.CannedBroccoli", 0.5,"Base.PotOfSoup", 0.5,"Base.SoupBowl", 0.5,"Base.PotOfStew", 0.5,"Base.StewBowl", 0.5,"Base.RamenBowl", 0.5,"Base.BurgerRecipe", 0.5,"Base.BeanBowl", 0.5,"Base.CakeRaw", 0.5,"Base.CakeSlice", 0.5,"Base.Pie", 0.5,"Base.PieSlice", 0.5,"Base.PanFriedVegetables", 0.5,"Base.RoastingPan", 0.5,"Base.BCCCasserole", 0.5,"Base.GrilledCheese", 0.5,"Base.CheeseSandwich", 0.5,"Base.PeanutButterSandwich", 0.5,"Base.Sandwich", 0.5,"Base.Salad", 0.5,"Base.PotatoSalad", 0.5,"Base.Mugfulll", 0.5,"Base.WatermelonSmashed", 0.5,"Base.WatermelonSliced", 0.5,"Base.CakeSlice", 0.5,"Base.Corndog", 0.5,"Base.Fries", 0.5,"Base.ChickenFried", 0.5,"Base.Burger", 0.5,"Base.Hotdog", 0.5,"Base.Pancakes", 0.5,"Base.Pizza", 0.5,"Base.Waffles", 0.5,"Base.Bleach", 0.5,"Base.BerryPoisonIvy", 0.5,"farming.WateredCan", 0.5,"farming.BroccoliBagSeed", 0.5,"farming.CabbageBagSeed", 0.5,"farming.CarrotBagSeed", 0.5,"farming.PotatoBagSeed", 0.5,"farming.RedRadishBagSeed", 0.5,"farming.StrewberrieBagSeed", 0.5,"farming.TomatoBagSeed", 0.5,"Base.Nails", 0.5,"Base.Worm", 0.5,"Base.Cricket", 0.5,"Base.Grasshopper", 0.5,"Base.Cockroach", 0.5,"Base.Bass", 0.5,"Base.Catfish", 0.5,"Base.Crappie", 0.5,"Base.Panfish", 0.5,"Base.Perch", 0.5,"Base.Pike", 0.5,"Base.Trout", 0.5,"Base.Trout", 0.5,"Base.BerryGeneric1", 0.5,"Base.BerryGeneric2", 0.5,"Base.BerryGeneric3", 0.5,"Base.BerryGeneric4", 0.5,"Base.BerryGeneric5", 0.5,"Base.BerryBlack", 0.5,"Base.BerryBlue", 0.5,"Base.BerryPoisonIv", 0.5,"Base.SharpedStone", 0.5,"Base.Stone", 0.5,"Base.TreeBranch", 0.5,"Base.Twigs", 0.5,"Base.Violets", 0.5,"Base.GrapeLeaves", 0.5,"Base.Worm", 0.5,"Base.MushroomGeneric1", 0.5,"Base.MushroomGeneric2", 0.5,"Base.MushroomGeneric3", 0.5,"Base.MushroomGeneric4", 0.5,"Base.MushroomGeneric5", 0.5,"Base.MushroomGeneric6", 0.5,"Base.MushroomGeneric7", 0.5,"Base.Cricket", 0.5,"Base.Rosehips", 0.5,"Base.Grasshopper", 0.5,"Base.Cockroach", 0.5,"Base.Log", 0.5,"Base.Frog", 0.5,"Base.WildEggs", 0.5,"Base.Bandaid", 0.5,"Base.AlcoholedCottonBalls", 0.5,"Base.PillsAntiDep", 0.5,"Base.Antibiotics", 0.5,"Base.AlcoholWipes", 0.5,"Base.Bandage", 0.5,"Base.BathTowel", 0.5,"Base.PillsBeta", 0.5,"Base.Disinfectant", 0.5,"Base.Cigarettes", 0.5,"Base.CottonBalls", 0.5,"Base.DishCloth", 0.5,"Base.Pills", 0.5,"Base.PillsSleepingTablets", 0.5,"Base.Splint", 0.5,"Base.SterilizedBandage", 0.5,"Base.AlcoholRippedSheets", 0.5,"Base.SutureNeedle", 0.5,"Base.SutureNeedleHolder", 0.5,"Base.Tissue", 0.5,"Base.Tweezers", 0.5,"Base.PillsVitamins", 0.5,"Base.DeadMouse", 0.5,"Base.DeadRabbit", 0.5,"Base.DeadRat", 0.5,"Base.DeadBird", 0.5,"Base.DeadSquirrel", 0.5,"Base.DeadBird", 0.5,"Base.DeadMouse", 0.5,"Base.DeadRabbit", 0.5,"Base.DeadRat", 0.5,"Base.DeadSquirrel", 0.5,"Base.Rabbitmeat", 0.5,"Base.Smallanimalmeat", 0.5,"Base.Smallbirdmeat", 0.5,"Base.Belt", 0.5,"Base.Bricktoys", 0.5,"Base.CardDeck", 0.5,"Base.Comb", 0.5,"Base.Corks", 0.5,"Base.Corkscrew", 0.5,"Base.Cube", 0.5,"Base.Dice", 0.5,"Base.DigitalWatch", 0.5,"Base.Disc", 0.5,"Base.Doll", 0.5,"Base.Earbuds", 0.5,"Base.Earrings", 0.5,"Base.Extinguisher", 0.5,"Base.Glasses", 0.5,"Base.Glasses2", 0.5,"Base.Headphones", 0.5,"Base.Lamp", 0.5,"Base.Lipstick", 0.5,"Base.Locket", 0.5,"Base.Mirror", 0.5,"Base.Necklacepearl", 0.5,"Base.Spiffo", 0.5,"Base.Poolball", 0.5,"Base.Radio", 0.5,"Base.Rainboots", 0.5,"Base.Razor", 0.5,"Base.Remote", 0.5,"Base.Ring", 0.5,"Base.Rubberducky", 0.5,"Base.Socks", 0.5,"Base.Socks2", 0.5,"Base.Toothbrush", 0.5,"Base.Toothpaste", 0.5,"Base.ToyBear", 0.5,"Base.Wallet", 0.5,"Base.Wallet2", 0.5,"Base.Wallet3", 0.5,"Base.Wallet4", 0.5,"Base.WeddingRing_Man", 0.5,"Base.WeddingRing_Woman", 0.5,"Base.Yoyo", 0.5,"Base.Cornflour", 0.5,"Base.Soap", 0.5,"Base.Umbrella", 0.5,"Base.Map", 0.5,}},The random loot works fine but the variety of item spawns inside a container seems broken, due to the big amount of items that can be spawned. The variety is about 0-17 items / container now.After doing some tests i changed all the rolls (rolls = 1,2,3,4,5) for containers to 1, which lead to slightly better loot tables.Right now i am trying to adjust the itempicker.lua, now to my questions (Pls also check the spoiler tabs for some questions)This is the spawning function for items in container right?for m = 1, containerDist.rolls do Is this the roll an item event?for i, k in ipairs(containerDist.items) doif not alt then -- first we take the name of the itemitemname = k;-- print (itemname);else -- next step is the random spawn partlocal itemNumber = k;if lucky thenitemNumber = itemNumber + 1;endif unlucky thenitemNumber = itemNumber - 1;if itemNumber<0 thenitemNumber=0.1;endendlocal lootModifier = ItemPicker.getLootModifier(itemname) or 0.6;if ZombRand(10000) <= ((((itemNumber*100) * lootModifier) + (zombieDensity * 10))) then-- ZombRand is this the Randomgenerator from PZ? -- Itemnumber*100 = Lucky/Unlucky * 100 for % -- Zombiedensity * 10 = Zombie Counter in your Loot Region-- So this Part means the Randomgenerator must be smaller than 99-101 + Zombiedensity to spawn an item right?-- make an item in the container of that type.local item = container:AddItem(itemname);ItemPicker.getLootModifier = function(itemname)local item = ScriptManager.instance:FindItem(itemname)if not item then return; endlocal lootModifier = ZomboidGlobals.OtherLootModifier;if item:getTypeString() == "Food" thenlootModifier = ZomboidGlobals.FoodLootModifier;endif item:getTypeString() == "Weapon" or item:getTypeString() == "WeaponPart" or item:getDisplayCategory() == "Ammo" thenlootModifier = ZomboidGlobals.WeaponLootModifier;endreturn lootModifier;endWhat are the Global Loot Modifier which are described in the getlootmodifier function.Are there any known numbers for those or is there a file where i can check them?Is there a easy way to rewrite/delete the loot function (I wont need Zombiedensity for my Function i guess) to adjust the loot tables inside the game?Also where is the part which defines the Rarity of the Sandbox Options?I have a lot of more questions but i think that does for now, i hope someone can help me with my project.ThxMichael edit: Changing the Zombrand to 30000 works pretty neat... There is almost no loot anymore... 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