Jump to content

Custom Crafting Tab (Character-Specific) Not Appearing


Recommended Posts

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

rip tab.PNG

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 by NeddoFreddo
Link to comment
Share on other sites

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")

 

  • Like 1
Link to comment
Share on other sites

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 by NeddoFreddo
Link to comment
Share on other sites

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

 @DarkXero Thanks, that works :D

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

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

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