Jump to content

Custom item carry animation doesn't show


Recommended Posts

Hello!

I've been following this tutorial on how to make a custom equipable item. It has been going well. It shows up in game when on the ground, and when in my inventory. The only problem I have is that when I equip it, it does not show. Wilson is basically holding thin air.

The weird thing is, everything should be set up correctly. When opening DST the cmd does tell me that it created a .zip file with swap_myitem and when I look in my folder, it is also there. I get no errors when I start the game, but all I see is Wilson holding thin air.

What can I do? (Also what information do you need to help me solve the problem?)

dst1.png

Link to comment
Share on other sites

It's probably the rotation that's throwing it off. Spriter is not the original format that animations are made in, so there are limitations. Try rotating the texture (in the PNG file) as opposed to the animation element (in the Spriter Project). If there are no rotated pieces, it should be fixed.

Link to comment
Share on other sites

9 hours ago, Arkathorn said:

It's probably the rotation that's throwing it off. Spriter is not the original format that animations are made in, so there are limitations. Try rotating the texture (in the PNG file) as opposed to the animation element (in the Spriter Project). If there are no rotated pieces, it should be fixed.

It was a good guess, but sadly it did not change anything.

I created a new project, set the pivot, saved the project, watched DST export the file, but in game Wilson is still holding thin air.

 

dst1.png

Link to comment
Share on other sites

local assets =
{
    Asset("ANIM", "anim/sickle.zip"),
    Asset("ANIM", "anim/swap_sickle.zip"),
    Asset("ATLAS", "images/inventoryimages/sickle.xml"),
    Asset("IMAGE", "images/inventoryimages/sickle.tex"),
}

local function onequip(inst, owner)
	owner.AnimState:OverrideSymbol("swap_object", "swap_sickle", "swap_sickle")
    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 common_fn(bank, build)
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddSoundEmitter()
    inst.entity:AddNetwork()

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank(bank)
    inst.AnimState:SetBuild(build)
    inst.AnimState:PlayAnimation("idle")

    inst:AddTag("sharp")

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(TUNING.AXE_DAMAGE)

    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.imagename = "sickle"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/sickle.xml"   
    -----
    --inst:AddComponent("tool")
    --inst.components.tool:SetAction(ACTIONS.CHOP)
    -------
    inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetMaxUses(20)
    inst.components.finiteuses:SetUses(20)
    inst.components.finiteuses:SetOnFinished(inst.Remove)
    --inst.components.finiteuses:SetConsumption(ACTION.CHOP, 1)
    -------

    inst:AddComponent("inspectable")
    
    inst:AddComponent("equippable")

    inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)

    MakeHauntableLaunch(inst)

    inst:AddTag("sickle")

    return inst
end

local function normal()
    return common_fn("sickle", "sickle")
end

return Prefab("sickle", normal, assets)

 

dst1.PNG

Link to comment
Share on other sites

Sorry about the bump. I'm still having this problem.

One thing I noticed is that my swap_item.zip also has an anim.bin file in it, where other swap_item.zip files do not. They only have atlas-0 and build.bin

Did I do something wrong in the export or spriter process?

Link to comment
Share on other sites

On 14/3/2016 at 10:38 AM, FlawlessHair said:

Sorry about the bump. I'm still having this problem.

One thing I noticed is that my swap_item.zip also has an anim.bin file in it, where other swap_item.zip files do not. They only have atlas-0 and build.bin

Did I do something wrong in the export or spriter process?

Someone else, correct me if I'm wrong but I believe you're suppoed to have an anim.bin in the zip file.
Have you tried taking it out and see what happens?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
×
  • Create New...