JUSTICEBEETLE Posted November 1, 2024 Share Posted November 1, 2024 (edited) Hello!! I'm new to modding and this is my first post (i'm a little shy), but this is giving me a lot of trouble and I could use some help!! I'm making a custom character for fun/practice, which is going well so far (aside from the coding giving me a headache), and I want him to have custom items; he has psychic powers and makes objects with his mind, so i want him to be able craft an object with his... literal mind (sanity). similar to how wes uses sanity to craft his balloons I kinda understand how to make custom items, I can get normal items to work, but I cant get the "crafting with sanity" part to work. I looked at the recipe code for wes's balloons (and someone's old post idk) but if i try to put the sanity ingredient the game just closes (no error, but it only happens when i change that, so it must be that) when i try to test it. I'm certain I must be missing something, so could someone perhaps show me how to make that kind of recipe work? TYSM!!! hello from the character too <3 Edited November 8, 2024 by JUSTICEBEETLE my issue was solved already but now i can make edits to posts lol 1 Link to comment https://forums.kleientertainment.com/forums/topic/160479-solved-how-to-make-custom-item-that-costs-sanity-to-craft/ Share on other sites More sharing options...
Chesed Posted November 1, 2024 Share Posted November 1, 2024 I have a recipe for an item like this and this is what my code looks like. The bolded parts are relevant to you. Quote local CHARACTER_INGREDIENT = GLOBAL.CHARACTER_INGREDIENT AddCharacterRecipe("frightmask", -- name { -- ingredients GLOBAL.Ingredient("blankmask", 1), GLOBAL.Ingredient("nightmarefuel", 5), GLOBAL.Ingredient(CHARACTER_INGREDIENT.SANITY, 30), }, GLOBAL.TECH.NONE, -- tech { -- config product = "frightmask", builder_tag = "maskmaker", numtogive = 1, }, { -- filters "CHARACTER", "CLOTHING", } ) If you have code just like this and it's still not working, you can show me what you have and I'll try to help! 1 Link to comment https://forums.kleientertainment.com/forums/topic/160479-solved-how-to-make-custom-item-that-costs-sanity-to-craft/#findComment-1755584 Share on other sites More sharing options...
JUSTICEBEETLE Posted November 1, 2024 Author Share Posted November 1, 2024 2 hours ago, Chesed said: I have a recipe for an item like this and this is what my code looks like. The bolded parts are relevant to you. If you have code just like this and it's still not working, you can show me what you have and I'll try to help! Omg!! I added the bolded stuff to my code and it worked like a charm!!! Thank you so much, I really appreciate the help, this was driving me nuts One day maybe I'll even understand how this code stuff works...! Now I just have to actually make the items, wahaha 1 Link to comment https://forums.kleientertainment.com/forums/topic/160479-solved-how-to-make-custom-item-that-costs-sanity-to-craft/#findComment-1755597 Share on other sites More sharing options...
NPCMaxwell Posted November 1, 2024 Share Posted November 1, 2024 Oh this is nice! I'm glad someone dared to ask cause I haven't managed to figure this out either for my custom maxwell's custom maxwellitems. ^^ Just asking: Is there a way to also make this work for already pre-existing crafts because I would love to have my low-health version of Maxwell to be able to craft a reviver on cost of his sanity instead. (I have seen a mod from the workshop that does this but I didn't seem to be able to include it in my own mod to only count for my custom character.) 1 Link to comment https://forums.kleientertainment.com/forums/topic/160479-solved-how-to-make-custom-item-that-costs-sanity-to-craft/#findComment-1755605 Share on other sites More sharing options...
Chesed Posted November 8, 2024 Share Posted November 8, 2024 (edited) On 11/1/2024 at 4:25 PM, NPCMaxwell said: I didn't seem to be able to include it in my own mod to only count for my custom character. Sorry for the late reply... I was intending to answer you when I had the time but I forgor. Sorry if you've already solved this issue. Uhhh I think the easiest way to do this is to make a second recipe for the same item. I think that's how Klei does it for characters like Woodie. To make it exclusive to your character you'd use "AddCharacterRecipe". This lets you define a "builder_tag" that you give to your mod character. For instance here's an example recipe for a Telltale Heart if I wanted my mod character to be able to make one for himself. Quote GLOBAL.STRINGS.NAMES.EXAMPLE_RECIPE = "Example" AddCharacterRecipe("example_recipe", -- we don't want this to match the existing recipe name { -- ingredients GLOBAL.Ingredient("bee", 99), GLOBAL.Ingredient("bonestew", 1), }, GLOBAL.TECH.NONE, -- tech { -- config product = "reviver", --give us a Telltale Heart builder_tag = "maskmaker", numtogive = 1, }, { -- filters "CHARACTER", } ) And he has this in his common_postinit Quote inst:AddTag("maskmaker") So his recipe shows up in his survivor crafts just for him. Here's what it looks like in his tab: Spoiler Don't ask where the bees go. If you look at the code above for my "frightmask" item, you'll see the filters are CHARACTER and CLOTHING. You could change clothing to "RESTORATION" and your character should see the recipe in his health tab as well. I hope this is useful for someone. Edited November 8, 2024 by Chesed 2 1 Link to comment https://forums.kleientertainment.com/forums/topic/160479-solved-how-to-make-custom-item-that-costs-sanity-to-craft/#findComment-1756250 Share on other sites More sharing options...
NPCMaxwell Posted November 8, 2024 Share Posted November 8, 2024 9 hours ago, Chesed said: Sorry for the late reply... I was intending to answer you when I had the time but I forgor. Sorry if you've already solved this issue. Uhhh I think the easiest way to do this is to make a second recipe for the same item. I think that's how Klei does it for characters like Woodie. To make it exclusive to your character you'd use "AddCharacterRecipe". This lets you define a "builder_tag" that you give to your mod character. For instance here's an example recipe for a Telltale Heart if I wanted my mod character to be able to make one for himself. And he has this in his common_postinit So his recipe shows up in his survivor crafts just for him. Here's what it looks like in his tab: Hide contents Don't ask where the bees go. If you look at the code above for my "frightmask" item, you'll see the filters are CHARACTER and CLOTHING. You could change clothing to "RESTORATION" and your character should see the recipe in his health tab as well. I hope this is useful for someone. Thank you!!! I will try this out to make sanity a necessary recourse for several craftings for my Maxwell then. About the filter tab it's not so important. It's enough if it's in his own filter (I suppose this means I can use my already existing build tag for him for those secondary reciptes then) 1 Link to comment https://forums.kleientertainment.com/forums/topic/160479-solved-how-to-make-custom-item-that-costs-sanity-to-craft/#findComment-1756291 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now