icantevenname Posted July 28, 2017 Share Posted July 28, 2017 How does one make it so that a character would already know how to craft things? Like tier-based (Knowing everything you get from the Science Machine, Hat Machine, ect.) or tab based (Knowing everything under the Food tab, War tab, ect.)? Link to comment Share on other sites More sharing options...
Lumina Posted July 28, 2017 Share Posted July 28, 2017 (edited) I know how to make that a character know a recipe when starting, but not an entire tab/tier This is the code i'm using for knowing a recipe at the start : inst:DoTaskInTime(0, function(inst) inst.components.builder:AddRecipe("backpack") inst:PushEvent("unlockrecipe", { recipe = "backpack" }) end) Put it in your master postinit Edited July 28, 2017 by Lumina Link to comment Share on other sites More sharing options...
icantevenname Posted July 29, 2017 Author Share Posted July 29, 2017 17 hours ago, Lumina said: I know how to make that a character know a recipe when starting, but not an entire tab/tier This is the code i'm using for knowing a recipe at the start : inst:DoTaskInTime(0, function(inst) inst.components.builder:AddRecipe("backpack") inst:PushEvent("unlockrecipe", { recipe = "backpack" }) end) Put it in your master postinit It works just fine, thanks! Link to comment Share on other sites More sharing options...
KirbyJParasol Posted July 30, 2017 Share Posted July 30, 2017 If you want your character to know all the recipes from tier 1 science (like Wickerbottom) throw this line into the master_postinit section inst.components.builder.science_bonus = 1 Change it to 2 if you want him to know everything from the alchemy engine. I assume you'd just change "science" to "magic" if you want to do the same for prestihatitator/shadow manipulator, but I don't know. You can test it if you want. Link to comment Share on other sites More sharing options...
Lumina Posted July 30, 2017 Share Posted July 30, 2017 The problem with Wickerbottom is that she don't know all the recipe for tier 1. She got a bonus to science. Meaning that if you craft a science machine, the science bonus allows her to craft all tier 2 recipe with the science machine. This is a lot more powerful than knowing all the tier 1 recipe. Link to comment Share on other sites More sharing options...
KirbyJParasol Posted July 30, 2017 Share Posted July 30, 2017 RIGHT Good clarification, because my code will make your character just like Wickerbottom in that respect. Link to comment Share on other sites More sharing options...
JohnWatson Posted July 30, 2017 Share Posted July 30, 2017 (edited) For unlocking recipes in a certain tab: inst:DoTaskInTime(0,function() local rtab = RECIPETABS.FARM if inst.components.builder==nil then return end for k,v in pairs(AllRecipes) do if IsRecipeValid(v.name) and v.tab == rtab and inst.components.builder:CanLearn(v.name) and not inst.components.builder:KnowsRecipe(v.name) then inst.components.builder:UnlockRecipe(k) end end end) For unlocking recipes in certain research levels: inst:DoTaskInTime(0,function() local rtech = "ORPHANAGE" local rlvl = 1 if inst.components.builder==nil then return end for k,v in pairs(AllRecipes) do if IsRecipeValid(v.name) and v.level[rtech]==rlvl and inst.components.builder:CanLearn(v.name) and not inst.components.builder:KnowsRecipe(v.name) then inst.components.builder:UnlockRecipe(k) end end end) Edited July 30, 2017 by JohnWatson 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