Jump to content

Character Specific Recipe for Recipeless, existing item?


Recommended Posts

Hi, I'm trying to have my character be able to craft Unagi (an existing item, but with no crafting recipe to my knowledge) with no TECH requirements (where only he can craft it). I've run through a multitude of code searching online, but can't get any of them to work. The simplest, and most easy to follow of these is:

local function GenerateMealRecipe(prefab, 1)
    AddRecipe(
        prefab,
        {
            Ingredient("fish", 1),Ingredient("cutlichen", 1)
        },
        RECIPETABS.FOOD,
        TECH.NONE,
        nil,
        nil,
        nil,
        6,
        "ching"
    )
end
GenerateMealRecipe("unagi", 1)

This code looks like it would be more appropriate, but I couldn't even get the game to not crash using this:

local myrecipe = AddRecipe("unagi",
{GLOBAL.Ingredient("cutlichen", 1), GLOBAL.Ingredient("fish", 1)},
GLOBAL.RECIPETABS.FOOD, 
GLOBAL.TECH.NONE, 
nil, nil, nil, nil, 
min_spacing, nounlock, numtogive"meal_builder",
"images/inventoryimages/unagi.xml", "unagi.tex") 
GLOBAL.STRINGS.RECIPE_DESC.UNAGI = "Food"
--Chr prefab has been assigned "meal_builder" tag
--I've used placeholder unagi.xml,.tex files just to make sure they're in my mod directory

Thanks, I hate to bring up a point that's been explored alot, but I'm at loss on how everyone else got it to work. Any help appreciated.

Link to comment
Share on other sites

Eyeballing this one and say your missing quite a few lines of code:

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

Recipe = GLOBAL.Recipe
Ingredient = GLOBAL.Ingredient
TECH = GLOBAL.TECH

local unagi_recipe = AddRecipe("unagi", { Ingredient("cutlichen", 1), Ingredient("fish", 1)}, RECIPETABS.FOOD, TECH.NONE, nil, nil, nil, nil, "meal_builder", "images/inventoryimages/uangi.xml")

all this goes into the modmain, like I said I eye balled this one so test it out (bit busy today)

Link to comment
Share on other sites

Oh right, I already had that first block, but commented it out on accident. But is your code to replace what I've already got? Or add to it? Either way, I'm not seeing any option to craft Unagi (I imagine when its working, the FOOD tab will always appear with the single option? Right now the game acts vanilla-ly, with no sign of new recipes). And don't worry, I'm in no hurry either.

Link to comment
Share on other sites

Huh the food tab is actually the farm tab, heh ok well reediting:

local unagi_recipe = AddRecipe("unagi", { Ingredient("cutlichen", 1), Ingredient("fish", 1)}, RECIPETABS.FARM, TECH.NONE, nil, nil, nil, nil, "meal_builder", "images/inventoryimages/unagi.xml")

there only the character with the meal_builder tag can build it.

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...