Jump to content

Recipes Not Working


Guy

Recommended Posts

I'm trying to add a few new items and recipes to the game.  The items themselves appear with their slick new icons, and the lua script I wrote to spawn them works fine, but when I bring up the context menu the recipes themselves don't show up.  I'm sure it's something painfully simple that's causing the issue, but I could use some new eyes on it.

 

In Zomboid>mods>Guy's Mod>media>scripts I have two files, GMItems.txt and GMRecipes.txt.  Here's my item file (which works):

 

module Base{ /*******************Item Overrides*******************/item Cigarettes{Count = 20,HungerChange = 0,Weight = 0.0,RequireInHandOrInventory = Lighter,Type = Food,UnhappyChange = 10,DisplayName = Cigarettes,StressChange = -25,Icon = cigarette,CustomContextMenu = Smoke,}} module GuysMod{imports{Base} /************************Items************************/item CigarettePack{Weight = 0.05,Type = Normal,DisplayName = Pack of Cigarettes,Icon = cigPack,} item CigaretteCarton{Weight = 0.5,Type = Normal,DisplayName = Carton of Cigarettes,Icon = cigCarton,} }

 

And here is my recipe file (which does not work):

 

module GuysMod{imports{Base} recipe Wring Dish Towel{   Base.DishClothWet,    Result:Base.DishCloth,   Time:150.0,} recipe Wring Bath Towel{   Base.BathTowelWet,    Result:Base.BathTowel,   Time:200.0,} recipe Open carton of Cigarettes    {GuysMod.CigaretteCarton,         Result:GuysMod.CigarettePack=10,        Time:5.0,    }     recipe Open pack of Cigarettes    {GuysMod.CigarettePack, Result:Base.Cigarettes,Time:5.0,    }     recipe Put in a pack    {        Base.Cigarettes=20,         Result:GuysMod.CigarettePack,        Time:5.0,    }     recipe Put in a carton    {        GuysMod.CigarettePack=10,         Result:GuysMod.CigaretteCarton,        Time:5.0,    }}

 

Initially I had the recipes working by adding everything into the base recipe/item files, but when I moved them out to make it a mod instead of just altering the game scripts, they stopped working.  The game's built-in recipes still work fine. Any help spotting my error would be appreciated.

Link to comment
Share on other sites

Didn't have much time to play with this over the weekend, but I finally managed to resolve this issue this morning.  The problem was with the scope.  I was trying to be explicit in my calls to item names, but apparently this was not only unnecessary but actually detrimental. For example, this:

 

 recipe Open pack of Cigarettes{    GuysMod.CigarettePack,     Result:Base.Cigarettes,    Time:5.0,} 

 

Should actually have looked like this:

 

 recipe Open pack of Cigarettes{    CigarettePack,     Result:Cigarettes,    Time:5.0,}  

 

Not sure if I'm misunderstanding how using the scope works or what, but once removed everything works smoothly.

 

Minor side note:  At one point, the icons for my new items stopped showing up without my changing anything.  After a validation of the game's steam files, they reappeared, so if your icons ever disappear, try this first.

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