Clothilde Vn Posted April 7, 2024 Share Posted April 7, 2024 Hi everyone i'm creating a character that can create some basic items with his sanity and some health. So far i've done that: AddRecipe("armor_bramble", {Ingredient("livinglog", 3), Ingredient("log", 3)}, charactertab, TECH.NONE, nil, nil, nil, 1, "char_builder") AddRecipe("livinglog", {Ingredient(GLOBAL.CHARACTER_INGREDIENT.HEALTH, 30) }, charactertab, TECH.NONE, nil, nil, nil, 1, "char_builder") AddRecipe("log", {Ingredient(GLOBAL.CHARACTER_INGREDIENT.HEALTH, 20) }, charactertab, TECH.NONE, nil, nil, nil, 1, "char_builder") AddRecipe("twigs", {Ingredient(GLOBAL.CHARACTER_INGREDIENT.HEALTH, 10) }, charactertab, TECH.NONE, nil, nil, nil, 1, "char_builder") AddRecipe("forgetmelots", {Ingredient(GLOBAL.CHARACTER_INGREDIENT.HEALTH, 10), Ingredient(GLOBAL.CHARACTER_INGREDIENT.SANITY, 5) }, charactertab, TECH.NONE, nil, nil, nil, 2, "char_builder") Everything is working very fine. But now i want to add a new ingredient for a new recipe which will cost hunger. I thought they would be something like GLOBAL.CHARACTER_INGREDIENT.HEALTH or GLOBAL.CHARACTER_INGREDIENT.SANITY but i don't find it. There is, apparently, no GLOBAL.CHARACTER_INGREDIENT.HUNGER. So, how do i do that? Thank you very much, have a nice day. Link to comment https://forums.kleientertainment.com/forums/topic/155507-need-help-with-ingredient-as-hunger/ Share on other sites More sharing options...
The Noon Fish Posted April 18, 2024 Share Posted April 18, 2024 (edited) On 4/7/2024 at 1:41 PM, Clothilde Vn said: So, how do i do that? You'd have to mess with three files (i think). builder, builder_replica, and recipe.lua for builder (and builder replica, builder_replica is client sided info while builder itself is for the server) you'd want to mess with Builder:RemoveIngredients (careful, RemoveIngredients isnt in the replica!) and Builder:HasCharacterIngredient for dealing with the UI half of the component your using to craft with (in this case hunger) then in recipe.lua you'd want to mess with the function IsCharacterIngredient (not too sure about this one. it might be overkill messing with the recipe.lua itself so try just messing with the builder and builder_replica and test them on their own before you mess with recipe.lua) im not too sure on specifics because i'm trying to find how to do it myself (honestly the only other thread i could find gives no actual help on setting it up other than hacking an upvalue) EDIT: forgot this part but after you finish this you'd need to add the ingredient itself to the CHARACTER_INGREDIENT table in constants (you can do that via a table.insert in modmain) EDIT 2: sorry about the first edit i forgot that table.insert shouldnt be used for that. instead just make a new file and slap a copy of the table CHARACTER_INGREDIENT with the custom ingredient from constants.lua and modimport/require it in modmain. be warned there IS NO ART for it, so you'd have to make your own icon for it to show up instead of a blank square (if it doesnt crash) Edited April 18, 2024 by The Noon Fish i forgor Link to comment https://forums.kleientertainment.com/forums/topic/155507-need-help-with-ingredient-as-hunger/#findComment-1710629 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