Jump to content

EFM My mod crashes the game!


lance789

Recommended Posts

PLEASE NOTE

I AM NOTE A CODER (I REALLY SUCK AT IT). This mod was also being tested in build 41 with other mods active.

Mod was not tested in IWBUMS beta.

 

 

THE PROBLEM

I am currently in the process of reviving an old mod of mine that originally worked (well enough) in Build 31, though I've taken a look through some assets and files for the current build, I attempted to reformat the mod to meet the current build... Needless to say I don't I was successful as my mod seems the crash the game.

 

 

What I'm trying to achieve:

  • Add a ridiculous number of foods and recipes to make most vanilla food related foods, ingredients, and kitchen items actually useful
  • Add foods which have nutritional values and effects happiness, fatigue, sickness recovery, raise or lower body temperature, etc. 
  • Some foods required to be FROZEN or cold
  • Add MANY Evolving Recipes 
  • Specify which foods and ingredients can be used for different evolving recipes.
  • Adding different files for each type of food (example, RAMEN based foods uses 1 script file for items, recipes, and evolving recipes (assuming this can be done))
  • Overwrite vanilla foods
  • Use LUA to distribute food to various containers (stoves, microwaves, kitchen counters, outdoor grills, spiffo's, crepe, other restaurants, etc.)
  • Add custom sprites
  • Automatic mod compatibility (can use stuff from other mods automatically (especially Hydrocraft))
  • Recreate EFM thread for Build 41 (will make the old thread obsolete)
  • Upload to Steam Workshop
  • IWBUMS compatibility (eventually)

 

 

My ACTIVE Modlist: (in order listed in Mod menu)

  1. Bef's Professions and Traits
  2. Christmas Food
  3. Craft Helper Mod (v1.1.2)  for PZ 36.4
  4. Crafted Baseball Bat
  5. Crafted weapons++
  6. Crashed Cars
  7. Cremation - Corpse Disposal
  8. Filibuster Rhymes' Smaller Cars
  9. Filibuster Rhymes' Used Cars
  10. Fine Vanilla Items
  11. HuntingMod
  12. Hydrocraft
  13. Improved Maps
  14. Katana
  15. Lockpicking. Just. Lockpicking.
  16. More Build
  17. More Watches v1.0
  18. More Zombie Loot
  19. No More Hidden Zombies (x3)
  20. Radial Menu Fix
  21. Realistic Weapon Durabilities
  22. ToS Huge Backpacks
  23. blindcoders utility functions
  24. inSayne working movable furniture

 

 

MOD DOWNLOADExtendedFoodsMod.rar

I have included in the mod only 1 food type in it (Ramen) to reduce code bloating.

 

 

THE MOD TOPOLOGY:

MOD PATH:


C:\ > Users > "user" > Zomboid > mods > ExtendedFoodsMod

 

ExtebdedFoodsMod (PARENT FOLDER )

     > FOLDER - media

     |       > FOLDER - lua

     |       |      > FOLDER - server

     |       |       |     > FOLDER - items

     |       |       |     | Extended_Foods_Base_Distribution.lua

     |       |       |     | Extended_Foods_Distribution.lua

     |       |       | EFMRecipeFunctions.lua

     |       |       | Extended_Foods.lua

     |       |       | Extended_Foods_Textues.lua

     |       > FOLDER - scripts

     |       |       | EF_ChickenRamen.txt

     |       > FOLDER - textures

     |       |       | Item_EFM_Berry_Icecream.png

     |       |       | Item_EFM_BLANK.png

     |       |       | Item_EFM_BLT_Sandwhich.png

     |       |       | Item_EFM_ChocoChunk_Icecream.png

     |       |       | Item_EFM_FriedSteak.png

     |       |       | Item_EFM_Pizzacheeseslice.png

     |       |       | Item_EFM_PizzaHomemade.png

     |       |       | Item_EFM_Roasted_Steak.png

     |       |       | Item_EFM_Roasted_Steak_Combo.png

     |       |       | Item_EFM_Strawberry_Icecream.png

     |       |       | Item_EFM_Sugarcup.png

     | mod.info

     | EFM_BANNER.png

 

 

THE CODE (for those who do not want to trust attached .RAR file)

mod.info

 

name=Extended Foods Mod (1.0.0)
id=Extended_Foods
poster=EFM_BANNER.png
description=Adds many different foods you can cook, allowing you to use those food items in combos! 
url=http://theindiestone.com/forums/index.php/topic/563-extended-foods-mod/

 

EFMRecipeFunctions.lua

 

-- Recipe LUA
-- Made by: DIESF1RST + Svarog


------------------------------ R A M E N ------------------------------

-- Ramen Pot
function Recipe Make 4 Bowls of Tastey Ramen_OnCreate(items, result, player)
    local inv = player:getInventory();
    inv:AddItem("Base.Pot");
end 

 

Extended_Foods.lua

 

Extended_Foods = {}


function Extended_Foods.loadTextures()
--    getTexture(".png");

--  BLANK
        getTexture("EFM_BLANK.png");
        getTexture("Item_EFM_BLANK.png");
    
--    ICECREAM
        getTexture("Item_EFM_ChocoChunk_Icecream.png");
        getTexture("Item_EFM_Strawberry_Icecream.png");
        getTexture("Item_EFM_Berry_Icecream.png");
        
--    STEAK        
        getTexture("Item_EFM_Roasted_Steak.png");
        getTexture("Item_EFM_Roasted_Steak_Combo.png");
        getTexture("Item_EFM_FriedSteak.png");
            
--    PIZZA        
        getTexture("Item_EFM_PizzaHomemade.png");

--    HAM & BACON        
        getTexture("Item_EFM_Sugarcup.png")
        
--    MISC
        getTexture("Item_EFM_BLT_Sandwhich.png")
        
end

Events.OnGameBoot.Add(Extended_Foods.loadTextures);

 

Extended_Foods_Textues.lua 

 

Extended_Foods = {}


function Extended_Foods.loadTextures()
--    getTexture(".png");

--  BLANK
        getTexture("EFM_BLANK.png");
        getTexture("Item_EFM_BLANK.png");
    
--    ICECREAM
        getTexture("Item_EFM_ChocoChunk_Icecream.png");
        getTexture("Item_EFM_Strawberry_Icecream.png");
        getTexture("Item_EFM_Berry_Icecream.png");
        
--    STEAK        
        getTexture("Item_EFM_Roasted_Steak.png");
        getTexture("Item_EFM_Roasted_Steak_Combo.png");
        getTexture("Item_EFM_FriedSteak.png");
            
--    PIZZA        
        getTexture("Item_EFM_PizzaHomemade.png");

--    HAM & BACON        
        getTexture("Item_EFM_Sugarcup.png")
        
--    MISC
        getTexture("Item_EFM_BLT_Sandwhich.png")
        
end

Events.OnGameBoot.Add(Extended_Foods_Textures.loadTextures);

 

EF_ChickenRamen.txt

 

module Extended_Foods 
{
    imports
        {
            Base
        }
        
/******************************* I T E M S *******************************/

item RamenPot
        {
            HungerChange        =    -150,
            Type                =    Food,
                FoodType    =   Pasta,
            DisplayName            =    Pot of Chicken Ramen,
            Weight                =    3,
            IsCookable            =    True,
                MinutesToBurn   =   50,
                MinutesToCook   =   20,
            DaysTotallyRotten    =    10,
            UnhappyChange        =    90,
            FatigueChange        =    +100,
            StressChange        =    +120,
                EvolvedRecipe = Tastey Ramen Pot:15;
            Icon                =    PotFull,
            ReplaceOnUse        =    Pot,
            DaysFresh            =    5,
            //BoredomChange        =    50,
            DangerousUncooked    =    TRUE,
                Carbohydrates = 95,
                Proteins = 30,
                Lipids = 5,
                Calories = 480,
                Packaged = FALSE,
                BadInMicrowave = TRUE,
                GoodHot = TRUE,
                BadCold = TRUE,
        }

item TasteyRamenPot
        {
            HungerChange        =    -210,
            Type                =    Food,
                FoodType    =   Pasta,
            DisplayName            =    Pot of Tastey Chicken Ramen,
            Weight                =    3,
            IsCookable            =    True,
                MinutesToBurn   =   50,
                MinutesToCook   =   20,
            DaysTotallyRotten    =    10,
            UnhappyChange        =    90,
            FatigueChange        =    +100,
            StressChange        =    +120,
            Icon                =    PotFull,
            ReplaceOnUse        =    Pot,
            DaysFresh            =    5,
            //BoredomChange        =    50,
            DangerousUncooked    =    TRUE,
                Carbohydrates = 95,
                Proteins = 30,
                Lipids = 5,
                Calories = 480,
                Packaged = FALSE,
                BadInMicrowave = TRUE,
                GoodHot = TRUE,
                BadCold = TRUE,
        }
        
    item TasteyRamenBowl
        {
            HungerChange        =    -75,
            Type                =    Food,
                FoodType    =   Pasta,
            DisplayName            =    Bowl of Tastey Ramen,
            Weight                =    3,
            IsCookable            =    True,
                MinutesToBurn   =   50,
                MinutesToCook   =   20,
            DaysTotallyRotten    =    10,
            UnhappyChange        =    90,
            FatigueChange        =    +100,
            StressChange        =    +120,
                EvolvedRecipe = Tastey Ramen Pot:8;
            Icon                =    BowlFull,
            ReplaceOnUse        =    Pot,
            DaysFresh            =    5,
            //BoredomChange        =    50,
            DangerousUncooked    =    TRUE,
                Carbohydrates = 95,
                Proteins = 30,
                Lipids = 5,
                Calories = 480,
                Packaged = FALSE,
                BadInMicrowave = TRUE,
                GoodHot = TRUE,
                BadCold = TRUE,
        }
        
        
/******************************* R E C I P E S *******************************/

    recipe Make 4 Bowls of Tastey Ramen 
        {
            TasteyRamenPot,
            Bowl=4,
            
            Result:TasteyRamenBowl=4/Pot,
            Time:10.0,
            Category:Cooking,
            OnGiveXP:NoXP_OnGiveXP,
        }
        
    recipe Make Ramen Pot
        {
            Ramen=2/RamenBowl=2,
            WaterPot,
            
            Result:RamenPot,
            Time:10.0,
            Category:Cooking,
            OnGiveXP:Give2CookingXP,
        }

/******************************* E V O L V E D _ R E C I P E S *******************************/

    evolvedrecipe Tastey Ramen Pot
        {
            BaseItem:RamenPot,
            MaxItems:6,
            ResultItem:TasteyRamenPot,
            Cookable:true,
            
            Name:Make Tastey Ramen Pot,
            Category:Cooking,
            OnGiveXP:Give3CookingXP,
        }
}

 

Extended_Foods_Base_Distribution.lua 

 

-- ================================================ --
--                 Extended Foods Mod                       --
--                created by DiESF1RST             --
--    Distribution File Derived From Kinyoshi's Mods    --
-- ================================================    --

require "Items/SuburbsDistributions";

Extended_Foods = {}
Extended_Foods.version = "1.0";
Extended_Foods.author = "DiESF1RST";
Extended_Foods.modName = "Extended Foods Mod";

-- ------------------------------------------------
-- Added by Svarog
-- Adds Rolls to Stoves which otherwise don't spawn any items at all through distribution
SuburbsDistributions["all"]["stove"].rolls = SuburbsDistributions["all"]["stove"].rolls + 1;
-- ------------------------------------------------

-- ------------------------------------------------
-- Base item distribution
-- ------------------------------------------------

-- NAME
--table.insert(SuburbsDistributions["all"]["stove"].items, "Base.NAME");
--table.insert(SuburbsDistributions["all"]["stove"].items, 2);
--table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, "Base.NAME");
--table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, 0.4);

