Jump to content

Recommended Posts

Ive created a hat-type item and everything appears to work except -

when the item is equipped, it becomes invisible.

 

It appears in the character's inventory fine, and in the build menu of the science engine.

 

The log file doesn't seem to show any reason for this error.

 

withing the modmain.lua

Assets = {

 

    Asset( "IMAGE", "images/inventoryimages/logicfilter.tex" ),
    Asset( "ATLAS", "images/inventoryimages/logicfilter.xml" ),
 
}

  

within the Item's Lua file

local assets=
    {
        Asset("ANIM", "anim/logicfilter.zip"),
        Asset("ATLAS", "images/inventoryimages/logicfilter.xml"),
    }

 

local function onequip(inst, owner)
        owner.AnimState:OverrideSymbol("swap_hat", "logicfilter", "swap_hat")
        owner.AnimState:Show("HAT")
        owner.AnimState:Hide("HAT_HAIR")
        owner.AnimState:Show("HAIR_NOHAT")
        owner.AnimState:Show("HAIR")
        
        owner.AnimState:Show("HEAD")
        owner.AnimState:Hide("HEAD_HAIR")
                
end

 

 local function fn(Sim)
        local inst = CreateEntity()
        local trans = inst.entity:AddTransform()
        local anim = inst.entity:AddAnimState()
        MakeInventoryPhysics(inst)
        
        inst:AddTag("hat")
        
        inst.AnimState:SetBank("footballhat")
        inst.AnimState:SetBuild("logicfilter")
        inst.AnimState:PlayAnimation("anim")
        inst:AddComponent("inspectable")

        inst:AddComponent("equippable")
        inst.components.equippable.equipslot = EQUIPSLOTS.HEAD
    
        inst:AddComponent("inventoryitem")
        inst.components.inventoryitem.atlasname = "images/inventoryimages/logicfilter.xml"
    
        return inst
    end

 

I'm certain I am missing something obvious....

but I have no idea what.

 

I checked the atlas-0.tex, in the logicfilter.zip file and it is good, as best I can tell.

and I used an editor to change the build.bin to the proper name.

I left the anim.bin alone (leaving the default footballhat)

Link to comment
Share on other sites

Ive created a hat-type item and everything appears to work except -

when the item is equipped, it becomes invisible.

 

It appears in the character's inventory fine, and in the build menu of the science engine.

 

The log file doesn't seem to show any reason for this error.

 

withing the modmain.lua

Assets = {

 

    Asset( "IMAGE", "images/inventoryimages/logicfilter.tex" ),

    Asset( "ATLAS", "images/inventoryimages/logicfilter.xml" ),

 

}

  

within the Item's Lua file

local assets=

    {

        Asset("ANIM", "anim/logicfilter.zip"),

        Asset("ATLAS", "images/inventoryimages/logicfilter.xml"),

    }

 

local function onequip(inst, owner)

        owner.AnimState:OverrideSymbol("swap_hat", "logicfilter", "swap_hat")

        owner.AnimState:Show("HAT")

        owner.AnimState:Hide("HAT_HAIR")

        owner.AnimState:Show("HAIR_NOHAT")

        owner.AnimState:Show("HAIR")

        

        owner.AnimState:Show("HEAD")

        owner.AnimState:Hide("HEAD_HAIR")

                

end

 

 local function fn(Sim)

        local inst = CreateEntity()

        local trans = inst.entity:AddTransform()

        local anim = inst.entity:AddAnimState()

        MakeInventoryPhysics(inst)

        

        inst:AddTag("hat")

        

        inst.AnimState:SetBank("footballhat")

        inst.AnimState:SetBuild("logicfilter")

        inst.AnimState:PlayAnimation("anim")

        inst:AddComponent("inspectable")

        inst:AddComponent("equippable")

        inst.components.equippable.equipslot = EQUIPSLOTS.HEAD

    

        inst:AddComponent("inventoryitem")

        inst.components.inventoryitem.atlasname = "images/inventoryimages/logicfilter.xml"

    

        return inst

    end

 

I'm certain I am missing something obvious....

but I have no idea what.

 

I checked the atlas-0.tex, in the logicfilter.zip file and it is good, as best I can tell.

and I used an editor to change the build.bin to the proper name.

I left the anim.bin alone (leaving the default footballhat)

 

A question: Is the zip file you're loading the ground animation or the swap animation for the hat? It seems to me that you're missing the swap animation for your hat.

Link to comment
Share on other sites

A question: Is the zip file you're loading the ground animation or the swap animation for the hat? It seems to me that you're missing the swap animation for your hat.

 

I copied the football hat zip so it should have both,

the graphic (atlas-0.tex) shows both the ground and equipped images.

 

is the swap animation file defined seperately?

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