Jump to content

Distribution-files, explanation?


Dr_Cox1911

Recommended Posts

"Kitten" ?

Kitten is just the forum filter to trick the spam bots.

 

 

Im having issues with my new File it will not spawn anything at all. tried new game and old game nothing :( i know its a typo but i have looked at it for hours and cant find it.

 

function Jerky.init()print("Mod Loaded: " .. JerkysMod.modName .. " by " .. JerkyMod.author .. " (v" .. JerkyMod.version ..")");end Events.OnGameBoot.Add(JerkyMod.init);

 

It's not the real issue here, but Jerky.init should be JeryMod.init ;) The lua code seems correct as it is exactly how I have done it in my mods. Maybe your item script is faulty. Is Jerky the module name of your script module?

 

"Jerky.Salt" means an item called "Salt" defined in the module "Jerky".

Link to comment
Share on other sites

Warning Lots of items!

 

module Jerky{     imports     {     Base, camping, Hunting     }///============================= Recipes =============================\\\recipe make BeefJerky{Steak,Basicmarinad,Result: BasicBeefJerky=3,Time:1600,}recipe ChickenJerky{Chicken,Basicmarinad,Result: ChickenJerky=3,Time:1600,}recipe RatJerky{Rat,Basicmarinad,Result: RatJerky=3,Time:1600,}recipe ChipmunkJerky{Chipmunk,Basicmarinad,Result:ChipmunkJerky=3,Time:1600,}recipe RabbitJerky{Rabbit,Basicmarinad,Result:RabbitJerky=3,Time:1600,}recipe SquirrelJerky{Squirrel,Basicmarinad,Result:SquirrelJerky=3,Time:1600,}recipe Basicmarinad{Soysauce,Worcestershire,Salt,Liquidsmoke,Result: Basicmarinad=3,Time:800,}recipe make TastyBeefJerky{Steak,Tastymarinad,Result: TastyBeefJerky=3,Time:1600,}recipe TastyChickenJerky{Chicken,Tastymarinad,Result: TastyChickenJerky=3,Time:1600,}recipe TastyRatJerky{Rat,Tastymarinad,Result: TastyRatJerky=3,Time:1600,}recipe TastyChipmunkJerky{Chipmunk,Tastymarinad,Result:TastyChipmunkJerky=3,Time:1600,}recipe TastyRabbitJerky{Rabbit,Tastymarinad,Result:TastyRabbitJerky=3,Time:1600,}recipe TastySquirrelJerky{Squirrel,Tastymarinad,Result:TastySquirrelJerky=3,Time:1600,}recipe Tastymarinad{Basicmarinad=3,Pepper,Garlicpowder,Result: Tastymarinad=3,Time:800,}///============================= Jerky =============================\\\item BasicBeefJerky{HungerChange = -15,IsCookable = TRUE,DangerousUncooked = TRUE,MinutesToBurn = 200,MinutesToCook = 180,Weight = 0.2,AlwaysWelcomeGift = true,Type = Food,DisplayName = Basic Beef Jerky,Icon = BeefJerky,}item ChickenJerky{HungerChange = -15,IsCookable = TRUE,DangerousUncooked = TRUE,MinutesToBurn = 200,MinutesToCook = 180,Weight = 0.2,AlwaysWelcomeGift = true,Type = Food,DisplayName = Basic Chicken Jerky,Icon = BeefJerky,}item RatJerky{HungerChange = -15,IsCookable = TRUE,DangerousUncooked = TRUE,MinutesToBurn = 200,MinutesToCook = 180,Weight = 0.2,AlwaysWelcomeGift = true,Type = Food,DisplayName = Basic Rat Jerky,Icon = BeefJerky,}item ChipmunkJerky{HungerChange = -15,IsCookable = TRUE,DangerousUncooked = TRUE,MinutesToBurn = 200,MinutesToCook = 180,Weight = 0.2,AlwaysWelcomeGift = true,Type = Food,DisplayName = Basic Chipmunk Jerky,Icon = BeefJerky,}item RabbitJerky{HungerChange = -15,IsCookable = TRUE,DangerousUncooked = TRUE,MinutesToBurn = 200,MinutesToCook = 180,Weight = 0.2,AlwaysWelcomeGift = true,Type = Food,DisplayName = Basic Rabbit Jerky,Icon = BeefJerky,}item SquirrelJerky{HungerChange = -15,IsCookable = TRUE,DangerousUncooked = TRUE,MinutesToBurn = 200,MinutesToCook = 180,Weight = 0.2,AlwaysWelcomeGift = true,Type = Food,DisplayName = Basic Squirrel Jerky,Icon = BeefJerky,}item Basicmarinad{HungerChange = -10,Weight = 1,AlwaysWelcomeGift = true,Type = Food,DisplayName = Basic Marinad,}item TastyBeefJerky{HungerChange = -20,BoredomChange = -5,IsCookable = TRUE,DangerousUncooked = TRUE,MinutesToBurn = 200,MinutesToCook = 180,Weight = 0.2,AlwaysWelcomeGift = true,Type = Food,DisplayName = Tasty Beef Jerky,Icon = BeefJerky,}item TastyChickenJerky{HungerChange = -20,BoredomChange = -5,IsCookable = TRUE,DangerousUncooked = TRUE,MinutesToBurn = 200,MinutesToCook = 180,Weight = 0.2,AlwaysWelcomeGift = true,Type = Food,DisplayName = Tasty Chicken Jerky,Icon = BeefJerky,}item TastyRatJerky{HungerChange = -20,BoredomChange = -5,IsCookable = TRUE,DangerousUncooked = TRUE,MinutesToBurn = 200,MinutesToCook = 180,Weight = 0.2,AlwaysWelcomeGift = true,Type = Food,DisplayName = Tasty Rat Jerky,Icon = BeefJerky,}item TastyChipmunkJerky{HungerChange = -20,BoredomChange = -5,IsCookable = TRUE,DangerousUncooked = TRUE,MinutesToBurn = 200,MinutesToCook = 180,Weight = 0.2,AlwaysWelcomeGift = true,Type = Food,DisplayName = Tasty Chipmunk Jerky,Icon = BeefJerky,}item TastyRabbitJerky{HungerChange = -20,BoredomChange = -5,IsCookable = TRUE,DangerousUncooked = TRUE,MinutesToBurn = 200,MinutesToCook = 180,Weight = 0.2,AlwaysWelcomeGift = true,Type = Food,DisplayName = Tasty Rabbit Jerky,Icon = BeefJerky,}item TastySquirrelJerky{HungerChange = -20,BoredomChange = -5,IsCookable = TRUE,DangerousUncooked = TRUE,MinutesToBurn = 200,MinutesToCook = 180,Weight = 0.2,AlwaysWelcomeGift = true,Type = Food,DisplayName = Tasty Squirrel Jerky,Icon = BeefJerky,}item Tastymarinad{HungerChange = -15,BoredomChange = -5,Weight = 1,AlwaysWelcomeGift = true,Type = Food,DisplayName = Tasty Marinad,}item Soysauce{Weight = 1,AlwaysWelcomeGift = true,Type = Drainable,UseDelta = 0.5,DisplayName = Soysauce,}item Salt{Weight = .5,AlwaysWelcomeGift = true,Type = Drainable,UseDelta = 0.5,DisplayName = Salt Shacker,}item Pepper{Weight = .5,AlwaysWelcomeGift = true,Type = Drainable,UseDelta = 0.5,DisplayName = Pepper Shacker,}item Worcestershire{Weight = 1,AlwaysWelcomeGift = true,Type = Drainable,UseDelta = 0.5,DisplayName = Worcestershire,}item Liquidsmoke{Weight = 1,AlwaysWelcomeGift = true,Type = Drainable,UseDelta = 0.5,DisplayName = Liquidsmoke,}item Garlicpowder{Weight = .5,AlwaysWelcomeGift = true,Type = Drainable,UseDelta = 0.5,DisplayName = Garlic Powder,}}

 

I will be adding more just wanted to test it and will not work

Link to comment
Share on other sites

Lol i got it to work by taking everything out.........................

 

table.insert(SuburbsDistributions["Kitten"]["counter"].items, "Jerky.Salt");table.insert(SuburbsDistributions["Kitten"]["counter"].items, 10);table.insert(SuburbsDistributions["Kitten"]["counter"].items, "Jerky.Pepper");table.insert(SuburbsDistributions["Kitten"]["counter"].items, 10);table.insert(SuburbsDistributions["Kitten"]["counter"].items, "Jerky.Soysauce");table.insert(SuburbsDistributions["Kitten"]["counter"].items, 10);table.insert(SuburbsDistributions["Kitten"]["counter"].items, "Jerky.Worcestershire");table.insert(SuburbsDistributions["Kitten"]["counter"].items, 10);table.insert(SuburbsDistributions["Kitten"]["counter"].items, "Jerky.Liquidsmoke");table.insert(SuburbsDistributions["Kitten"]["counter"].items, 10);table.insert(SuburbsDistributions["Kitten"]["counter"].items, "Jerky.Garlicpowder");table.insert(SuburbsDistributions["Kitten"]["counter"].items, 10);

 

Thanks for the help :)

Edited by Shivster
Link to comment
Share on other sites

I think it's the way you have defined your function. Try either removing the class name or writing = function() instead. I.e:

function init()print("Mod Loaded: " .. JerkysMod.modName .. " by " .. JerkyMod.author .. " (v" .. JerkyMod.version ..")");end

OR

Jerky.init = function()print("Mod Loaded: " .. JerkysMod.modName .. " by " .. JerkyMod.author .. " (v" .. JerkyMod.version ..")");end
Link to comment
Share on other sites

I have answered the question already ... Why isn't anyone listening??

The only problem is that he used "jerky" instead of jerkymod as a package name for the init function... Of course lua will throw an error if you try to store your function in a table that doesn't exist.

Fyi writing function ...() is just synctatic sugar so basically the same as ... = function().

Link to comment
Share on other sites

You said that wasn't the real issue here, so since it (apparently) didn't solve the problem, I thought you were right. 

 

Turns out that Lua doesn't give an error in that case, it just doesn't run the function.

Well I wasn't sure until he said that it suddenly worked as soon as he removed the other functions ... :D

 

Nevermind, glad we could fix it ;)

 

