Jump to content

Updating Old Character Mod (2021) / Custom Item Issues


Recommended Posts

Hello,

 

I've finally gotten around to updating my character mod from 2021 to work with the newer item menu and are having some compatibility issues. My character has a single custom item that I'd like for only the character to be able to craft without any research, like Wigfrid.

The item appears in the starting inventory like it should and is usable, but is no where to be seen in the crafting menu. Not under 'Survivor Items' or even the 'Modded Items' filter. I used the updated AddRecipe2 using some existing mod's codes and some guides on here and still no luck.

Also, my character's icon in "Survivor Items" is much too large. Is there a way I can scale this down to fit within the square properly?

 

I'll attach the mod in a .zip file.

image_1.png

image_2.png

image_3.png

wolyo.zip

Link to comment
Share on other sites

Your character needs the same tag you set as "builder_tag" in your recipe, so in this case "wolyo". Just add

inst:AddTag("wolyo")

inside your character's "common_postinit" function, in prefabs/wolyo.lua.

About the character icon being too big, I don't know why that happens. I hope someone else can help you with that!

Edited by ClumsyPenny
Link to comment
Share on other sites

The above reply is correct (your character is missing a tag), but I suggest you use AddCharacterRecipe instead. You can find it on this post.

Even adding the tag didn't make the recipe appear, so I changed the recipe (and the recipe listed in "wolyo_recipes", just in case) to this as a baseline to see if it would work:

Quote

AddCharacterRecipe("booboobat", -- name
    { -- ingredients
        GLOBAL.Ingredient("boards", 1),
        GLOBAL.Ingredient("rope", 2),
        GLOBAL.Ingredient("stinger", 8),
    },
    GLOBAL.TECH.NONE, -- tech
    { -- config
        product = "booboobat",
        builder_tag = "wolyo",
        numtogive = 1,
    },
    { -- filters
        "WEAPONS",
    }
)

The recipe still wouldn't appear...

Then I commented out this line from your modmain:

Quote

AddDeconstructRecipe("booboobat", {Ingredient("log", 1), Ingredient("rope", 1), Ingredient("stinger", 2)})

And the recipe now appears.

image.png.a6b5068c687206cd47fd3eb910b71e03.png

Turns out "AddDeconstructRecipe" was the culprit the entire time. You'll have to see if there's a new way to do that.

Also, the post I linked above also includes info on how to set a custom crafting avatar at the bottom of the post; I just took a duplicate of the existing avatar and redrew it to be slightly smaller when I updated my mod.

Edited by Chesed
  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Chesed said:

Turns out "AddDeconstructRecipe" was the culprit the entire time. You'll have to see if there's a new way to do that.

Also, the post I linked above also includes info on how to set a custom crafting avatar at the bottom of the post; I just took a duplicate of the existing avatar and redrew it to be slightly smaller when I updated my mod.

Perfection, got everything working - including the icon. Thank you both for your help :)

  • Like 1
  • GL Happy 1
Link to comment
Share on other sites

3 hours ago, Chesed said:

Turns out "AddDeconstructRecipe" was the culprit the entire time. You'll have to see if there's a new way to do that.

Ah, I completely missed that one, nice catch! Anyway, AddDeconstuctRecipe isn't needed if a recipe already exists. It's only needed if an item does NOT have a recipe and you want to be able to get those drops when hammering/deconstructing. So, no need to add it, it's still deconstructable by virtue of being an item with a recipe.

Link to comment
Share on other sites

3 hours ago, ClumsyPenny said:

Ah, I completely missed that one, nice catch! Anyway, AddDeconstuctRecipe isn't needed if a recipe already exists. It's only needed if an item does NOT have a recipe and you want to be able to get those drops when hammering/deconstructing. So, no need to add it, it's still deconstructable by virtue of being an item with a recipe.

In case anyone comes across this in the future, AddDeconstructRecipe was merged into AddRecipe2 using a config variable. You can use this syntax to add a modern deconstruction recipe
 

AddRecipe2("beardhair",
	{ -- ingredients
		Ingredient("silk", 5),
		Ingredient("twigs", 5),
		Ingredient("goldnugget", 5),
	},
	-- tech level
	TECH.SCIENCE_ONE, 
	{ -- config
		-- this var makes the recipe not craftable by normal means
		-- but still allows it to be deconstructed
		is_deconstruction_recipe = true 
	},
	{ -- crafting filters
		"MODS",
		"CLOTHING"
	}
)

 

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