Jump to content

[HELP] Broken animations and images


Recommended Posts

I have been encountering a few issues with my mod which I cannot understand what may be causing them. No matter how I look into it I cannot determine 'what went wrong where'.

 

I hope someone could be generous enough to lend me a hand in this one. I definitely could use any help available.

 

 

 

1. Broken animations (SOLVED, reason was because images needed to be increased in size)

I used the "scml" converter provided by the Don't Starve Mod Tools to produce an animation for my prefab. When loaded into the game not only does the animations do not display properly, but it appears tiny compared to the original:

post-509776-0-27874100-1418769277_thumb.

The prefab is supposed to be slightly bigger than a chest.

 

When I open the prefab, it completely disappears!

post-509776-0-83607100-1418769377_thumb.

The animations are completely out of place.

 

CODE:

require "prefabutil"local assets ={Asset("ANIM", "anim/crate.zip"),	Asset("ANIM", "anim/ui_chester_shadow_3x4.zip"),}local function onopen(inst) inst.AnimState:PlayAnimation("open")inst.SoundEmitter:PlaySound("dontstarve/wilson/chest_open")		end local function onclose(inst) inst.AnimState:PlayAnimation("close")inst.SoundEmitter:PlaySound("dontstarve/wilson/chest_close")		end local function onhammered(inst, worker)inst.components.lootdropper:DropLoot()inst.components.container:DropEverything()SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition())inst.SoundEmitter:PlaySound("dontstarve/common/destroy_metal")inst:Remove()endlocal function onhit(inst, worker)inst.AnimState:PlayAnimation("hit")inst.components.container:DropEverything()inst.AnimState:PushAnimation("closed", false)inst.components.container:Close()endlocal function onbuilt(inst)inst.AnimState:PlayAnimation("place")inst.AnimState:PushAnimation("closed", false)endlocal slotpos = {}for y = 3, 0, -1 dofor x = 0, 3 dotable.insert(slotpos, Vector3(80*x-80*2+40, 80*y-80*2+40,0))endendlocal function fn(Sim)local inst = CreateEntity()inst.entity:AddTransform()inst.entity:AddAnimState()inst.entity:AddSoundEmitter()local minimap = inst.entity:AddMiniMapEntity()	minimap:SetIcon("crate.tex")local s = 1	inst:AddTag("structure")inst:AddTag("chest")inst.AnimState:SetBank("crate")inst.AnimState:SetBuild("crate")inst.AnimState:PlayAnimation("closed")    inst:AddComponent("inspectable")inst:AddComponent("container")inst.components.container:SetNumSlots(#slotpos)    inst.components.container.onopenfn = onopeninst.components.container.onclosefn = oncloseinst.components.container.widgetslotpos = slotposinst.components.container.widgetbgatlas = "images/inventoryimages/ui_crate.xml"inst.components.container.widgetbgimage = "images/inventoryimages/ui_crate.tex"inst.components.container.widgetpos = Vector3(0,200,0)inst.components.container.side_align_tip = 160inst:AddComponent("lootdropper")inst:AddComponent("workable")inst.components.workable:SetWorkAction(ACTIONS.HAMMER)inst.components.workable:SetWorkLeft(1)inst.components.workable:SetOnFinishCallback(onhammered)inst.components.workable:SetOnWorkCallback(onhit) 	inst:ListenForEvent( "onbuilt", onbuilt)MakeSnowCovered(inst, .01)		return instendreturn	Prefab("common/crate", fn, assets),		MakePlacer("common/crate_placer", "crate", "crate", "closed") 

 

The animation names used in Spriter are the same as the names stated in the code.

 

I initially thought that the conversion caused the problem however using ktools to convert it back it was okay.

 

 

 

2. Missing icons (SOLVED, reason was because it was declared as 'local')

The icon used for the prefab does not want to display properly. I managed to make the 'minimap' icon appear but the crafting icon appears to be a chest.

post-509776-0-42880100-1418769766_thumb.

That is definitely not a crate.

 

I used the log to pinpoint the problem:

WARNING! Invalid resource handle for atlas '../mods/Crate/images/inventoryimages/crate.xml', did you remember to load the asset?
../mods/Crate/images/inventoryimages/crate.xml
LUA ERROR stack traceback:
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/image.lua(30,1) in function 'SetTexture'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/recipetile.lua(25,1) in function 'SetRecipe'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/craftslot.lua(132,1) in function 'Refresh'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/craftslot.lua(177,1) in function 'SetRecipe'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/crafting.lua(137,1) in function 'UpdateRecipes'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/crafting.lua(78,1) in function 'SetFilter'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/crafttabs.lua(93,1) in function 'selectfn'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/tab.lua(192,1) in function 'Select'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/tab.lua(44,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/screens/playerhud.lua(291,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/frontend.lua(236,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/input.lua(138,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/input.lua(312,1)
WARNING! Invalid resource handle for atlas '../mods/Crate/images/inventoryimages/crate.xml', did you remember to load the asset?
../mods/Crate/images/inventoryimages/crate.xml
LUA ERROR stack traceback:
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/image.lua(30,1) in function 'SetTexture'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/recipetile.lua(25,1) in function 'SetRecipe'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/craftslot.lua(132,1) in function 'Refresh'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/craftslot.lua(177,1) in function 'SetRecipe'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/crafting.lua(137,1) in function 'UpdateRecipes'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/crafting.lua(78,1) in function 'SetFilter'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/crafttabs.lua(93,1) in function 'selectfn'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/tab.lua(192,1) in function 'Select'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/tab.lua(44,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/screens/playerhud.lua(291,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/frontend.lua(236,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/input.lua(138,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/input.lua(312,1)
WARNING! Invalid resource handle for atlas '../mods/Crate/images/inventoryimages/crate.xml', did you remember to load the asset?
../mods/Crate/images/inventoryimages/crate.xml
LUA ERROR stack traceback:
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/image.lua(30,1) in function 'SetTexture'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/recipetile.lua(25,1) in function 'SetRecipe'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/craftslot.lua(132,1) in function 'Refresh'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/craftslot.lua(177,1) in function 'SetRecipe'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/crafting.lua(137,1) in function 'UpdateRecipes'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/crafting.lua(78,1) in function 'SetFilter'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/crafttabs.lua(93,1) in function 'selectfn'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/tab.lua(192,1) in function 'Select'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/tab.lua(44,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/screens/playerhud.lua(291,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/frontend.lua(236,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/input.lua(138,1) in function 'OnControl'
        C:/Program Files (x86)/R.G. Mechanics/Don't Starve/data/scripts/input.lua(312,1)
 

etc.

 

I assume this is caused by it not being declared properly. But when I look into the code I used, I see no problem with it:

 

CODE:

local assets= {Asset("ATLAS", "images/inventoryimages/ui_crate.xml"),Asset("ATLAS", "images/inventoryimages/crate.xml"),Asset("IMAGE", "images/inventoryimages/crate.tex"),Asset("ATLAS", "minimap/crate.xml" ),}

Minimap icon works though.

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