Jump to content

[HELP] Item image missing in inventory and crafting recipe


Recommended Posts

Hey, I have been trying to make a simple mod where wormwood is able to craft the Stalking stick (from Hamlet) in his custom tab.

The item works fine and crafting it 2, however it appears invisible in the inventory and the recipe has no image (I also dont know how to make an image for the recipe or how it works/if it works with just the inventory image).

I am new to modding and I just copied parts of codes, the .tex and  and .xml image( and files for the anim folder) are just the same from the hamlet game files and the codes look like this:

 

modmain.lua:

--Assets = {
    --Asset("ATLAS_BUILD", "images/inventoryimages/walkingstick.xml", 256),
    --Asset("IMAGE", "images/inventoryimages/walkingstick.tex"),   
    --Asset("ATLAS", "images/inventoryimages/walkingstick.xml"),    
--}
 
PrefabFiles = {
    "walkingstick",
    
}
 
local naturetab = GLOBAL.CUSTOM_RECIPETABS.NATURE
local require = GLOBAL.require
local STRINGS = GLOBAL.STRINGS
local Ingredient = GLOBAL.Ingredient
local RECIPETABS = GLOBAL.RECIPETABS
local TECH = GLOBAL.TECH


 
GLOBAL.STRINGS.NAMES.WALKINGSTICK = "Stalking stick"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.WALKINGSTICK = "Speed stick"
STRINGS.RECIPE_DESC.WALKINGSTICK = "Handy stick for a walk"
 
----
local walkingstick_recipe = AddRecipe("walkingstick",
{GLOBAL.Ingredient("livinglog"2), GLOBAL.Ingredient("kelp"3)},
naturetab, TECH.NONE,
nilnilnilnilnil,
"images/inventoryimages/walkingstick.xml""walkingstick.tex")

 

scripts/prefabs/walkingstick.lua:

local assets=
{
    Asset("ANIM""anim/cane.zip"),
    Asset("ANIM""anim/walking_stick.zip"),
    Asset("ANIM""anim/swap_walking_stick.zip"),
    --Asset("ATLAS", "images/inventoryimages/walkingstick.xml"),
    --Asset("IMAGE", "images/inventoryimages/walkingstick.tex"),
}
 
local prefabs = 
{
}
 
local function onequip(instowner)
    local skin_build = inst:GetSkinBuild()
    if skin_build ~= nil then
        owner:PushEvent("equipskinneditem", inst:GetSkinName())
        owner.AnimState:OverrideItemSkinSymbol("swap_object", skin_build, "swap_cane", inst.GUID"swap_cane")
    else
        owner.AnimState:OverrideSymbol("swap_object""swap_walking_stick""swap_object")
    end
 
    owner.AnimState:Show("ARM_carry")
    owner.AnimState:Hide("ARM_normal")
    
end
 
local function onunequip(instowner)
    local skin_build = inst:GetSkinBuild()
    if skin_build ~= nil then
        owner:PushEvent("unequipskinneditem", inst:GetSkinName())
    end
 
    owner.AnimState:Hide("ARM_carry")
    owner.AnimState:Show("ARM_normal")
    
end
 
local function fn()
    local inst = CreateEntity()
    
    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddNetwork()
    inst.entity:AddSoundEmitter()
 
    MakeInventoryPhysics(inst)
    MakeInventoryFloatable(inst)
 
    inst.AnimState:SetBank("walking_stick")
    inst.AnimState:SetBuild("walking_stick")
    inst.AnimState:PlayAnimation("idle")
    
    
    inst.entity:SetPristine()
 
    if not TheWorld.ismastersim then
        return inst
    end
 
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(22)
    
    inst:AddComponent("inspectable")
    
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.imagename = "walkingstick" 
    inst.components.inventoryitem.atlasname = "images/inventoryimages/walkingstick.xml"   
    
    inst:AddComponent("equippable")
    
    inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)
    inst.components.equippable.walkspeedmult = 1.4
 
    MakeSmallBurnable(inst)
    MakeSmallPropagator(inst)
    MakeHauntableLaunch(inst)
 
    return inst
end
 
return Prefab("common/inventory/walkingstick", fn, assets, prefabs) 

 

the folder structure is pretty default if I am not mistaken.

 Would anyone be so kind to help me a bit out with this?

 

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