Jump to content

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

@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")

@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
On 2/27/2021 at 9:59 AM, FurryEskimo said:
cheapbirdtrap.atlas = "images/inventoryimages/cheapbirdtrap.xml"

Hello!
I have followed some part of your codes and they're working!
But this one seems not work though, the image I use doesn't appear.
Can you help me figure out what missing?

Edit :
Ah nevermind, I found it why!
Apparently I also need to put myitem.image = "myitem.tex" too.
Ha silly me

Edited by rafidy99
Issue already solved.

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
×
  • Create New...