NeddoFreddo Posted May 14, 2017 Share Posted May 14, 2017 (edited) Hey all, So, I'm trying to make a crafting tab, the game doesn't crash but it just doesn't show up on the list. I've copied the code from recipes.lua, but it doesn't seem to work. I also had a peek at some other mods that added character-specific tabs, but they don't seem to work for me either. Spoiler Relevant chunks of code: (I think) modmain.lua: AddRecipe("onemanband", {Ingredient("goldnugget", 3), Ingredient("nightmarefuel", 3)}, GLOBAL.CUSTOM_RECIPETABS.MUSIC, GLOBAL.TECH.SCIENCE_ONE, nil, nil, nil, nil, "musician") --this is just a test, i'll make it into the actual onemanband recipe later, just can't be bothered to look up what it is now lmao GLOBAL.CUSTOM_RECIPETABS.MUSIC = { str = "Music", sort = 5, icon = "musictab.tex", icon_atlas = "images/hud/musictab.xml" } character.lua local common_postinit = function(inst) -- Minimap icon inst.MiniMapEntity:SetIcon( "wilfred.tex" ) inst:AddTag("musician") --he can access the custom music tab (in theory) end Log: client_log.txt Any help is greatly appreciated Edited May 14, 2017 by NeddoFreddo Link to comment Share on other sites More sharing options...
DarkXero Posted May 14, 2017 Share Posted May 14, 2017 Think about what is the value of GLOBAL.CUSTOM_RECIPETABS.MUSIC when you call AddRecipe. Link to comment Share on other sites More sharing options...
Cunning fox Posted May 15, 2017 Share Posted May 15, 2017 Try this: local _G = GLOBAL local TUNING = _G.TUNING local STRINGS = _G.STRINGS local RECIPETABS = _G.RECIPETABS local Ingredient = _G.Ingredient local TECH = _G.TECH local CUSTOM_RECIPETABS = _G.CUSTOM_RECIPETABS STRINGS.NAMES.MUSIC_TAB = "Music"--Compatibility with trnslations music_tab = AddRecipeTab(STRINGS.NAMES.MUSIC_TAB, 5, "images/hud/musictab.xml", "musictab.tex", nil, false) AddRecipe("onemanband", {Ingredient("goldnugget", 3), Ingredient("nightmarefuel", 3)}, music_tab, TECH.SCIENCE_ONE, nil, nil, nil, nil, "musician") 1 Link to comment Share on other sites More sharing options...
NeddoFreddo Posted May 16, 2017 Author Share Posted May 16, 2017 (edited) 22 hours ago, makar5000 said: boop Thanks, that worked. Do you know how to make the custom onemanband recipe only for the custom character, along with the music tab? All other characters should also be able to access the normal onemanband recipe through the magic tab. EDIT: Ok, I got the tab's availability to work, however the problem remains that other characters can't craft the onemanband in the magic tab with the default recipe. Edited May 16, 2017 by NeddoFreddo Link to comment Share on other sites More sharing options...
Lumina Posted May 16, 2017 Share Posted May 16, 2017 I'm not sure you can have 2 recipes for the same item. As far as i know you need a workaround for this. Link to comment Share on other sites More sharing options...
DarkXero Posted May 17, 2017 Share Posted May 17, 2017 20 hours ago, NeddoFreddo said: EDIT: Ok, I got the tab's availability to work, however the problem remains that other characters can't craft the onemanband in the magic tab with the default recipe. local musicbandrec = AddRecipe("onemanband_alt", {Ingredient("goldnugget", 3), Ingredient("nightmarefuel", 3)}, music_tab, TECH.SCIENCE_ONE, nil, nil, nil, nil, "musician") musicbandrec.image = "onemanband.tex" musicbandrec.product = "onemanband" Link to comment Share on other sites More sharing options...
NeddoFreddo Posted May 18, 2017 Author Share Posted May 18, 2017 @DarkXero Thanks, that works I was just trying to add a crafting name and description by changing the code: local musicbandrec = AddRecipe("onemanband_alt", {Ingredient("goldnugget", 2), Ingredient("nightmarefuel", 2), Ingredient("papyrus", 1)}, GLOBAL.CUSTOM_RECIPETABS.MUSIC, GLOBAL.TECH.SCIENCE_ONE, --GLOBAL.STRINGS.RECIPE_DESC.MUSICBANDREC = "The vegan alternative.", GLOBAL.STRINGS.NAMES.MUSICBANDREC = "One-Man Band", nil, nil, nil, nil, "musician") musicbandrec.image = "onemanband.tex" musicbandrec.product = "onemanband" but, unsurprisingly, the game crashes at the character select screen. The log gives me this error: [string "../mods/WILFRED REMASTERD (ANGELIC NOISES)/modmain.lua"]:266: ')' expected (to close '(' at line 264) near '=' Can you help, or is it impossible to add a name and description? Link to comment Share on other sites More sharing options...
Lumina Posted May 18, 2017 Share Posted May 18, 2017 Shouldn't the string be outside of the addrecipe ? Maybe it could help ? Link to comment Share on other sites More sharing options...
DarkXero Posted May 18, 2017 Share Posted May 18, 2017 15 hours ago, NeddoFreddo said: help local musicbandrec = AddRecipe("onemanband_alt", {Ingredient("goldnugget", 2), Ingredient("nightmarefuel", 2), Ingredient("papyrus", 1)}, GLOBAL.CUSTOM_RECIPETABS.MUSIC, GLOBAL.TECH.SCIENCE_ONE, nil, nil, nil, nil, "musician") musicbandrec.image = "onemanband.tex" musicbandrec.product = "onemanband" GLOBAL.STRINGS.RECIPE_DESC.ONEMANBAND_ALT = "The vegan alternative." GLOBAL.STRINGS.NAMES.ONEMANBAND_ALT = "One-Man Band" Link to comment 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