Jump to content

How to make a custom recipe


Recommended Posts

I want to make a recipe like 1 flit and 1 log makes 3 twigs or make a cheaper gold axe how would I do that. 

I have this command will this help me?

local Recipe = GLOBAL.Recipe
local RECIPETABS = GLOBAL.RECIPETABS
local Ingredient = GLOBAL.Ingredient
local TECH = GLOBAL.TECH

Link to comment
Share on other sites

@Dogmeat8990

I think you're looking for something like this:

--AddRecipe(self, name, ingredients, tab, level, placer, min_spacing, nounlock, numtogive, builder_tag, atlas, image)
AddRecipe("twigs", {Ingredient("flint", 1), Ingredient("log", 1), Ingredient(GLOBAL.CHARACTER_INGREDIENT.HEALTH, 50) }, RECIPETABS.SURVIVAL, TECH.SCIENCE_ONE, nil, nil, nil, 3, "YOURPLAYERSNAME")
Link to comment
Share on other sites

@Dogmeat8990
Try @ me so I'm notified.  ^-^

The recipe I posted requires you to unlock the tech, and that requires you to be at a science station.  You'll receive an intelligence bonus for doing so.  You also need to enter the character's name at the end if only one character can make the item.

This is what's in my modmain:

local require = GLOBAL.require
local STRINGS = GLOBAL.STRINGS

local Recipe = GLOBAL.Recipe  --(Test code)
local RECIPETABS = GLOBAL.RECIPETABS
local TECH = GLOBAL.TECH

--AddRecipe(self, name, ingredients, tab, level, placer, min_spacing, nounlock, numtogive, builder_tag, atlas, image)
local ice_den = AddRecipe("ice_den",{ Ingredient("twigs", 6), Ingredient("cutgrass", 8), Ingredient("ice", 12) }, RECIPETABS.SURVIVAL, TECH.SCIENCE_ONE, "ice_den_placer", nil, nil, nil, "furryeskimo")
ice_den.atlas = "images/inventoryimages/ice_den.xml"

local cheapbirdtrap = AddRecipe("cheapbirdtrap",{ Ingredient("twigs", 3), Ingredient("papyrus", 2) }, RECIPETABS.SURVIVAL, TECH.SCIENCE_ONE, nil, nil, nil, nil, "furryeskimo")  --Cheap bird trap.
cheapbirdtrap.atlas = "images/inventoryimages/cheapbirdtrap.xml"
GLOBAL.STRINGS.NAMES.CHEAPBIRDTRAP = "Cheap Bird Trap"  --Test code.
STRINGS.RECIPE_DESC.CHEAPBIRDTRAP = "Easy to carry,\nbut very delicate."
STRINGS.CHARACTERS.GENERIC.DESCRIBE.CHEAPBIRDTRAP= "If a trap goes off, and noone is around to hear it, do I still get dinner?"

--Allows the cheap bird cages to be displayed correctly on the character select screen.
TUNING.STARTING_ITEM_IMAGE_OVERRIDE["cheapbirdtrap"] = {atlas = "images/inventoryimages/cheapbirdtrap.xml", image = "cheapbirdtrap.tex"}

--Hound whistle
if GetModConfigData("whistlemaker") == 2 then
	AddRecipe("houndwhistle", {Ingredient("goldnugget", 4), Ingredient("nightmarefuel", 2), Ingredient(GLOBAL.CHARACTER_INGREDIENT.HEALTH, 50) }, RECIPETABS.MAGIC, TECH.MAGIC_TWO, nil, nil, nil, nil, "furryeskimo")
end

I've attached the Recipes file, which is how Klei adds all their recipes.

recipes[1].lua

Edited by FurryEskimo
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...