Recommended Posts

I've been modding for about 3 days now, I'm not great but I have successfully done number changes and made items using textures that are already in the game as a test, but as soon as I try to use my own custom textures everything seems to break. I've confirmed my models work properly in the game, I just don't know how to use them.

Right now, this script makes the item show up in my inventory, but it's invisible when held in my hands.
 

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

local function OnEquip(inst, owner)
    --owner.AnimState:OverrideSymbol("swap_object", "swap_wands", "purplestaff")
    owner.AnimState:OverrideSymbol("swap_object", "swap_hatbrella2", "hatbrella2")
    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.entity:AddMiniMapEntity()
     
    MakeInventoryPhysics(inst)   
      
    inst.AnimState:SetBank("hatbrella2")
    inst.AnimState:SetBuild("hatbrella2")
    inst.AnimState:PlayAnimation("idle")
    
    inst:AddTag("sharp")
    inst:AddTag("waterproofer")
    
    inst:AddComponent("waterproofer")    
    inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_HUGE)

    inst:AddComponent("insulator")
    inst.components.insulator:SetSummer()
    inst.components.insulator:SetInsulation(TUNING.INSULATION_MED)
    
    if not TheWorld.ismastersim then
        return inst
    end
 
    inst.entity:SetPristine()

    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(TUNING.HATBRELLA_DAMAGE)
 
    inst:AddComponent("inspectable")

    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.imagename = "hatbrella2"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/hatbrella2.xml"
    
    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip( OnEquip )
    inst.components.equippable:SetOnUnequip( OnUnequip )
    
    MakeHauntableLaunch(inst)
    
    return inst
end
return  Prefab("common/inventory/hatbrella2", fn, assets)

 

Share this post


Link to post
Share on other sites
IThatGuyI    17

I'm not too experienced with animations in Don't Starve yet, but I think the third override symbol,

local function OnEquip(inst, owner)
    --owner.AnimState:OverrideSymbol("swap_object", "swap_wands", "purplestaff")
    owner.AnimState:OverrideSymbol("swap_object", "swap_hatbrella2", "hatbrella2")
    owner.AnimState:Show("ARM_carry") --                                                       /\
    owner.AnimState:Hide("ARM_normal") --                                                This one
end

should also be swap_hatbrella2, although I'm not sure. I have modded a working weapon and the OverrideSymbol looks like this:

owner.AnimState:OverrideSymbol("swap_object", "swap_woodenclub", "swap_woodenclub")

 

Either that, or there's a problem with the animation.

Edited by IThatGuyI

Share this post


Link to post
Share on other sites
48 minutes ago, IThatGuyI said:

I'm not too experienced with animations in Don't Starve yet, but I think the third override symbol,


local function OnEquip(inst, owner)
    --owner.AnimState:OverrideSymbol("swap_object", "swap_wands", "purplestaff")
    owner.AnimState:OverrideSymbol("swap_object", "swap_hatbrella2", "hatbrella2")
    owner.AnimState:Show("ARM_carry") --                                                       /\
    owner.AnimState:Hide("ARM_normal") --                                                This one
end

should also be swap_hatbrella2, although I'm not sure. I have modded a working weapon and the OverrideSymbol looks like this:


owner.AnimState:OverrideSymbol("swap_object", "swap_woodenclub", "swap_woodenclub")

 

Either that, or there's a problem with the animation.

Sadly, I think it's an animation problem. After adding the swap_ to the third item the item is still invisible.

Share this post


Link to post
Share on other sites
IThatGuyI    17

There might be a problem with naming the animation files or the names in the .scml. That's usually the reason why it's invisible.

Share this post


Link to post
Share on other sites
2 minutes ago, IThatGuyI said:

There might be a problem with naming the animation files or the names in the .scml. That's usually the reason why it's invisible.

Thanks for helping me find the problem, though I can't solve it myself. I know what my problem is better now and I think I'll make a separate post about it. I don't know how to actually use the mod tools, I've just been using notepad++ and paint.net to edit textures and damage values and have gotten much further than I should have.

  • Like 1

Share this post


Link to post
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