Eremus007 Posted February 4, 2016 Share Posted February 4, 2016 Hey, I've got a question. I've figured everything out with the dwarventonic prefab and it works fine. Then I tried to add a custom crafting recipe to make the prefab available in survival. ------------------------------------------ This works: local dwarventonic_recipe = AddRecipe("dwarventonic", { Ingredient("nitre", 1), Ingredient("carrot", 6)}, RECIPETABS.SURVIVAL, TECH.NONE, nil, nil, nil, nil, "dwarf", "images/inventoryimages/dwarventonic.xml" ) This doesn't work and crashes: local dwarventonic_recipe = AddRecipe("dwarventonic", { Ingredient("nitre", 1), Ingredient("carrot", 6), Ingredient("woodenmug", 1)}, RECIPETABS.SURVIVAL, TECH.NONE, nil, nil, nil, nil, "dwarf", "images/inventoryimages/dwarventonic.xml" ) The prefab "woodenmug" is a custom prefab that I added with the purpose of it being part of the recipe. Why can't I use a custom prefab in a recipe while I can debugspawn it sucessfully? How do I add a modded ingredient to the recipe? I couldn't find a solution anywhere on google. Many thanks! -Eremus Link to comment Share on other sites More sharing options...
rons0n Posted February 4, 2016 Share Posted February 4, 2016 @Eremus007 Off the top of my head You forgot the xml bit example: GLOBAL.Ingredient("grail", 1, "images/inventoryimages/grail.xml") Whenever you use a custom ingredient in your recipe you have to add in the xml aswell Anyone feel free to correct me Link to comment Share on other sites More sharing options...
Eremus007 Posted February 4, 2016 Author Share Posted February 4, 2016 12 minutes ago, rons0n said: @Eremus007 Off the top of my head You forgot the xml bit example: GLOBAL.Ingredient("grail", 1, "images/inventoryimages/grail.xml") Whenever you use a custom ingredient in your recipe you have to add in the xml aswell Anyone feel free to correct me So I have to put that line of code in the xml file of the inventoryimage then? Link to comment Share on other sites More sharing options...
PanAzej Posted February 4, 2016 Share Posted February 4, 2016 Put it before the recipe in modmain.lua. Link to comment Share on other sites More sharing options...
Eremus007 Posted February 4, 2016 Author Share Posted February 4, 2016 2 minutes ago, PanAzej said: Put it before the recipe in modmain.lua. I did that and it still crashes when I scroll down the survival tab Link to comment Share on other sites More sharing options...
PanAzej Posted February 4, 2016 Share Posted February 4, 2016 (edited) 14 minutes ago, Eremus007 said: I did that and it still crashes when I scroll down the survival tab What does the crash say? Do you have the xml you try to load in ingredient declared in assets? Not sure if this will change anything, but try this: local woodenmug = GLOBAL.Ingredient( "woodenmug", 1) woodenmug.atlas = "images/inventoryimages/woodenmug.xml" and then add in your recipe woodenmug as ingredient, but without the quotation marks. To be clear, here's the working* recipe: local dwarventonic_recipe = AddRecipe("dwarventonic", { Ingredient("nitre", 1), Ingredient("carrot", 6), woodenmug }, RECIPETABS.SURVIVAL, TECH.NONE, nil, nil, nil, nil, "dwarf", "images/inventoryimages/dwarventonic.xml" ) Edited February 4, 2016 by PanAzej Link to comment Share on other sites More sharing options...
Eremus007 Posted February 5, 2016 Author Share Posted February 5, 2016 8 hours ago, PanAzej said: What does the crash say? Do you have the xml you try to load in ingredient declared in assets? Not sure if this will change anything, but try this: local woodenmug = GLOBAL.Ingredient( "woodenmug", 1) woodenmug.atlas = "images/inventoryimages/woodenmug.xml" and then add in your recipe woodenmug as ingredient, but without the quotation marks. To be clear, here's the working* recipe: local dwarventonic_recipe = AddRecipe("dwarventonic", { Ingredient("nitre", 1), Ingredient("carrot", 6), woodenmug }, RECIPETABS.SURVIVAL, TECH.NONE, nil, nil, nil, nil, "dwarf", "images/inventoryimages/dwarventonic.xml" ) Thanks man, that worked! The log told that it couldn't load the woodenmug xml file. I would never have gotten on that solution myself. so thank you very much 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