Link to comment
Share on other sites

I need help. I'm trying to add certain items to distribution but they dont spawn... not actually sure i'm implimenting them correctly.

 

Here is how i have things set up:

 

(game directory)

     > PZ (2.9.9.10)/

           > media/

                 > scripts/

                        • EF_Itims.txt

                        • EF_Recipies.txt

                 > lua/

                        • ExtendedFoodsMod_Distribution.lua

                 > textures/

                        > ExtendedFoods/ (sprites are present, of course not used in game though >.>'' )

 

 

LUA Distribution content:

-- Pancake Mixtable.insert(SuburbsDistributions["all"]["bin"].items, "EF_Items.PancakeMix");table.insert(SuburbsDistributions["all"]["bin"].items, 15);table.insert(SuburbsDistributions["Kitten"]["counter"].items, "EF_Items.PancakeMix");table.insert(SuburbsDistributions["Kitten"]["counter"].items, 15);table.insert(SuburbsDistributions["conveniencestore"]["shelves"].items, "EF_Items.PancakeMix");table.insert(SuburbsDistributions["conveniencestore"]["shelves"].items, 15);table.insert(SuburbsDistributions["grocery"]["counter"].items, "EF_Items.PancakeMix");table.insert(SuburbsDistributions["grocery"]["counter"].items, 15);table.insert(SuburbsDistributions["grocery"]["shelves"].items, "EF_Items.PancakeMix");table.insert(SuburbsDistributions["grocery"]["shelves"].items, 15);table.insert(SuburbsDistributions["grocery"]["crate"].items, "EF_Items.PancakeMix");table.insert(SuburbsDistributions["grocery"]["crate"].items, 15);table.insert(SuburbsDistributions["spiffoskitchen"]["counter"].items, "EF_Items.PancakeMix");table.insert(SuburbsDistributions["spiffoskitchen"]["counter"].items, 15);table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, "EF_Items.PancakeMix");table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, 15);table.insert(SuburbsDistributions["plazastore1"]["counter"].items, "EF_Items.PancakeMix");table.insert(SuburbsDistributions["plazastore1"]["counter"].items, 15);table.insert(SuburbsDistributions["grocers"]["grocerstand"].items, "EF_Items.PancakeMix");table.insert(SuburbsDistributions["grocers"]["grocerstand"].items, 15);table.insert(SuburbsDistributions["grocers"]["smallcrate"].items, "EF_Items.PancakeMix");table.insert(SuburbsDistributions["grocers"]["smallcrate"].items, 15);table.insert(SuburbsDistributions["grocery"]["shelvesmag"].items, "EF_Items.PancakeMix");table.insert(SuburbsDistributions["grocery"]["shelvesmag"].items, 15);

