Augustusc Posted February 10, 2016 Share Posted February 10, 2016 Hello! I have a few questions related to crafting recipes. How would one go about creating a crafting recipe for say, a hat. all the files for said item are make, and the item works in game. Link to comment Share on other sites More sharing options...
Kzisor Posted February 10, 2016 Share Posted February 10, 2016 11 minutes ago, Augustusc said: How would one go about creating a crafting recipe for say, a hat. Fill in the following function with the appropriate information. AddRecipe(prefab_name, ingredients, tab, level, placer, min_spacing, nil, numtogive, builder_tag, atlas, image) Ingredients is a table of ingredients so it would be as followed: { GLOBAL.Ingredients("[INSERT PREFAB NAME HERE]", [INSERT QUANTITY HERE]), ... } ... is the additional ingredients that you want to add. If you only want to add one simply remove the ... from the code. Link to comment Share on other sites More sharing options...
Augustusc Posted February 10, 2016 Author Share Posted February 10, 2016 Do each of those need to be filled? i see a few i know to fill, but a few also don't look like anything i have seen before. also. i'm assuming i put this into modmain.lua. if i want it so only the mod character i'm making can use this recipe, then do i put it in my character.lua? Link to comment Share on other sites More sharing options...
Kzisor Posted February 11, 2016 Share Posted February 11, 2016 1 hour ago, Augustusc said: Do each of those need to be filled? They have to be filled in order, if you don't need one of the parameters(options) then simply fill it with 'nil' without the '. 1 hour ago, Augustusc said: also. i'm assuming i put this into modmain.lua. if i want it so only the mod character i'm making can use this recipe, then do i put it in my character.lua? That is what the builder_tag parameter(option) is for, example, "deathraybuilder" in your character common_postinit function you add the tag "deathraybuilder". Now only your character can build recipes with the tag "deathraybuilder". Link to comment Share on other sites More sharing options...
Augustusc Posted February 11, 2016 Author Share Posted February 11, 2016 (edited) here is the line of code i added to modmain.lua AddRecipe(hat_herder, { GLOBAL.Ingredients("beefalowool", 12)}, RECIPETABS.DRESS, {SCIENCE = 0, MAGIC = 0, ANCIENT = 0},nil, nil, nil, nil, "herderhat_builder", "images/inventoryimages/hat_herder.xml", "hat_herder.tex") I tried the code out, but i crashed, here is the log file. log.txt Edited February 11, 2016 by Augustusc Link to comment Share on other sites More sharing options...
Muche Posted February 11, 2016 Share Posted February 11, 2016 It's actually GLOBAL.Ingredient. It seems to me, that if you looked at how other mods/base game do things, it could answer a lot of questions. Link to comment Share on other sites More sharing options...
Kzisor Posted February 11, 2016 Share Posted February 11, 2016 @Muche is correct, also you need to have quotations around the prefab name. Link to comment Share on other sites More sharing options...
Augustusc Posted February 11, 2016 Author Share Posted February 11, 2016 It worked! thanks everyone (for anyone who is having trouble, here is the line i used. just edit it to you're needs) AddRecipe("hat_herder", {Ingredient("beefalowool", 12)}, GLOBAL.RECIPETABS.DRESS, GLOBAL.TECH.SCIENCE_ONE, nil, nil, nil, nil, "herderhat_builder", "images/inventoryimages/hat_herder.xml", "hat_herder.tex") also. make sure you put these these things in the strings local Recipe = GLOBAL.Recipe local RECIPETABS = GLOBAL.RECIPETABS local Ingredient = GLOBAL.Ingredient local TECH = GLOBAL.TECH 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