------------------------------ R A M E N ------------------------------

-- Tastey Ramen Bowl
table.insert(SuburbsDistributions["all"]["stove"].items, "Base.TasteyRamenBowl");
table.insert(SuburbsDistributions["all"]["stove"].items, 1.5);

-- Tastey Ramen Pot
table.insert(SuburbsDistributions["all"]["stove"].items, "Base.TasteyRamenPot");
table.insert(SuburbsDistributions["all"]["stove"].items, 0.2);
table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, "Base.TasteyRamenPot");
table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, 0.4);

-- RamenPot
table.insert(SuburbsDistributions["all"]["stove"].items, "Base.RamenPot");
table.insert(SuburbsDistributions["all"]["stove"].items, 1.8);


-- ------------------------------------------------
-- Game hooks
-- ------------------------------------------------
Events.OnGameBoot.Add(Extended_Foods.init);

 

Extended_Foods_Distribution.lua 

 

-- ================================================ --
--                 Extended Foods Mod                       --
--                created by DiESF1RST             --
--    Distribution File Derived From Kinyoshi's Mods    --
-- ================================================    --

-- Thanks Svarog for your coding help!!

require "Items/SuburbsDistributions";

Extended_Foods = {}
Extended_Foods.version = "1.0";
Extended_Foods.author = "DiESF1RST";
Extended_Foods.modName = "Extended Foods Mod";