so far, the Pancake Mix doesn't spawn in game... is there something i'm not doing correctly?

(i have several items needing to be added,i'm simply waiting to have this portion properly done so i can add in the rest)

Link to comment
Share on other sites

The underscore in the name ? code looks good to me

 

(game directory)

     > PZ (2.9.9.10)/

           > media/

                 > scripts/

                        • EF_Itims.txt<----- is that a typo? or is it misspelled in that directory?

                        • EF_Recipies.txt

                 > lua/

                        • ExtendedFoodsMod_Distribution.lua

Link to comment
Share on other sites

The underscore in the name ? code looks good to me

 

(game directory)

     > PZ (2.9.9.10)/

           > media/

                 > scripts/

                        • EF_Itims.txt<----- is that a typo? or is it misspelled in that directory?

                        • EF_Recipies.txt

                 > lua/

                        • ExtendedFoodsMod_Distribution.lua

The file name actually isn't really important IIRC. It's only the module name that counts :)

 

<snip>

First of all, I'd suggest changing your folder structure.

(game directory)     > PZ (2.9.9.10)/           > media/                 > scripts/                        > ExtendedFoodsMod                                 • EF_Itims.txt                                 • EF_Recipies.txt                 > lua/                        > Mods/                                 > ExtendedFoodsMod                                            • ExtendedFoodsMod_Distribution.lua                 > textures/                        > ExtendedFoods/ (sprites are present, of course not used in game though >.>'' )

