Jump to content

Recommended Posts

Hello!

I have figured out how to make custom items and their recipes, but I can't for the life of me figure out how to make my recipes go into their own tab. 

I've tried every method that comes up on Google to no avail.

 

A good example of what I'm trying to do is the One Piece character Chopper, but mimicking that code crashes the game for me, even though I can play and craft as Chopper no problem.

 

Another example of methods I've tried is what was discussed here: http://forums.kleientertainment.com/topic/47196-unable-to-add-custom-recipe-tab/

 

None of it works for me.

 

Suggestions?

Link to comment
https://forums.kleientertainment.com/forums/topic/59845-custom-recipe-tab/
Share on other sites

@naptimeshadows, custom recipe tabs have been made easier. Unless the mod is using AddRecipeTab in order to create their recipe tab they're doing it in an unsupported fashion.

 

The API supported way to create a recipe tab is as followed. Simply replace RECIPETABS.X in your AddRecipe function with recipe_tab.

local recipe_tab = AddRecipeTab(                                "custom_tab", -- Name of the tab to show the player.                                999, -- Sort Order #, 999 will place it at the bottom of the list.                                "images/recipe_tab.xml", -- Atlas file associated with the image file.                                "recipe_tab.tex", -- Image (.tex) file with the extension.                                nil -- Builder Tag if one is needed, character must have this tag in order to see tab.                                )
Edited by Kzisor

Fantastic!

With that, what do I use to tie recipes to that tab?

Is that what the builder tag is for?

 

For example:

local weapon_recipe = AddRecipe("swordcane",
{GLOBAL.Ingredient("item", 1), GLOBAL.Ingredient("item", 3)}, [TAB?], TECH.NONE,
nil, nil, nil, nil, nil,
"images/inventoryimages/weapon.xml", "weapon.tex")
swordcane_recipe.tagneeded = false
swordcane_recipe.builder_tag = "weapon_builder"
swordcane_recipe.atlas = resolvefilepath("images/inventoryimages/weapon.xml")
  • Like 1

I tried using the "recipe_tab" spot to tie in recipes, and it didn't work. 
I assume with no known recipes inside it, the tab won't show up?

There's nothing there; the rest of the tab icons haven't even shifted to make room for another one.

I saw that after the first few rounds of debugging.
So, I'm still having issues. 
The tab isn't showing up, and after fixing things here and there to make sure everything is perfect, I'm getting a specific error. 
 
Exact code and error are as follows:
(I can't figure out how to do the script box like you did, lol.)
 
local soldier_tab = AddRecipeTab(
                                "Soldiering", -- Name of the tab to show the player.
                                999, -- Sort Order #, 999 will place it at the bottom of the list.
                                "images/soldiertab.xml", -- Atlas file associated with the image file.
                                "soldiertab", -- Image (.tex) file without the extension.
                                "soldier_builder" -- Builder Tag if one is needed, character must have this tag in order to see tab.
                                )
 
local swordcane_recipe = AddRecipe("swordcane",
{GLOBAL.Ingredient("cane", 1), GLOBAL.Ingredient("nightmarefuel", 3)}, soldier_tab, TECH.NONE,
nil, nil, nil, nil, nil,
"images/inventoryimages/swordcane.xml", "swordcane.tex")
swordcane_recipe.tagneeded = true
swordcane_recipe.builder_tag = "soldier_builder"
swordcane_recipe.atlas = resolvefilepath("images/inventoryimages/swordcane.xml")
 
 
Character has:
inst:AddTag("soldier_builder")

 

Line 41 is:

"Soldiering", -- Name of the tab to show the player.

 

 

Any idea what I need to do from here?

post-733465-0-41743500-1449114092_thumb.

Edited by naptimeshadows

@naptimeshadows, looks like you have a rouge character in the file. Create a new file and copy the contents of the old file to the new file and delete the old file. Save the new file, DO NOT OVERWRITE IT AS IT COULD CAUSE THE ISSUE AGAIN.

 

Note:

You could also remove the information and the double dashes (--) as those are comments. Also make sure to put AddRecipeTab all on a single line.

Edited by Kzisor

I did that, and it definitely did not have the same effect. 

Putting it all on one line in a fresh .lua with no excess text gives me the below issue.

The window isn't crashing, it resizes and scales like it's supposed to.

Just no game content.

The HUD is unresponsive.

This is the only mod running.

This happened every time I entered a world.

 

EDIT::

 

I entered a world with other mods, and it looks like the recipe tabs for other custom characters are showing up, even though they absolutely shouldn't be.

 

Picture added.

post-733465-0-10141200-1449115607_thumb.

post-733465-0-99600400-1449115609_thumb.

post-733465-0-81775800-1449115880_thumb.

Edited by naptimeshadows

@naptimeshadows, Find the log.txt file under documents/klei/DontStarveTogether and post it here so we can help you further. I cannot tell you for sure why it's not showing up, but it more than likely has to do with the images/atlas file not being loaded.

 

Note:

Your recipe does not need tagneeded or builder_tag and the atlas is already set in the AddRecipe function. The 5th nil in your AddRecipe function call is the builder_tag variable, simply change nil to "soldier_builder" and it will be set.

I don't think it's an issue with the atlas, since before I ever tried making it a recipe, I made it a starting item, and it worked perfectly. 

 

I deleted the extra lines and it happened again.

Before re-running, I cleared the log, so the entries should just be about this one instance.

log.txt

@naptimeshadows,

 

Error from log file: [string "scripts/util.lua"]:423: Could not find an asset matching images/soldiertab.xml in any of the search paths.

 

This error indicates it's an issue with the atlas file for the soldier tab. Make sure it's in the location you specified.

 

Note: Did you remember to import it into the Assets table via:

Assets = {    Asset("ATLAS", "images/soldiertab.xml"),    Asset("IMAGE", "images/soldiertab.tex"),    -- ETC FOR ALL IMAGES AND ATLAS FILES.}
Edited by Kzisor

Ohhhhhh.

I just assumed it would query the hud folder.

Well, I tried both using the hud folder as a source as well as moving the file to the images folder, and both times I get the following issue.

I checked the .xml itself, and there was no mention of those pieces.

Sadly, I once again have no idea what to change, since the error seems to be referencing the DST files, not my mod.

Unless those things were supposed to be generated in the .xml and weren't?

post-733465-0-48386300-1449175934_thumb.

Sadly, I once again have no idea what to change, since the error seems to be referencing the DST files, not my mod.

 

The reason it's referencing the DST files is because the error is being 'generated' by the DST file when it's trying to load your atlas file. Put your mod in a zip file and upload it to the forums. That is the only way I will be able to assist you further.

OOHHHHH
 

I GOT IT TO WORK!

 

I added .tex to the Add Tab piece you sent me, and it shows up perfectly! 

 

Thank you!

 

local soldier_tab = AddRecipeTab("Soldiering", 999, "images/soldiertab.xml", "soldiertab.tex", "soldier_builder")
 
Edited by naptimeshadows

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
×
  • Create New...