Jump to content

Recommended Posts

Hello! I tried to find good tutorials but couldn't find it. Hope to find help here

I want to add custom items to the character. It is necessary that only he can craft them and that he has the items at the start of the game. I used the template for custom items, but the items don't show up in the game at all. Also, for some reason, the texture of the large portrait and the name in the selection menu are crashing, maybe this is somehow connected?

passguard test.zip

Link to comment
https://forums.kleientertainment.com/forums/topic/146467-issues-with-custom-items/
Share on other sites

Hopefully you can refer to one of my mod 'Riko, Reg & Nanachi' as an example to see what is omitted or wrong. Without looking into your mod, I think you need to make sure inventory images, big portraits, xml file of golden names, strings and starting inventory all correct.

Hey hey. Took a look at your mod for you.

First off, the mod started compiling a ton of sprites as soon as I launched the game. Those compiled some files that seem to be missing in the zipped file you originally sent, and cause the game to crash if you try and run the mod without them. I'm not sure if this is part of your issue or just an old version of the mod, but do check to see if your autocompiler is compiling these sprites correctly if not.

Secondly, I see the mod is using "AddRecipe" so the tutorial/template you're using could be outdated. Try AddCharacterRecipe:

Your custom_hat recipe would look like this for example:

Quote

AddCharacterRecipe("custom_hat", -- name
    { -- ingredients
        GLOBAL.Ingredient("rope", 1),
        GLOBAL.Ingredient("axe", 1),
        GLOBAL.Ingredient("cutgrass", 3),
    },
    GLOBAL.TECH.NONE, -- tech
    { -- config
        product = "custom_hat",
        builder_tag = "passguard",
        numtogive = 1,
    },
    { -- filters
        "CHARACTER",
        "CLOTHING",
    }
)
RegisterInventoryItemAtlas("images/inventoryimages/custom_hat.xml", "custom_hat.tex")

And then you go into esctemplate.lua and add this line to local common_postinit = function(inst)  (you can stick it below the minimap line if you want):

Quote

inst:AddTag("passguard")

That will allow him to access his recipes.

Lastly, it looks like something went wrong adding your starting items. Make sure that part of your code looks like this:

In esctemplate.lua:

Quote

-- Custom starting inventory
TUNING.GAMEMODE_STARTING_ITEMS.DEFAULT.ESCTEMPLATE = {
    "custom_hat",
    "custom_handitem",
}

local start_inv = {}

for k, v in pairs(TUNING.GAMEMODE_STARTING_ITEMS) do
    start_inv[string.lower(k)] = v.ESCTEMPLATE
end

local prefabs = FlattenTree(start_inv, true)

He should then start with them.

I hope this helps you out. Any other problems and I'll be happy to help.

On 3/13/2023 at 11:08 PM, Chesed said:

Hey hey. Took a look at your mod for you.

First off, the mod started compiling a ton of sprites as soon as I launched the game. Those compiled some files that seem to be missing in the zipped file you originally sent, and cause the game to crash if you try and run the mod without them. I'm not sure if this is part of your issue or just an old version of the mod, but do check to see if your autocompiler is compiling these sprites correctly if not.

Secondly, I see the mod is using "AddRecipe" so the tutorial/template you're using could be outdated. Try AddCharacterRecipe:

Your custom_hat recipe would look like this for example:

And then you go into esctemplate.lua and add this line to local common_postinit = function(inst)  (you can stick it below the minimap line if you want):

That will allow him to access his recipes.

Lastly, it looks like something went wrong adding your starting items. Make sure that part of your code looks like this:

In esctemplate.lua:

He should then start with them.

I hope this helps you out. Any other problems and I'll be happy to help.

Sorry for late reply, I was busy a bit... Thanks so much!! It works! ^^

  • Like 1

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