Jump to content

Custom Item Not Showing Up In Tab (Solved)


Recommended Posts

I'm trying to get a custom weapon I created to show up in the weapons tab.
I can spawn it in and it attacks like a spear, so I know the issue isn't with the item itself.

The character's name is noise, if that helps. I can share the modmain if anyone wants to see if I made an error somewhere.

I have these added to my modmain.lua. I know they're meant for adding custom items.

local RECIPETABS = GLOBAL.RECIPETABS
local Recipe = GLOBAL.Recipe
local Ingredient = GLOBAL.Ingredient
local TECH = GLOBAL.TECH

The code for the weapon itself looks like this.

Have I misplaced a comma somewhere or an I missing a function for this?

 local noisebatrecipe = AddRecipe("noisebat",
 { Ingredient("flint", 1), Ingredient("twigs", 1)},
 RECIPETABS.WAR,
 TECH.NONE,
 nil,
 nil,
 nil,
 nil,
 "noise_builder",
 "images/inventoryimages/noisebaticon.xml", "noisebaticon.tex")
 
STRINGS.RECIPE_DESC.NOISEBAT = "A shiny plastic bat."

 

The inventory image I'm calling is used in the inventory slot. It  appears in the inventory slot, so I know it's not formatted wrong. I thought it'd be fine if it was the same image, but it might need to be it's own image? If so, can anyone tell me the dimensions required and if it needs to be 1d or not?
 

Thank you for any suggestions!

Edit: this post is helpful for anyone who wants a custom item to only be available to your character.
Adding this bit to hopefully help anyone looking in the future!

 

Edited by 768484_1452794859
Solved!
Link to comment
Share on other sites

Adding a recipe should be put in the modmain.lua. In my mod it looks like this:

AddRecipe("prefab", {Ingredient("prefab", quantity)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "xml image", "tex image")

 

  • Like 1
Link to comment
Share on other sites

I did put that in my modmain!
Hmm.... is it because I tried to add a builder tag?
Do I need to add a tag first?

Where would I add the tag? In the lua for my character, or the modmain itself?

Link to comment
Share on other sites

Did you add the "noise_builder" tag to your character?

Oh, yeah, you should add inst:AddTag("noise_builder") to your characters prefab file.

Edited by IThatGuyI
  • Like 1
Link to comment
Share on other sites

I'm going to answer my own question haha.
I figured out where I went wrong.
I tried to add a builder tag without giving one to the character in their prefab.

I went to the character and put this in their " local common_postinit = function(inst)  ": inst:AddTag("noise")

Putting that in that function gave my character a tag and allowed the recipe to show up only for that character.

Also, thank you ThatGuy for helping!
Your words helped me think about where I went wrong and I got it!

  • Like 1
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...