Makes it easier for others to deinstall your mods and doesn't clutter the main folders if multiple mods are installed ;)

 

As for your problem:

  • did you put require 'Items/SuburbsDistributions'; at the top of the file?
  • is EF_Items the correct module name?
Link to comment
Share on other sites

(game directory)     > PZ (2.9.9.10)/           > media/                 > scripts/                        > ExtendedFoodsMod                                 • EF_Itims.txt                                 • EF_Recipies.txt                 > lua/                        > Mods/                                 > ExtendedFoodsMod                                            • ExtendedFoodsMod_Distribution.lua                 > textures/                        > ExtendedFoods/ (sprites are present, of course not used in game though >.>'' )

Ok so i've redone the fold structure of the mod and adding the require 'Items/SuburbsDistributions'; line to the top of the distribution LUA, still doesn't laod in . ___.

Link to comment
Share on other sites

Is that the full contents of your distribution file? 

 

You should post your items file also.

 

One suggestion right now would be to delete all entries except one, to see if the error is in that file. You should also make some kind of debug function with i.e. print("File loaded"); to make sure that it is in fact parsed and loaded properly.

Link to comment
Share on other sites

You should also use your console to see if the file loads properly ...

 

When PZ first loads there is a shitload of pathnames displayed which is all lua files the game can find. If the problem is within your file you'll see an error where your file should be.

 

Is the module in EF_items called EF_items too? Because the code actually should be read as this:

 

table.insert(SuburbsDistributions["all"]["bin"].items, "module.itemName");
Link to comment
Share on other sites

  • 2 weeks later...

How do you distribute items to corpses? I tried to do it, but the code causes the lua not to work.

 

I thought it would be this with male corpses as an example:

 

table.insert(SuburbsDistributions["inventorymale"]["all"].items, "modname.itemname");

 

I know something is suppose to go where "all" is, but I can't figure out what. I looked at the SuburbsDistributions file under "inventorymale" and it doesn't have container sub-listing like it does for rooms.

Link to comment
Share on other sites

That's because you switched them young padawan.

 

table.insert(SuburbsDistributions["all"]["inventorymale"].items, "Lockpicking.BobbyPin");table.insert(SuburbsDistributions["all"]["inventorymale"].items, 1);table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "Lockpicking.BobbyPin");table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 2);
Link to comment
Share on other sites

  • 4 weeks later...

My Jerky and nail mod Distributions files have stopped working in build 17 they worked fine in 16 did something change?

 

Here is my code

 

Jerky

table.insert(SuburbsDistributions["kitchen"]["counter"].items, "Jerky.Salt");table.insert(SuburbsDistributions["kitchen"]["counter"].items, 10);table.insert(SuburbsDistributions["kitchen"]["counter"].items, "Jerky.Pepper");table.insert(SuburbsDistributions["kitchen"]["counter"].items, 10);table.insert(SuburbsDistributions["kitchen"]["counter"].items, "Jerky.Soysauce");table.insert(SuburbsDistributions["kitchen"]["counter"].items, 10);table.insert(SuburbsDistributions["kitchen"]["counter"].items, "Jerky.Worcestershire");table.insert(SuburbsDistributions["kitchen"]["counter"].items, 10);table.insert(SuburbsDistributions["kitchen"]["counter"].items, "Jerky.Liquidsmoke");table.insert(SuburbsDistributions["kitchen"]["counter"].items, 10);table.insert(SuburbsDistributions["kitchen"]["counter"].items, "Jerky.Garlicpowder");table.insert(SuburbsDistributions["kitchen"]["counter"].items, 10);

 

Nails

require "Items/SuburbsDistributions"; table.insert(SuburbsDistributions["all"]["crate"].items, "Nails.Ingot");table.insert(SuburbsDistributions["all"]["crate"].items, 10);

 

 

I took a look at the SuburbsDistributions file and didn't see much for changes.

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...