-- ------------------------------------------------
-- Added by Svarog
-- Adds Rolls to Stoves which otherwise don't spawn any items at all through distribution
SuburbsDistributions["all"]["stove"].rolls = SuburbsDistributions["all"]["stove"].rolls + 1;
-- ------------------------------------------------

-- ------------------------------------------------
-- Item distribution
-- ------------------------------------------------


-- NAME
-- table.insert(SuburbsDistributions["all"]["stove"].items, "Extended_Foods.NAME");
-- table.insert(SuburbsDistributions["all"]["stove"].items, 2.0);
-- table.insert(SuburbsDistributions["grocery"]["counter"].items, "Extended_Foods.NAME");
-- table.insert(SuburbsDistributions["grocery"]["counter"].items, 1.0);
-- table.insert(SuburbsDistributions["all"]["fridge"].items, "Extended_Foods.NAME");
-- table.insert(SuburbsDistributions["all"]["fridge"].items, 2.2); 
-- table.insert(SuburbsDistributions["spiffoskitchen"]["counter"].items, "Extended_Foods.NAME");
-- table.insert(SuburbsDistributions["spiffoskitchen"]["counter"].items, 0.0);
-- table.insert(SuburbsDistributions["spiffoskitchen"]["fridge"].items, "Extended_Foods.NAME");
-- table.insert(SuburbsDistributions["spiffoskitchen"]["fridge"].items, 6.4); 
-- table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, "Extended_Foods.NAME");
-- table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, 4.2;


