FlawlessHair Posted March 16, 2016 Share Posted March 16, 2016 (edited) Hello. I've been struggling with this, and also made a thread on the Don't Starve section (Which I realize is the wrong section). I'm trying to create a swap_object animation for my custom tool. I've already made an idle animation for when it is lying on the ground. I followed this tutorial, and got everything done. The .scml file gets exported and I get my .zip file with all the right files. Problem is that when I equip the item, it isn't showing. My character stands there with an empty hand. I have not rotated the object. I have simply placed it in spriter (And renamed the things that needed renamings) and then saved. The script looks like this: Spoiler local assets = { Asset("ANIM", "anim/sickle.zip"), Asset("ANIM", "anim/swap_sickle.zip"), Asset("ATLAS", "images/inventoryimages/sickle.xml"), Asset("IMAGE", "images/inventoryimages/sickle.tex"), } local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_sickle", "swap_sickle") 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 common_fn(bank, build) local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank(bank) inst.AnimState:SetBuild(build) inst.AnimState:PlayAnimation("idle") inst:AddTag("sharp") inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("weapon") inst.components.weapon:SetDamage(TUNING.AXE_DAMAGE) inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "sickle" inst.components.inventoryitem.atlasname = "images/inventoryimages/sickle.xml" ----- --inst:AddComponent("tool") --inst.components.tool:SetAction(ACTIONS.CHOP) ------- inst:AddComponent("finiteuses") inst.components.finiteuses:SetMaxUses(20) inst.components.finiteuses:SetUses(20) inst.components.finiteuses:SetOnFinished(inst.Remove) --inst.components.finiteuses:SetConsumption(ACTION.CHOP, 1) ------- inst:AddComponent("inspectable") inst:AddComponent("equippable") inst.components.equippable:SetOnEquip(onequip) inst.components.equippable:SetOnUnequip(onunequip) MakeHauntableLaunch(inst) inst:AddTag("sickle") return inst end local function normal() return common_fn("sickle", "sickle") end return Prefab("sickle", normal, assets) Do you have any idea what I could be doing wrong? I have tested with multiple custom weapons, and they're all doing not showing, so I must be doing something wrong. swap_axe_gem.zip swap_axe_gem.scml Edited March 16, 2016 by FlawlessHair Link to comment Share on other sites More sharing options...
Aquaterion Posted March 16, 2016 Share Posted March 16, 2016 You should also link 1 of these files that are not working, maybe someone can check it out, as its probably the files not the code, or you're calling something wrong Link to comment Share on other sites More sharing options...
FlawlessHair Posted March 16, 2016 Author Share Posted March 16, 2016 You're right! I have attached the files now. Link to comment Share on other sites More sharing options...
Maris Posted March 16, 2016 Share Posted March 16, 2016 1) Don't rename zip files. I see swap_axe_gem.zip but swap_sickle.zip. 2) Try the name of animation "idle" or "BUILD" (caps). 3) Try image name swap_axe_gem-0.png (with a number). 4) Try another name of the folder without "_" and numbers. I'm not sure. Spriter is a huge issue. Keep trying. Link to comment Share on other sites More sharing options...
FlawlessHair Posted March 16, 2016 Author Share Posted March 16, 2016 (edited) Sorry. I accidentally uploaded files for one of my tools, but the script of another. (Oops.) Thanks for the input. I'll keep trying! EDIT: I have found one fix! It is pretty dirty though. It requires that I download a mod from someone who made a reskin of a tool. Replace their art with my art. Then convert to .tex and put it into the zip file. This way I can do it if I don't change the name of the .zip file. Edited March 16, 2016 by FlawlessHair Link to comment Share on other sites More sharing options...
RetroMike Posted March 16, 2016 Share Posted March 16, 2016 Dunno if this will help but I had a similar problem when I made my axe. After some digging on the forums I found out that spriter can get really picky about where your assets are located. I needed to make sure my assets were in a sub folder below the spriter file. Here is an image of the folder structure to better explain what I mean. Link to comment Share on other sites More sharing options...
FlawlessHair Posted March 17, 2016 Author Share Posted March 17, 2016 Huh... That's weird. I tried setting it up like you did, and now DST does not want to export it. However, moving the .scml file into the same folder as the picture file, makes it export again. Link to comment Share on other sites More sharing options...
RetroMike Posted March 17, 2016 Share Posted March 17, 2016 (edited) you will need to remake your spriter file where it was before using the new asset location. It wasn't compiling because the spriter was still looking for the assets in the old folder location. Edited March 17, 2016 by RetroMike Link to comment Share on other sites More sharing options...
FlawlessHair Posted March 17, 2016 Author Share Posted March 17, 2016 Oh, I know. I remade it all. Basically, I placed the .png file where you told me, created a new project, saved in the folder above the .png. Then started DST. Link to comment Share on other sites More sharing options...
RetroMike Posted March 17, 2016 Share Posted March 17, 2016 (edited) I made a simple place holder mod of your axe that you can look over and compare to your own. I tested it in game and everything works as it should. Some details are missing from the axes prefab like durability as this is a template I use to test art assets. https://www.dropbox.com/s/kk95jc6njzxpbnx/axe_gem.zip?dl=0 Edited March 17, 2016 by RetroMike Link to comment Share on other sites More sharing options...
FlawlessHair Posted March 17, 2016 Author Share Posted March 17, 2016 Yeah, that's super weird! I've done exactly the same with this spear, yet it only exports one of them. spear_gem.rar Link to comment Share on other sites More sharing options...
RetroMike Posted March 17, 2016 Share Posted March 17, 2016 (edited) -Snip- Edited March 17, 2016 by RetroMike Link to comment Share on other sites More sharing options...
Muche Posted March 17, 2016 Share Posted March 17, 2016 (edited) Running C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Mod Tools\mod_tools\autocompiler.exe manually from the command line (so I can see its output) says: ERROR: Missing image 'swap_spear_gem.png' referenced by 'swap_spear_gem.scml'. Changing --- swap_spear_gem.scml +++ swap_spear_gem.fix.scml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <spriter_data scml_version="1.0" generator="BrashMonkey Spriter" generator_version="b5"> <folder id="0"> - <file id="0" name="swap_spear_gem.png" width="256" height="512" pivot_x="0.418288" pivot_y="0.535088"/> + <file id="0" name="swap_spear_gem/swap_spear_gem.png" width="256" height="512" pivot_x="0.418288" pivot_y="0.535088"/> </folder> <entity id="0" name="swap_spear_gem"> <animation id="0" name="BUILD" length="1000"> makes autocompiler happy again. ETA: It's a diff in unified format (https://en.wikipedia.org/wiki/Diff_utility#Unified_format). Edited March 17, 2016 by Muche added diff format wiki link Link to comment Share on other sites More sharing options...
FlawlessHair Posted March 17, 2016 Author Share Posted March 17, 2016 Muche is right. It seemed I DID have some problems with my project files, even though I didn't think I did. I think I chose the wrong folder for my project to begin with. (Also Muche, I'm not able to look at your code there, and realize what you changed) Alright, so now that I have both my swap_spear_gem.zip and spear_gem.zip we're back at the old problem. The spear doesn't show. (Sorry about changing from axe to spear. This was just the one I had my hands on at the moment). Here is my script for the spear: Spoiler local assets = { Asset("ANIM", "anim/spear_gem.zip"), Asset("ANIM", "anim/swap_spear_gem.zip"), Asset("ATLAS", "images/inventoryimages/spear_gem.xml"), Asset("IMAGE", "images/inventoryimages/spear_gem.tex"), } local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_spear_gem", "swap_spear") owner.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") 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() MakeInventoryPhysics(inst) inst.AnimState:SetBank("spear") inst.AnimState:SetBuild("spear_gem") inst.AnimState:PlayAnimation("idle") inst:AddTag("sharp") inst:AddTag("regal") inst:AddTag("gem") inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("weapon") inst.components.weapon:SetDamage(65) ------- inst:AddComponent("finiteuses") inst.components.finiteuses:SetMaxUses(TUNING.SPEAR_USES * 3.5) inst.components.finiteuses:SetUses(TUNING.SPEAR_USES * 3.5) inst.components.finiteuses:SetOnFinished(inst.Remove) inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "spear_gem" inst.components.inventoryitem.atlasname = "images/inventoryimages/spear_gem.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip(onequip) inst.components.equippable:SetOnUnequip(onunequip) MakeHauntableLaunch(inst) return inst end return Prefab("spear_gem", fn, assets) Link to comment Share on other sites More sharing options...
RetroMike Posted March 17, 2016 Share Posted March 17, 2016 (edited) try this owner.AnimState:OverrideSymbol("swap_object", "swap_spear_gem", "swap_spear_gem") Gotta get some rest. Good luck, sorry I wasn't able to help more. Edited March 17, 2016 by RetroMike Link to comment Share on other sites More sharing options...
FlawlessHair Posted March 17, 2016 Author Share Posted March 17, 2016 Oh, wow! Making some great progress now! A new problem arises! He is holding the whole picture, and not just one of the spears. Firstly: Why does the spear have to have 2 pictures of a spear in it? It is kind of to be expected that this would happen. Secondly: What do I do about it? Do I just delete the spear I'm not using from the picture? You've been a great help so far RetroMike and Muche! Link to comment Share on other sites More sharing options...
RetroMike Posted March 17, 2016 Share Posted March 17, 2016 Nice. glad to help I'm not sure why the spear has two identical images in the tex file to be honest. When I made my scepter i just made it a single image, like the axe. So you could erase the left side spear with no side effects. Link to comment Share on other sites More sharing options...
FlawlessHair Posted March 17, 2016 Author Share Posted March 17, 2016 1 hour ago, RetroMike said: Nice. glad to help I'm not sure why the spear has two identical images in the tex file to be honest. When I made my scepter i just made it a single image, like the axe. So you could erase the left side spear with no side effects. Alright! What about the axe and the chopping animation? Should I still include those pictures there? Link to comment Share on other sites More sharing options...
RetroMike Posted March 17, 2016 Share Posted March 17, 2016 (edited) I'm still pretty new to this myself but there are two methods that I know of you can use. 1. Your axe fits the profile of the default axe so you could use the method most people seem to employ. You copy the anim.bin, build.bin and altas-0.tex file from the object you are making to your project. Then edit the tex file with your own art and use build renamer to edit the name of the build in build.bin to match your project. You should be able to find more info on this in the forums. 2. Build the animation assets from scratch. I had to do this because my axe couldn't be edited over the default axes frame. It was to big and needed different origin points. You're already half way there, you just need to add the other axe frames with the correct order to the swap_axe_gem asset folder. You will of course have to edit the origin points of the new frames. Just edit over these https://www.dropbox.com/s/6e12nchdbdz5st4/swap_axe_gem.zip?dl=0 Edited March 17, 2016 by RetroMike Link to comment Share on other sites More sharing options...
D4rkh0bb1T Posted March 17, 2016 Share Posted March 17, 2016 You might already have wrote : owner.AnimState:OverrideSymbol("swap_object", "swap_spear_gem", "swap_spear_gem") and what about changing the first line of : inst.AnimState:SetBank("spear") to inst.AnimState:SetBank("spear_gem") Link to comment 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