NeddoFreddo

Custom Crafting Tab (Character-Specific) Not Appearing

9 posts in this topic

Posted (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

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

Share this post


Link to post
Share on other sites

Think about what is the value of GLOBAL.CUSTOM_RECIPETABS.MUSIC when you call AddRecipe.

1 person likes this

Share this post


Link to post
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")

 

1 person likes this

Share this post


Link to post
Share on other sites

Posted (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 by NeddoFreddo

Share this post


Link to post
Share on other sites

I'm not sure you can have 2 recipes for the same item. As far as i know you need a workaround for this.

 

 

1 person likes this

Share this post


Link to post
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"

 

1 person likes this

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Shouldn't the string be outside of the addrecipe ? Maybe it could help ?

1 person likes this

Share this post


Link to post
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"

 

1 person likes this

Share this post


Link to post
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