IcyTheWhite Posted August 14, 2015 Share Posted August 14, 2015 Well, this is my question.How do you tweak an existing recipe in modmain.lua without it losing it's position? For example Science Machine. It's easy to change it's recipe, but how do you keep it's position in the crafting tab?STRINGS = GLOBAL.STRINGSRECIPETABS = GLOBAL.RECIPETABSTECH = GLOBAL.TECHRecipe = GLOBAL.RecipeIngredient = GLOBAL.IngredientRecipe ("researchlab", {Ingredient("log", 4), Ingredient("rocks", 4), Ingredient("nitre", 2)}, RECIPETABS.SCIENCE, TECH.NONE, "researchlab_placer")Using this code makes it drop down to the bottom.Any help please? Link to comment https://forums.kleientertainment.com/forums/topic/57074-help-how-do-you-tweak-a-crafting-recipe/ Share on other sites More sharing options...
DarkXero Posted August 16, 2015 Share Posted August 16, 2015 @IcyTheWhite:local AllRecipes = GLOBAL.AllRecipeslocal Ingredient = GLOBAL.Ingredientlocal RECIPETABS = GLOBAL.RECIPETABSlocal TECH = GLOBAL.TECHlocal sortkey = AllRecipes["researchlab"].sortkeyAddRecipe("researchlab", {Ingredient("log", 4), Ingredient("rocks", 4), Ingredient("nitre", 2)}, RECIPETABS.SCIENCE, TECH.NONE, "researchlab_placer")AllRecipes["researchlab"].sortkey = sortkey Link to comment https://forums.kleientertainment.com/forums/topic/57074-help-how-do-you-tweak-a-crafting-recipe/#findComment-663727 Share on other sites More sharing options...
IcyTheWhite Posted August 16, 2015 Author Share Posted August 16, 2015 (edited) That's smart. So you copied its sortkey, changed the recipe and than returned its original sortkey.I understand the logic, but didn't know there was such a function. Edit:Although it doesn't work for DS RoG at all. These two games are so much different from each other nowadays. For one "AllRecipes" is a nil value in DS RoG, I think it has to be just "Recipe" and "AddRecipe" function doesn't work. Also the ".sortkey" doesn't seem to work the way it does in DST. Do you have any idea what has to be changed? Edited August 16, 2015 by IcyTheWhite Link to comment https://forums.kleientertainment.com/forums/topic/57074-help-how-do-you-tweak-a-crafting-recipe/#findComment-663796 Share on other sites More sharing options...
DarkXero Posted August 16, 2015 Share Posted August 16, 2015 @IcyTheWhite:local Ingredient = GLOBAL.Ingredientlocal RECIPETABS = GLOBAL.RECIPETABSlocal TECH = GLOBAL.TECHlocal game = TheSim:GetGameID()if game == "DS" then local Recipes = GLOBAL.Recipes local sortkey = Recipes["researchlab"].sortkey Recipe("researchlab", {Ingredient("log", 4), Ingredient("rocks", 4), Ingredient("nitre", 2)}, RECIPETABS.SCIENCE, TECH.NONE, "researchlab_placer") Recipes["researchlab"].sortkey = sortkeyelseif game == "DST" then local AllRecipes = GLOBAL.AllRecipes local sortkey = AllRecipes["researchlab"].sortkey AddRecipe("researchlab", {Ingredient("log", 4), Ingredient("rocks", 4), Ingredient("nitre", 2)}, RECIPETABS.SCIENCE, TECH.NONE, "researchlab_placer") AllRecipes["researchlab"].sortkey = sortkeyend Link to comment https://forums.kleientertainment.com/forums/topic/57074-help-how-do-you-tweak-a-crafting-recipe/#findComment-663863 Share on other sites More sharing options...
IcyTheWhite Posted August 16, 2015 Author Share Posted August 16, 2015 It works! You're an indisputable genius! Although had to fix "TheSim:GetGameID()" to "GLOBAL.TheSim:GetGameID()", otherwise it would be a nil value. I can't thank you enough! Link to comment https://forums.kleientertainment.com/forums/topic/57074-help-how-do-you-tweak-a-crafting-recipe/#findComment-663896 Share on other sites More sharing options...
Maris Posted August 17, 2015 Share Posted August 17, 2015 Ingredient = GLOBAL.IngredientGLOBAL.AllRecipes["researchlab"].ingredients = {Ingredient("log", 4), Ingredient("rocks", 4), Ingredient("nitre", 2)} Link to comment https://forums.kleientertainment.com/forums/topic/57074-help-how-do-you-tweak-a-crafting-recipe/#findComment-664081 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