amazingGob Posted September 10, 2025 Share Posted September 10, 2025 i want to add recipes to my modded character tab AddRecipeToFilter("spear", "CHARACTER") i tried this but it made it so that everyone also have it in their tab, what am i missing? Link to comment https://forums.kleientertainment.com/forums/topic/167918-adding-a-recipes-to-the-character-filter/ Share on other sites More sharing options...
FerniFrenito Posted September 10, 2025 Share Posted September 10, 2025 42 minutes ago, amazingGob said: i want to add recipes to my modded character tab AddRecipeToFilter("spear", "CHARACTER") i tried this but it made it so that everyone also have it in their tab, what am i missing? This function only ensures that your prefab is in that group, but it does not ensure that only your character can access that group. Link to comment https://forums.kleientertainment.com/forums/topic/167918-adding-a-recipes-to-the-character-filter/#findComment-1835039 Share on other sites More sharing options...
amazingGob Posted September 10, 2025 Author Share Posted September 10, 2025 i see... how do you suggest i go about this then? Link to comment https://forums.kleientertainment.com/forums/topic/167918-adding-a-recipes-to-the-character-filter/#findComment-1835055 Share on other sites More sharing options...
Kyno Posted September 10, 2025 Share Posted September 10, 2025 (edited) AddCharacterRecipe(...) with builder_tag = "character_tag" Edited September 10, 2025 by Kyno 1 Link to comment https://forums.kleientertainment.com/forums/topic/167918-adding-a-recipes-to-the-character-filter/#findComment-1835061 Share on other sites More sharing options...
amazingGob Posted September 10, 2025 Author Share Posted September 10, 2025 ohhh so if im reading this right, i have to basically make a new identical recipe for them? Link to comment https://forums.kleientertainment.com/forums/topic/167918-adding-a-recipes-to-the-character-filter/#findComment-1835066 Share on other sites More sharing options...
FerniFrenito Posted September 10, 2025 Share Posted September 10, 2025 1 hour ago, Kyno said: AddCharacterRecipe(...) with builder_tag = "character_tag" That's the function: env.AddCharacterRecipe = function(name, ingredients, tech, config, extra_filters) initprint("AddCharacterRecipe", name) require("recipe") mod_protect_Recipe = false local rec = Recipe2(name, ingredients, tech, config) if config ~= nil and (config.builder_tag ~= nil or config.builder_skill ~= nil) then env.AddRecipeToFilter(name, CRAFTING_FILTERS.CHARACTER.name) else initprint("Warning: AddCharacterRecipe called for recipe "..name.." without a builder_tag or builder_skill. This recipe will be added to the mods filter instead of the character filter.") env.AddRecipeToFilter(name, CRAFTING_FILTERS.MODS.name) end if extra_filters ~= nil then for _, filter_name in ipairs(extra_filters) do env.AddRecipeToFilter(name, filter_name) end end mod_protect_Recipe = true rec:SetModRPCID() return rec end It is important to mention that "builder_tag" has to be inside the "config" table, like local config = {builder_tag = "your_tag"} And I think your character needs to have "your_tag" in order to build the thing. 45 minutes ago, amazingGob said: ohhh so if im reading this right, i have to basically make a new identical recipe for them? You need to replace AddPrefab2 or the function you are using to register your prefab with AddCharacterRecipe, you can just replace the name and add the configuration table, both receive the same first three parameters. 1 Link to comment https://forums.kleientertainment.com/forums/topic/167918-adding-a-recipes-to-the-character-filter/#findComment-1835069 Share on other sites More sharing options...
amazingGob Posted September 10, 2025 Author Share Posted September 10, 2025 how would you go about adding everything from a tab like the celestial alter tab into a character tab? most guide i can find uses the old system and doesnt seem to work anymore :c Link to comment https://forums.kleientertainment.com/forums/topic/167918-adding-a-recipes-to-the-character-filter/#findComment-1835076 Share on other sites More sharing options...
FerniFrenito Posted September 10, 2025 Share Posted September 10, 2025 24 minutes ago, amazingGob said: how would you go about adding everything from a tab like the celestial alter tab into a character tab? most guide i can find uses the old system and doesnt seem to work anymore :c I just found this method, in recipes.lua you can see what common feature the objects you want to add have for i,v in pairs(AllRecipes) do if v.station_tag ~= nil and v.station_tag == "celestial_station" then -- ... end end What's the old method you found? Maybe that will help me find a better solution. Link to comment https://forums.kleientertainment.com/forums/topic/167918-adding-a-recipes-to-the-character-filter/#findComment-1835084 Share on other sites More sharing options...
amazingGob Posted September 10, 2025 Author Share Posted September 10, 2025 5 minutes ago, FerniFrenito said: What's the old method you found? Maybe that will help me find a better solution. i was looking at this one Link to comment https://forums.kleientertainment.com/forums/topic/167918-adding-a-recipes-to-the-character-filter/#findComment-1835085 Share on other sites More sharing options...
FerniFrenito Posted September 10, 2025 Share Posted September 10, 2025 14 minutes ago, amazingGob said: i was looking at this one The thing is, AddRecipe in the builder component doesn't add the recipe to something, it makes you learn it. Now, I think what you want is for items from other tabs to appear in your character's crafting tab, ready to be crafted. I think you can achieve this by combining the function I gave you (if you don't want to go through the items one by one) and applying the AddRecipeToFilter function you mentioned at the beginning. Finally, this will probably work, but they will appear locked. To unlock them, use AddRecipe in your character's builder. This way, they will have already learned them and, in theory, they will be able to craft them without having the corresponding research lab. If it doesn't seem to work, apply the exact same thing to builder_replica. I don't understand the difference between the original component and its replica, or why a replica even exists, so I can't tell you which one to use to make it work. Link to comment https://forums.kleientertainment.com/forums/topic/167918-adding-a-recipes-to-the-character-filter/#findComment-1835089 Share on other sites More sharing options...
amazingGob Posted September 12, 2025 Author Share Posted September 12, 2025 On 9/10/2025 at 12:02 PM, FerniFrenito said: I just found this method, in recipes.lua you can see what common feature the objects you want to add have for i,v in pairs(AllRecipes) do if v.station_tag ~= nil and v.station_tag == "celestial_station" then -- ... end end What's the old method you found? Maybe that will help me find a better solution. hmm i tried doing this -- Add recipes for i,v in pairs(AllRecipes) do if v.station_tag ~= nil and v.station_tag == "celestial_station" then AddCharacterRecipe(v,v.recipes, GLOBAL.TECH.NONE, {builder_tag = "testchar",} , {"CHARACTER"}) end end but im getting this error [00:00:01]: [string "../mods/char/modmain.lua"]:83: bad argument #1 to 'pairs' (table expected, got nil) LUA ERROR stack traceback: =[C] in function 'pairs' ../mods/char/modmain.lua(83,1) in main chunk =[C] in function 'xpcall' scripts/util.lua(789,1) in function 'RunInEnvironment' scripts/mods.lua(603,1) in function 'InitializeModMain' scripts/mods.lua(577,1) in function 'LoadMods' scripts/main.lua(391,1) in function 'ModSafeStartup' scripts/main.lua(522,1) in function 'callback' scripts/modindex.lua(103,1) in function 'BeginStartupSequence' scripts/main.lua(521,1) in function 'callback' scripts/modindex.lua(735,1) =[C] in function 'GetPersistentString' scripts/modindex.lua(709,1) in function 'Load' scripts/main.lua(520,1) in main chunk Link to comment https://forums.kleientertainment.com/forums/topic/167918-adding-a-recipes-to-the-character-filter/#findComment-1835529 Share on other sites More sharing options...
FerniFrenito Posted September 12, 2025 Share Posted September 12, 2025 2 hours ago, amazingGob said: hmm i tried doing this -- Add recipes for i,v in pairs(AllRecipes) do if v.station_tag ~= nil and v.station_tag == "celestial_station" then AddCharacterRecipe(v,v.recipes, GLOBAL.TECH.NONE, {builder_tag = "testchar",} , {"CHARACTER"}) end end but im getting this error [00:00:01]: [string "../mods/char/modmain.lua"]:83: bad argument #1 to 'pairs' (table expected, got nil) LUA ERROR stack traceback: =[C] in function 'pairs' ../mods/char/modmain.lua(83,1) in main chunk =[C] in function 'xpcall' scripts/util.lua(789,1) in function 'RunInEnvironment' scripts/mods.lua(603,1) in function 'InitializeModMain' scripts/mods.lua(577,1) in function 'LoadMods' scripts/main.lua(391,1) in function 'ModSafeStartup' scripts/main.lua(522,1) in function 'callback' scripts/modindex.lua(103,1) in function 'BeginStartupSequence' scripts/main.lua(521,1) in function 'callback' scripts/modindex.lua(735,1) =[C] in function 'GetPersistentString' scripts/modindex.lua(709,1) in function 'Load' scripts/main.lua(520,1) in main chunk if you are in modmain.lua, use GLOBAL.AllRecipes Link to comment https://forums.kleientertainment.com/forums/topic/167918-adding-a-recipes-to-the-character-filter/#findComment-1835544 Share on other sites More sharing options...
amazingGob Posted September 12, 2025 Author Share Posted September 12, 2025 --modmain.lua for i,v in pairs(GLOBAL.AllRecipes) do if v.station_tag ~= nil then if v.station_tag == "celestial_station" or v.station_tag == "lunar_forge" then AddCharacterRecipe(v.name,v.ingredients, GLOBAL.TECH.NONE, {builder_tag = "testchar",} , {"CHARACTER"}) end end end ok i figured it out!!! somehow, its mostly just a lot of trial and error i dont really know how i ended up getting it to work 2 minutes ago, FerniFrenito said: if you are in modmain.lua, use GLOBAL.AllRecipes oh!!! i was switching between modmain and the prefab file tbh, i couldnt do it in the prefab file because i dont know how to call AddCharacterRecipe in there also i have to use v.name instead of just v in AddCharacterRecipe or ill get this error [00:00:00]: [string "scripts/recipe.lua"]:105: attempt to concatenate field 'product' (a table value) LUA ERROR stack traceback: scripts/recipe.lua(105,1) in function '_ctor' scripts/recipe.lua(214,1) in function '_ctor' scripts/class.lua(191,1) in function 'Recipe2' scripts/modutil.lua(763,1) in function 'AddCharacterRecipe' either way it's solved now thank you a lot for the help! Link to comment https://forums.kleientertainment.com/forums/topic/167918-adding-a-recipes-to-the-character-filter/#findComment-1835545 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