Jump to content

[SOLVED] Custom Item Recipes Not Showing Correct Image/Blank Image in Crafting Menu


Recommended Posts

Hello,

I have been making a custom item and I have a main crafting recipe and 3 other recipes for the same item. I needed to make the item not deconstructable but after adding the code to prevent the deconstruction, the item no longer shows its own image in the crafting filter and instead uses the same image as the item above or below it. When scrolling through the filter the image changes between the item above and the item below. When I click on the item itself to view its name, description, and materials required, the space that usually shows the item is blank.
The item appears normally in the inventory and when dropped on the ground.
This is the code for the main recipe and the 3 other recipes:
 

AddRecipe("essence",
{ Ingredient("moonrocknugget", 1)},
RECIPETABS.REFINE,
TECH.MAGIC_TWO,
{no_deconstruction=true,atlas="images/inventoryimages/essence.xml",image="images/inventoryimages/essence.tex"})

local essence2 = AddRecipe("essence2", { Ingredient("moonglass", 1)}, RECIPETABS.REFINE, TECH.MAGIC_TWO) -- need anti deconstruct
essence2.product = "essence"
essence2.image = "images/inventoryimages/essence.xml"
essence2.numtogive = 1
STRINGS.NAMES.ESSENCE2 = "Lunar Essence"
STRINGS.RECIPE_DESC.ESSENCE2 = "The stuff of the moon."

local essence3 = AddRecipe("essence3", { Ingredient("moonglass_charged", 1)}, RECIPETABS.REFINE, TECH.MAGIC_TWO) -- need anti deconstruct
essence3.product = "essence"
essence3.image = "images/inventoryimages/essence.xml"
essence3.numtogive = 2
STRINGS.NAMES.ESSENCE3 = "Lunar Essence"
STRINGS.RECIPE_DESC.ESSENCE3 = "The stuff of the moon."

local essence4 = AddRecipe("essence4", { Ingredient("purebrilliance", 1)}, RECIPETABS.REFINE, TECH.MAGIC_TWO) -- need anti deconstruct
essence4.product = "essence"
essence4.image = "images/inventoryimages/essence.xml"
essence4.numtogive = 3
STRINGS.NAMES.ESSENCE4 = "Lunar Essence"
STRINGS.RECIPE_DESC.ESSENCE4 = "The stuff of the moon."


I have other items in a different format and they work fine. They all only have one crafting recipe per item.
Here is an example.
 

AddRecipe("aligniumfuel",
{ Ingredient("essence", 1, "images/inventoryimages/essence.xml"), Ingredient("nightmarefuel", 1)},
RECIPETABS.REFINE,
TECH.MAGIC_TWO,
nil, -- need anti deconstruct
nil,
nil,
2,
nil, -- <- Custom character tag would go here if you wanted only that character to craft your item
"images/inventoryimages/aligniumfuel.xml")


All of these items have their .xml and .tex files in the mod.
Any assistance would be appreciated!

Edited by BombardmentPigs
Link to comment
Share on other sites

An update:
I've tested using many different formats for addrecipe, I've tried addrecipe2, I've tried telling it to use the .xml of another item, I've tried deleting and re-adding the inventoryimages, and the problem is still there.

Link to comment
Share on other sites

20 hours ago, BombardmentPigs said:

An update:
I've tested using many different formats for addrecipe, I've tried addrecipe2, I've tried telling it to use the .xml of another item, I've tried deleting and re-adding the inventoryimages, and the problem is still there.

Try this
 

Spoiler
Assets = {
	Asset("IMAGE", "images/inventoryimages/essence.tex"),
	Asset("ATLAS", "images/inventoryimages/essence.xml"),
}

RegisterInventoryItemAtlas("images/inventoryimages/essence.xml", "essence.tex")
AddRecipe2("essence",
	{
	GLOBAL.Ingredient("moonrocknugget", 1)
	},
	GLOBAL.TECH.SCIENCE_ONE,
	{
		no_deconstruction = true,
		atlas = "images/inventoryimages/essence.xml",
		image = "images/inventoryimages/essence.tex"
	},
	{
		"REFINE"
	}
)

 

 

Link to comment
Share on other sites

4 hours ago, Haruhi Kawaii said:

Try thi
 

  Hide contents
Assets = {
	Asset("IMAGE", "images/inventoryimages/essence.tex"),
	Asset("ATLAS", "images/inventoryimages/essence.xml"),
}

RegisterInventoryItemAtlas("images/inventoryimages/essence.xml", "essence.tex")
AddRecipe2("essence",
	{
	GLOBAL.Ingredient("moonrocknugget", 1)
	},
	GLOBAL.TECH.SCIENCE_ONE,
	{
		no_deconstruction = true,
		atlas = "images/inventoryimages/essence.xml",
		image = "images/inventoryimages/essence.tex"
	},
	{
		"REFINE"
	}
)

 

 


Unfortunately I've tried your method and the game crashes during the loading screen. Thanks for the attempt though.

Another Update:
I found a way to get the main recipe working:
 

AddRecipe2("essence",
{ Ingredient("moonrocknugget", 1)},
TECH.MAGIC_TWO,
{atlas="images/inventoryimages/essence.xml",no_deconstruction=true})

I think the reason was that I simply did not use the new addrecipe2 format correctly.
Trying to fix the other 3 recipes now.

The 3 other recipes have been solved by implementing a similar format.
Here is the code of all 4 recipes:
 

AddRecipe2("essence",
{ Ingredient("moonrocknugget", 1)},
TECH.MAGIC_TWO,
{atlas="images/inventoryimages/essence.xml",no_deconstruction=true})

local essence2 = AddRecipe2("essence2",
{ Ingredient("moonglass", 1)},
TECH.MAGIC_TWO,
{atlas="images/inventoryimages/essence.xml",product="essence"})

local essence2 = AddRecipe2("essence3",
{ Ingredient("moonglass_charged", 1)},
TECH.MAGIC_TWO,
{atlas="images/inventoryimages/essence.xml",product="essence",numtogive=2})
STRINGS.NAMES.ESSENCE3 = "Lunar Essence x2"

local essence2 = AddRecipe2("essence4",
{ Ingredient("purebrilliance", 1)},
TECH.MAGIC_TWO,
{atlas="images/inventoryimages/essence.xml",product="essence",numtogive=3})
STRINGS.NAMES.ESSENCE4 = "Lunar Essence x3"


The problem has been solved!

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