Aurorus 5 Report post Posted July 6, 2019 Hey I trying to practice custom items but my custom item dont showing on hand. My item is called chocolate_weapon Crystal The Wolf Praktyka.rar Share this post Link to post Share on other sites
Wolf_EX 21 Report post Posted July 6, 2019 A lot of your code for the weapon is from don't starve instead of don't starve together. Your onEquip/Unequip should be outside the main function, your missing network code, and some code is different like "local trans = inst.entity:AddTransform()" should be "inst.entity:AddTransform()". Here is what it should look like. local assets = { Asset("ANIM", "anim/chocolate_weapon.zip"), Asset("ANIM", "anim/swap_chocolate_weapon.zip"), Asset("ATLAS", "images/inventoryimages/chocolate_weapon.xml"), Asset("IMAGE", "images/inventoryimages/chocolate_weapon.tex"), } local prefabs = { } local function OnEquip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_chocolate_weapon", "chocolate_weapon") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") end local function OnUnequip(inst, owner) 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.AnimState:SetBank("chocolate_weapon") inst.AnimState:SetBuild("chocolate_weapon") inst.AnimState:PlayAnimation("idle") MakeInventoryPhysics(inst) if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() --inst:AddComponent("weapon") --inst.components.weapon:SetDamage() --inst.components.weapon:SetOnAttack(OnAttack) inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "chocolate_weapon" inst.components.inventoryitem.atlasname = "images/inventoryimages/chocolate_weapon.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip(OnEquip) inst.components.equippable:SetOnUnequip(OnUnequip) return inst end return Prefab("common/inventory/chocolate_weapon", fn, assets, prefabs) The weapon spawns but the image doesn't show up in your hand, might be an issue with your anim file. Might have to rebuild it. Share this post Link to post Share on other sites
Aurorus 5 Report post Posted July 6, 2019 (edited) i tried do something with my sprite but it still dont showing can you look at scml files and tell me what is wrong? Edited July 6, 2019 by Aurorus Share this post Link to post Share on other sites
Aurorus 5 Report post Posted July 7, 2019 ok i fixed this Share this post Link to post Share on other sites