Jump to content

Recommended Posts

So, I'm working on a character mod for dst! However i've run into a weird issue. When I add my character tag to my crafting recipe the game crashes, but without the tag included it works just fine. Which Is really weird, I checked for typos or anything of that sort but there aren't any. Any help would be awesome!

 

Here's my crash;

And my character has the tag 'wramp_crafter' for some reason it works with my other items, just not this one

[00:02:42]: [string "scripts/util.lua"]:618: Could not find an asset matching wramp_crafter in any of the search paths.
LUA ERROR stack traceback:
        =[C] in function 'assert'
        scripts/util.lua(618,1) in function 'resolvefilepath'
        scripts/recipe.lua(106,1) in function '_ctor'
        scripts/class.lua(191,1) in function 'Recipe'
        scripts/modutil.lua(799,1) in function 'AddRecipe'
        ../mods/Wramp Clothier Toch ups Coat/modmain.lua(136,1) in main chunk
        =[C] in function 'xpcall'
        scripts/util.lua(778,1) in function 'RunInEnvironment'
        scripts/mods.lua(579,1) in function '_InitializeModMain'
        local MS_MODNAME = 'workshop-2812783478';local a = {}
 

 

 

AddRecipe2 = function(name, ingredients, tech, config, filters)

The 4th argument must be a table. builder_tag is the tag you must have to make the recipe.

Spoiler
Recipe2("yourprefab", 
{Ingredient("prefab", 1), Ingredient("prefab", 1)},
TECH.EXAMPLETECH,
{builder_tag="wramp_crafter"})

Hmm. I added the recipe and it works without crashing, but I cannot find the item in the crafting menue. I went back and doubble checked that I spelled the tag correctly not sure what went wrong.

image.png.9b5385aac03510a0df0456727b7dd9e2.png

Recipe2("winter_attire",
    { Ingredient("redgem", 1), Ingredient("beefalowool", 8), Ingredient("voidcloth", 4)},
    TECH.MAGIC_TWO,
    {builder_tag="wramp_crafter"})

oh, using AddCharacterRecipe is more accurate than Recipe2. it will be in your character filter rather than a crafting filter.

in modmain.lua (or something like recipes.lua) you can use this

env.AddCharacterRecipe = function(name, ingredients, tech, config, extra_filters)
Spoiler
AddCharacterRecipe("winter_attire",
{GLOBAL.Ingredient("redgem", 1), GLOBAL.Ingredient("beefalowool", 8), GLOBAL.Ingredient("voidcloth", 4)},
GLOBAL.TECH.MAGIC_TWO,
{builder_tag="wramp_crafter"})

or some equivalent

on top of using Recipe2, the function uses SetModRPCID() which is probably why it doesnt show up before?

nice character by the way

Edited by oregu

I tried to add the crafting icon in at the end, like the original had but It crashes do you know how I would go about adding it?

Here's what I put

AddCharacterRecipe("winter_attire",
{GLOBAL.Ingredient("redgem", 1), GLOBAL.Ingredient("beefalowool", 8), GLOBAL.Ingredient("nightmarefuel", 10)},
GLOBAL.TECH.MAGIC_TWO,
{builder_tag="wramp_crafter"},"images/inventoryimages/winter_attire.xml")
  • Like 1

I think I almost got it, my sytax might be wrong here's what I put and my crash;

[string "../mods/Winter attire/modmain.lua"]:54: unexpected symbol near ')'

 

AddCharacterRecipe("winter_attire",
{GLOBAL.Ingredient("redgem", 1), GLOBAL.Ingredient("beefalowool", 8), GLOBAL.Ingredient("nightmarefuel", 10)},
GLOBAL.TECH.MAGIC_TWO,
{builder_tag="wramp_crafter", atlas = "images/inventoryimages/winter_attire.xml",},)
  • Like 1

@oregu Sorry to bother you!

I took a look at it but I was unable to make the crafting icon appear, the game isn't crashing but the crafting icon won't appear. You might see my mistake here's what I have;

AddCharacterRecipe("winter_attire",
{GLOBAL.Ingredient("redgem", 1), GLOBAL.Ingredient("beefalowool", 8), GLOBAL.Ingredient("nightmarefuel", 10)},
GLOBAL.TECH.MAGIC_TWO,
{builder_tag="wramp_crafter"}, {atlas = "images/inventoryimages/winter_attire.xml", image = "winter_attire.tex"})
  • Like 1

Oh, for some reason I did not get notification for this post. Sorry for the delay! Let me have a look.

Did you try putting it in the table along with buildertag instead of the 5th argument? The 5th argument is reserved for additional filters the clothing has.

Spoiler
-- modmain.lua:
-- Make sure you add your images to Assets!
Assets = 
{
	Asset("ATLAS", "images/inventoryimages/winter_attire.xml"),
	Asset("IMAGE", "winter_attire.tex"),	  
}

RegisterInventoryItemAtlas("images/inventoryimages/winter_attire.xml", "winter_attire") -- This may work instead of adding an atlas to your recipe.
-- If it doesnt work try winter_attire.tex instead?

AddCharacterRecipe("winter_attire",
{ -- recipes.lua or recipe.lua
    GLOBAL.Ingredient("redgem", 1), 
    GLOBAL.Ingredient("beefalowool", 8), 
    GLOBAL.Ingredient("nightmarefuel", 10)
},
GLOBAL.TECH.MAGIC_TWO, -- techtree.lua
{ -- recipe.lua
    builder_tag = "wramp_crafter",
    atlas = "images/inventoryimages/winter_attire.xml", -- if this is an inventory item, only add this if you want the recipe image to be different than your inventory item image. otherwise, make an inventory item atlas for your item.
    image = "winter_attire.tex",
},
{ -- recipes_filter.lua
    "CLOTHING",
    "WINTER",
})

-- winter_attire.lua:
-- to change an inventory item image
inst:AddComponent("inventoryitem")
inst.components.inventoryitem:ChangeImageName("") -- if your item is invisible even in inventory, make this your current prefab name

 

Edited by oregu

@oregu

Sorry about the ping, I was trying to add a crafting recipie to a already existing item; I know wilson can craft purple gems but when I tried to use AddCharacterRecipe to add another way to craft purplegems It over-rided the original recipie.

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