------------------------------ R A M E N ------------------------------

-- Tastey Ramen Bowl
table.insert(SuburbsDistributions["all"]["stove"].items, "Extended_Foods.TasteyRamenBowl");
table.insert(SuburbsDistributions["all"]["stove"].items, 2.0);
table.insert(SuburbsDistributions["spiffoskitchen"]["counter"].items, "Extended_Foods.TasteyRamenBowl");
table.insert(SuburbsDistributions["spiffoskitchen"]["counter"].items, 4.0);
table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, "Extended_Foods.TasteyRamenBowl");
table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, 4.0);

-- Tastey Ramen Pot
table.insert(SuburbsDistributions["all"]["stove"].items, "Extended_Foods.TasteyRamenPot");
table.insert(SuburbsDistributions["all"]["stove"].items, 0.7);
table.insert(SuburbsDistributions["all"]["fridge"].items, "Extended_Foods.TasteyRamenPot");
table.insert(SuburbsDistributions["all"]["fridge"].items, 0.2); 
table.insert(SuburbsDistributions["spiffoskitchen"]["fridge"].items, "Extended_Foods.TasteyRamenPot");
table.insert(SuburbsDistributions["spiffoskitchen"]["fridge"].items, 4.0); 
table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, "Extended_Foods.TasteyRamenPot");
table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, 3.2;

-- Ramen Pot
table.insert(SuburbsDistributions["all"]["stove"].items, "Extended_Foods.RamenPot");
table.insert(SuburbsDistributions["all"]["stove"].items, 2.0);
table.insert(SuburbsDistributions["all"]["fridge"].items, "Extended_Foods.RamenPot");
table.insert(SuburbsDistributions["all"]["fridge"].items, 2.2); 
table.insert(SuburbsDistributions["spiffoskitchen"]["counter"].items, "Extended_Foods.RamenPot");
table.insert(SuburbsDistributions["spiffoskitchen"]["counter"].items, 1.0);
table.insert(SuburbsDistributions["spiffoskitchen"]["fridge"].items, "Extended_Foods.RamenPot");
table.insert(SuburbsDistributions["spiffoskitchen"]["fridge"].items, 6.4); 
table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, "Extended_Foods.RamenPot");
table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, 3.2;

-- ------------------------------------------------
-- Game hooks
-- ------------------------------------------------
Events.OnGameBoot.Add(Extended_Foods.init);

 

 

ANY AND ALL HELP WILL BE GREATLY APPRECIATED!!!

Those who help (fixing/providing code/assets) WILL BE CREDITED IN MOD AND PAGES!

 

Here is a link to the original EXTENDED FOODS MOD thread (again, for the Build 41 mod, a new thread will be made).

Edited by lance789
Link to comment
Share on other sites

  • 2 weeks later...

In your Users>User>Zomboid folder there is a file called console.txt

I have a shortcut to this file on my desktop so I can more easily open it while working on mods. Have a look at your console.txt, and it will tell you exactly what line in what file is causing errors. I usually scroll to the very bottom and work my way up till I see error lines... Take note of the line# and file name. Start there to find your solution.

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