Jump to content

Recommended Posts

Hi all. I've made a custom item to use the same animations as the beefalo horn, it looks fine inventory images and all. But when I use it just the regular beefalo horn texture comes up, and when I drop the item on the ground it's invisible. I have no idea what to do seeing as I did everything (I think) correctly. Any help would be greatly appreciated.

Hi all. I've made a custom item to use the same animations as the beefalo horn, it looks fine inventory images and all. But when I use it just the regular beefalo horn texture comes up, and when I drop the item on the ground it's invisible. I have no idea what to do seeing as I did everything (I think) correctly. Any help would be greatly appreciated.

 

Sounds similar to my problem

except when I drop it, it appears normal, but when equipped (its a hat) it becomes invisible.

 

Can you post your <item>.lua file?

Sounds similar to my problem

except when I drop it, it appears normal, but when equipped (its a hat) it becomes invisible.

 

Can you post your <item>.lua file?

local assets=
{
Asset("ANIM", "anim/coffeecup.zip"),
    Asset("ATLAS", "images/inventoryimages/coffeecup.xml")
}
 
local function onfinished(inst)
    inst:Remove()
end
 
 
local function fn(Sim)
local inst = CreateEntity()
inst.entity:AddTransform()
inst.entity:AddAnimState()
 
inst:AddTag("horn")
    
    inst.AnimState:SetBank("horn")
    inst.AnimState:SetBuild("coffeecup")
    inst.AnimState:PlayAnimation("anim")
    MakeInventoryPhysics(inst)
    
    inst:AddComponent("inspectable")
    inst:AddComponent("instrument")
 
    inst:AddComponent("tool")
    inst.components.tool:SetAction(ACTIONS.PLAY)
    
    inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetMaxUses(TUNING.HORN_USES)
    inst.components.finiteuses:SetUses(TUNING.HORN_USES)
    inst.components.finiteuses:SetOnFinished( onfinished)
    inst.components.finiteuses:SetConsumption(ACTIONS.PLAY, 1)
        
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.atlasname = "images/inventoryimages/coffeecup.xml"
    
    return inst
end
 
 
return Prefab( "common/inventory/coffeecup", fn, assets) 
 
 
Ugh, copy paste was not working well with me for a couple trys, this is the correct version.
Edited by DirtyDan

 

local assets=
{
Asset("ANIM", "anim/coffeecup.zip"),
    Asset("ATLAS", "images/inventoryimages/coffeecup.xml")
}
 
local function onfinished(inst)
    inst:Remove()
end
 
 
local function fn(Sim)
local inst = CreateEntity()
inst.entity:AddTransform()
inst.entity:AddAnimState()
 
inst:AddTag("horn")
    
    inst.AnimState:SetBank("horn")
    inst.AnimState:SetBuild("coffeecup")
    inst.AnimState:PlayAnimation("anim")
    MakeInventoryPhysics(inst)
    
    inst:AddComponent("inspectable")
    inst:AddComponent("instrument")
 
    inst:AddComponent("tool")
    inst.components.tool:SetAction(ACTIONS.PLAY)
    
    inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetMaxUses(TUNING.HORN_USES)
    inst.components.finiteuses:SetUses(TUNING.HORN_USES)
    inst.components.finiteuses:SetOnFinished( onfinished)
    inst.components.finiteuses:SetConsumption(ACTIONS.PLAY, 1)
        
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.atlasname = "images/inventoryimages/coffeecup.xml"
    
    return inst
end
 
 
return Prefab( "common/inventory/coffeecup", fn, assets) 
 
 
Ugh, copy paste was not working well with me for a couple trys, this is the correct version.

 

 

In the horn prefab, it is playing the animation "idle". Is there a reason you are using the animation called "anim"?

 

In the horn prefab, it is playing the animation "idle". Is there a reason you are using the animation called "anim"?

I fixed it now, changed  it back to idle, it now appears when dropped, but still uses the beefalo horn texture and makes the beefalo horn noise when I use it. Anyway to fix?

Not sure. How did you make your texture? Can you describe the steps? Like how did you convert the texture, name of the build, etc.

I used textools to convert atlas-0 and atlas-1 of the beefalo horn to png, put a layer over it, drew the cup, deleted the bottom layer, converted both to .tex using Matt's Textools, used Matt's build renamer to rename the build.bin to coffeecup, and I left the anim.bin alone because I couldn't rename it. And the rest is in the lua I posted.

If you are using an already existing animation bank, I found it best to rebuild the zip with only the build.bin and atlas included. If you look at any reskins I have done this is how I do it. Otherwise I am not sure what the issue could be.

Also, did you rename your edited/converted .tex to atlas-0 and atlas-1 respectively?

If you are using an already existing animation bank, I found it best to rebuild the zip with only the build.bin and atlas included. If you look at any reskins I have done this is how I do it. Otherwise I am not sure what the issue could be.

Also, did you rename your edited/converted .tex to atlas-0 and atlas-1 respectively?

The converted texs are all renamed properly. I removed the anim.bin from the zip, nothing changed. I'm completely lost. And it still plays the beefalo horn noise while using it, do I also have to remap the sound event?

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