Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

NeddoFreddo

Custom Crafting Tab (Character-Specific) Not Appearing

Recommended Posts

NeddoFreddo    603

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

Share this post


Link to post
Share on other sites
DarkXero    2,698

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

  • Like 1

Share this post


Link to post
Share on other sites
makar5000    52

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

Share this post


Link to post
Share on other sites
NeddoFreddo    603
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.

Share this post


Link to post
Share on other sites
Lumina    1,295

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

 

 

  • Like 1

Share this post


Link to post
Share on other sites
DarkXero    2,698
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"

 

  • Like 2

Share this post


Link to post
Share on other sites
NeddoFreddo    603

 @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
Lumina    1,295

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

  • Like 1

Share this post


Link to post
Share on other sites
DarkXero    2,698
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"

 

  • Like 1

Share this post


Link to post
Share on other sites