Jump to content

Custom crafting recipe?


Recommended Posts

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

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

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

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 by Augustusc
Link to comment
Share on other sites

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

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
 Share

×
  • Create New...