Somnei Posted August 27, 2022 Share Posted August 27, 2022 (edited) Hi! I am trying to port the hat-wearing spiders from DST to DS, but I can't seem to locate where the actual hat-wearing functionality is animated within the bank/build of spiders. This is the code that allows spiders to wear hats: -- I also wear hats elseif item.components.equippable ~= nil and item.components.equippable.equipslot == EQUIPSLOTS.HEAD then local current = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD) if current ~= nil then inst.components.inventory:DropItem(current) end inst.components.inventory:Equip(item) inst.AnimState:Show("hat") end (from scripts/prefabs/spider.lua) These are the assets for the spiders: local assets = { Asset("ANIM", "anim/ds_spider_basic.zip"), Asset("ANIM", "anim/spider_build.zip"), Asset("ANIM", "anim/ds_spider_boat_jump.zip"), Asset("SOUND", "sound/spider.fsb"), } I used Krane to decompile ds_spider_basic.zip and spider_build.zip into a spriter project and opened it in Spriter, but I can't find anything regarding hats here. There are no placeholders included in any of the animations as far as I can see, and yet somehow hats work for spiders in the game. When I port the animations to DS, I can get the smiling faces to work - so it seems like the animations are ported correctly - but hats are invisible when I do AnimState:Show("hat"). I'll include a screenshot of how it looks when I've opened it in Spriter, as well as a zip of the decompiled Spriter project in case anyone wants to look for themselves without having to decompile first. (The reason I am decompiling and recompiling these in the first place is simply to rename the build and base to something other than the default to avoid conflict with DS's original spider anim files) I would be incredibly grateful if someone has any ideas on how this all works in DST. Honestly, I'm quite stumped and feel like I have been pretty thorough but I must be missing something. The only thing I can think of is that either something was not properly decompiled, or it's a bug with Spriter, or perhaps that there is something wrong with my game's files. TLDR: porting the anim files for spiders from DST -> DS doesn't work for me: the hats are invisible in DS. pls send help edit: SOLVED, see replies for more information! spriter_project_files.rar Edited August 27, 2022 by SophieTheDog issue was solved Link to comment https://forums.kleientertainment.com/forums/topic/142869-solved-where-is-animstatehat-for-spiders-within-their-anim/ Share on other sites More sharing options...
Rickzzs Posted August 27, 2022 Share Posted August 27, 2022 it is lost in conversion. You need to look at anim.xml and build.xml, which Krane can't do. Other tools can. Link to comment https://forums.kleientertainment.com/forums/topic/142869-solved-where-is-animstatehat-for-spiders-within-their-anim/#findComment-1596004 Share on other sites More sharing options...
Somnei Posted August 27, 2022 Author Share Posted August 27, 2022 18 minutes ago, Mr.Rickzzs said: it is lost in conversion. You need to look at anim.xml and build.xml, which Krane can't do. Other tools can. Do you happen to know any of the tools that can decompile the xmls? I'm assuming I can recompile everything using the autocompiler afterwards, so decompiling should be the only issue. I'm currently searching for the tools myself, but having no luck finding them yet so any nudge in the right direction would help. Thanks a ton for the answer anyways, I'm glad to hear there was a simple explanation to this! Link to comment https://forums.kleientertainment.com/forums/topic/142869-solved-where-is-animstatehat-for-spiders-within-their-anim/#findComment-1596005 Share on other sites More sharing options...
Somnei Posted August 27, 2022 Author Share Posted August 27, 2022 Okay, after a long and tedious search I finally found a tool that was capable of decompiling and recompiling without losing this data. In case anyone in the future finds this thread when looking for solutions to a similar issue, I used the "Animation Commandline Tool 0.8.1" which can be found in the downloads at this site. (link) Thank you @Mr.Rickzzs for the tip regarding the conversion! I would really appreciate if you'd let me know if there are better tools for this job (in case I actually need to alter any of the animations later without destroying the anim.xml data), since I had a difficult time searching for decompilation tools. Link to comment https://forums.kleientertainment.com/forums/topic/142869-solved-where-is-animstatehat-for-spiders-within-their-anim/#findComment-1596008 Share on other sites More sharing options...
Rickzzs Posted August 27, 2022 Share Posted August 27, 2022 (edited) 11 hours ago, SophieTheDog said: snip Sadly the layer is lost forever, and you need to manually rebuild the layer, which I didn't try. The practical way is to deal with xml, never scml. https://github.com/ZzzzzzzSkyward/DSTmodutils I use animbuilder/animd.exe and animbuilder/rebuild.py to do these things. However, they are not capable, especially talking about build.bin For anim.bin it is easy. py2 rebuild.py anim.bin py2 is python 2, if you didn't download it, you can use the version from Don't Starve Mod Tools at \steamapps\common\Don't Starve Mod Tools\mod_tools\buildtools\windows\Python27 rebuild.py accepts one anim.bin file and converts it into anim.bin.xml, build.py does the converse. animd.exe /in ./ /out ./ animd.exe accepts one input dir and one output dir, where there are anim.bin and build.bin and atlases. But when I try to decompile-compile bunnyman's animation it fails. animc.exe does the converse. It seems that from anim.xml to scml, it only copies key-values(with matrix transformation), I guess there is possibility to insert swap_hat layer back into scml, hard as it may be. Edited August 28, 2022 by Mr.Rickzzs Link to comment https://forums.kleientertainment.com/forums/topic/142869-solved-where-is-animstatehat-for-spiders-within-their-anim/#findComment-1596011 Share on other sites More sharing options...
Somnei Posted August 27, 2022 Author Share Posted August 27, 2022 I'll make sure to try that one out if I get stuck with a similar issue later and the animation commandline tool isn't working. Really appreciate all the help, thanks! Link to comment https://forums.kleientertainment.com/forums/topic/142869-solved-where-is-animstatehat-for-spiders-within-their-anim/#findComment-1596012 Share on other sites More sharing options...
Rickzzs Posted August 28, 2022 Share Posted August 28, 2022 (edited) I finally found out the solution. But what do you want to do with the animation? Porting to DS is not this complicated. Steps: Assumed you have these folders: spider/ hat/ workingfolder/ and anotherfolder/, separately for spider anim, hat anim, result and temp. 1. Download KleiAnim.zip (platform:Windows x64), extract the files to your work folder. 2. Decompile spider animation and hat animation using krane. 3. Decompile spider animation and hat animation using animd. animd /in ./ /out ./ 4. Edit build.xml, insert extra swap_hat layer. Below shows walter hat. <Symbol name="swap_hat"> <Frame framenum="0" duration="1" x="-17.4746799" y="-185.251007" w="131" h="120" /> <Frame framenum="1" duration="1" x="-41.2249985" y="-174.274994" w="137" h="133" /> <Frame framenum="2" duration="1" x="-17.6499996" y="-167.925003" w="138" h="135" /> <Frame framenum="3" duration="1" x="7.07500076" y="-28.6000004" w="146" h="125" /> </Symbol> 5. Compile build.xml using animc. animc.exe /anim ./anim.xml /build ./build.xml /out ./anotherfolder 6. To anotherfolder, copy atlases. Decompile again using krane. Note that animc is broken with anim name, so copy the original anim.bin here. This time the scml shall include swap_hat layer!!! 7. Copy anotherfolder/xxx.scml to your working folder. 8. Copy both spider/ and hat/ images to your working folder. 9. Now you own a full scml project. KleiAnim.zip Edit: Found another way:https://forums.kleientertainment.com/forums/topic/75476-template-custom-player-animation 1. Decompile all animations using krane. 2. Concat all symbols into one scml file, and copy all images together. 3. Run autocompiler.exe and you get a zip. 4. Extract files and overwrite build.bin and atlases. This time build.bin shall include all symbols. 5. Decompile again using krane. 6. Now you own a full scml project. Edited August 28, 2022 by Mr.Rickzzs Link to comment https://forums.kleientertainment.com/forums/topic/142869-solved-where-is-animstatehat-for-spiders-within-their-anim/#findComment-1596058 Share on other sites More sharing options...
Somnei Posted August 28, 2022 Author Share Posted August 28, 2022 Thank you for the detailed information, this is incredibly helpful! As of now just decompiling and recompiling without an .scml works for me when porting assets that are already in DS (simply to rename the bases/banks), but these instructions would be invaluable if I ever wanted to add a custom animation to anything that has been ported without ruining those invisible layers. Link to comment https://forums.kleientertainment.com/forums/topic/142869-solved-where-is-animstatehat-for-spiders-within-their-anim/#findComment-1596077 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now