Jump to content

How to add second recipe to the existing item?


Recommended Posts

 I need to my character can craft the hambat but when i try to add recipe, the original recipe change to my recipe. Does anybody can help to fix this?

Quote

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

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

Quote

AddRecipe("hambat", { Ingredient("hambat", 1), Ingredient(GLOBAL.CHARACTER_INGREDIENT.HEALTH, 20)}, RECIPETABS.SURVIVAL, TECH.NONE, nil, nil, nil, nil, "dkm")

Link to comment
Share on other sites

SOLVED

I use AddCharacterRecipe 

Quote

AddCharacterRecipe("hamburder", -- name
    { -- ingredients
        GLOBAL.Ingredient("hambat", 1),
        GLOBAL.Ingredient(GLOBAL.CHARACTER_INGREDIENT.HEALTH, 20),
    },
    GLOBAL.TECH.NONE, -- tech
    { -- config
        product = "hambat",
        builder_tag = "dkm",
        numtogive = 1,
    }, 
    { -- filters
        "SURVIVAL",
    }
)

 

Link to comment
Share on other sites

Its actually relatively easy to add a second recipe to an item. Here I'll leave an example of how I do it for a birdcage

local birdcage = AddRecipe("birdcage2", {GLOBAL.Ingredient("papyrus", 1), GLOBAL.Ingredient("goldnugget", 3), GLOBAL.Ingredient("seeds", 1)}, frisktab, TECH.SCIENCE_ONE, nil, nil, nil, nil, "frisk_builder", nil, nil )
birdcage.product = "birdcage"
birdcage.image = "birdcage.tex"

Basically you add a new recipe and define it as a local variable in your modmain.lua

in add recipe name give it a different name from the original (in my example I called "birdcage" "birdcage2")

then you can change the product produced by the recipe back to the original "birdcage"

and finally assign the texture image.

 

So going with yours it might look something like

local hambat = AddRecipe("hambat2", { Ingredient("hambat", 1), Ingredient(GLOBAL.CHARACTER_INGREDIENT.HEALTH, 20)}, RECIPETABS.SURVIVAL, TECH.NONE, nil, nil, nil, nil, "dkm")
hambat.product = "hambat"
hambat.image = "hambat.tex"

I hope this helped :)

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