NecroAnbu Posted January 17, 2015 Share Posted January 17, 2015 I created a custom weapon but it isn't showing up. I followed Malacath's "[Tutorial] Creating a "handslot-equippable-item" from scratch" with his sample files, but i can't seem to fix it. below are my item .zip's and prefab. If any one can help i would be greatful. http://www.mediafire.com/download/vvn7emx13x9w9b1/Test.rar Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/ Share on other sites More sharing options...
Kzisor Posted January 17, 2015 Share Posted January 17, 2015 (edited) @NecroAnbu, add the following line to your fn(colour) function. inst.entity:AddNetwork() For completeness you need to swap your fn(colour) for the following:local function fn(colour) local function OnEquip(inst, owner) --owner.AnimState:OverrideSymbol("swap_object", "swap_katanas", "purplestaff") owner.AnimState:OverrideSymbol("swap_object", "swap_katana", "katana") 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 inst = CreateEntity() local trans = inst.entity:AddTransform() local anim = inst.entity:AddAnimState() MakeInventoryPhysics(inst) inst.entity:AddNetwork() anim:SetBank("katana") anim:SetBuild("katana") anim:PlayAnimation("idle") if not TheWorld.ismastersim then return inst end inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "katana" inst.components.inventoryitem.atlasname = "images/inventoryimages/katana.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip( OnEquip ) inst.components.equippable:SetOnUnequip( OnUnequip ) return instend Edited January 18, 2015 by Kzisor Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-603173 Share on other sites More sharing options...
NecroAnbu Posted January 18, 2015 Author Share Posted January 18, 2015 No luck. I swapped the code but the samething happens. game loads and weapon icon load but when it is equipped the character makes a fist. Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-603201 Share on other sites More sharing options...
Kzisor Posted January 18, 2015 Share Posted January 18, 2015 @NecroAnbu, Have you tried testing the build and bank for the spear to see if that works correctly? It's always recommended to test with default known working items and then swapping the animation over to the custom one. If it doesn't work with the spear then there is something else wrong in the code. However, if it does work with the spear then it means that your katana.zip and swap_katana.zip files might have an issue in them. Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-603203 Share on other sites More sharing options...
naptimeshadows Posted December 3, 2015 Share Posted December 3, 2015 I am also having this problem.My original design was usable, but invisible. I copied the "axe_pickaxe" lua, just changing the name to "swordcane" for the sake of images, and the game closes upon opening a world. Any idea how to fix this?swordcane - axe.luaswordcane- original.lualog.txt Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-691762 Share on other sites More sharing options...
Kzisor Posted December 3, 2015 Share Posted December 3, 2015 @naptimeshadows, you're missing code in the -axe version. Asset("ATLAS", "images/inventoryimages/swordcane.xml"), Asset("IMAGE", "images/inventoryimages/swordcane.tex"), inst.components.inventoryitem.imagename = "swordcane" inst.components.inventoryitem.atlasname = "images/inventoryimages/swordcane.xml" inst.components.inventoryitem.keepondeath = true Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-691788 Share on other sites More sharing options...
naptimeshadows Posted December 3, 2015 Share Posted December 3, 2015 (edited) I fixed it, and now the axe lua is the same as the original.It functions, but there's no image. Is the issue with my swap image?? swordcane-exported.zip Edited December 3, 2015 by naptimeshadows Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-691820 Share on other sites More sharing options...
Kzisor Posted December 3, 2015 Share Posted December 3, 2015 @naptimeshadows, does the spriter project compile properly. Is there an anim/swap_swordcane.zip file? Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-691834 Share on other sites More sharing options...
naptimeshadows Posted December 3, 2015 Share Posted December 3, 2015 Yep!I even took the atlas file from the anim folder and used ktech to turn it back into a .png, and it's perfect. That zip I sent is the ground/swap pictures and spriter files from the exported folder, not the anim zip.I realize I didn't specify that. Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-691844 Share on other sites More sharing options...
Kzisor Posted December 4, 2015 Share Posted December 4, 2015 @naptimeshadows, show a screen shot of what you mean when you say "it functions, but there is no image". This could mean one of two things, it's invisible when it's equipped or on the ground, or there is no inventory image. By seeing a screen shot I think it would better describe the issues you're having. Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-691901 Share on other sites More sharing options...
naptimeshadows Posted December 4, 2015 Share Posted December 4, 2015 (edited) Here you go. The item has chopping, so you can see it functions when I hover over a tree.Also, it shows up on the ground and in my inventory. Also attached is the swap image that isn't showing up.In the zip I attached previously, you can see that the spriter file is set up correctly, unless I put the pivot point in a place that is causing an issue. EDIT::If it helps, I created my item with the same template as the one who started this thread. Is there something in that tutorial that is lacking?Something that isn't compatible with recent updates? Edited December 4, 2015 by naptimeshadows Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-691910 Share on other sites More sharing options...
Kzisor Posted December 4, 2015 Share Posted December 4, 2015 @naptimeshadows, I found the problem, it is the spriter image. This line:owner.AnimState:OverrideSymbol("swap_object", "swap_swordcane", "swap_object")Is trying to find a symbol named 'swap_object' in your Spriter project, your image is not in a folder called swap_object, therefore that is why it's invisible. Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-691940 Share on other sites More sharing options...
naptimeshadows Posted December 4, 2015 Share Posted December 4, 2015 (edited) Hmm.I tried changing each swap_object to swap_swordcane seperately, but still not working.Even using three swap_swordcane's didn't work.Is this how it is supposed to look? local function OnEquip(inst, owner) owner.AnimState:OverrideSymbol("swap_swordcane", "swap_swordcane", "swap_swordcane") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") end Also, I noticed in the original tutorial, it had a folder hierarchy like this... mymod exported |-> myitem |-> ground_myitem |-> ground_myitem.png swap_myitem |-> swap_myitem |-> swap_myitem.png images |-> inventoryimages |-> myitem.png scripts |-> prefabs |-> myitem.lua modmain.lua However, I don't have a swap_swordcane folder inside a swap_swordcane folder.Sadly, moving everything into the subfolder and redoing the spriter files fixed nothing. Any suggestions? EDIT::After reading through the comments of the tutorial, it seems most people have that same issue when the item is equipped. Someone said this, saying it fixed the issue, but I don't really understand what it's saying to change. Sorry to double post but I figured out the problem (or at least I think I figured out the problem) and fixed it. Initially my folders went exported -> myitem -> swap_myitem and before I even got to the part of the tutorial where it goes into making the swappable build thing in spriter, I caught the mistake and fixed it. however, by that point, I had also already run the game with line 4 of myitem.lua commented out and an anim zip for the swap_myitem had been built based on the old folder i guess, and something about that was messing up the whole thing. I deleted the old anim and built a new one with the correct folder layout and voila, the item shows up when equipped now. hopefully this can help any of the other people who have come across this and found themselves confused over why the answers earlier in the thread weren't helping them. Also, there seems to be an issue with is disappearing based on which direction the character is facing?Could that be the issue? Do I need to make new files specifying direction?A mentioned example is local dir = inst.AnimState:GetCurrentFacing()if (inst.components.equippable:IsEquipped()) then if (dir == 1) then inst.AnimState:OverrideSymbol("swap_object", "swap_chester_eyebone_backward", "swap_chester_eyebone_backward") else inst.AnimState:OverrideSymbol("swap_object", "swap_chester_eyebone_forward", "swap_chester_eyebone_forward") endend Sorry for the huge post. Trying to get all the facets of the issue covered. Edited December 4, 2015 by naptimeshadows Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-691955 Share on other sites More sharing options...
Kzisor Posted December 4, 2015 Share Posted December 4, 2015 @naptimeshadows, I've never ran into the issue with the item not showing up based on the way you're facing. That seems like it definitely is a coding error rather than an animation/build error. If moving the item into a subfolder didn't work, then unfortunately you did something wrong or something did not save properly. Please upload your entire mod whole so I may further assist you. Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-691984 Share on other sites More sharing options...
naptimeshadows Posted December 4, 2015 Share Posted December 4, 2015 (edited) Here you go.I'm super stumped.Another issue I'm having is that my modicon stopped showing up when I started adding custom items.Are issues these related? EDIT::SO.Thinking of the AnimState as a filepath, I made the code this: owner.AnimState:OverrideSymbol("swordcane", "swap_swordcane", "swap_swordcane") That seems to work after messing with the spriter file.I'm sure something is off with that, which is why there is an issue.The subfolder should show up in the spriter file, right?With the .png inside? Anyway, even after correcting the directory and making a new spriter, the game loads correctly, but the item is still invisible. Additionally, changing that code fixed my modicon issue.nelsonxx.zip Edited December 4, 2015 by naptimeshadows Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-691992 Share on other sites More sharing options...
Kzisor Posted December 4, 2015 Share Posted December 4, 2015 @naptimeshadows, the .scml file needs to be outside the swap_swordcane folder. The structure layout should look as the following: swap_swordcane - SPRITER PROJECT FILE - SUB DIRECTORY (AKA swap_swordcane) - PNG FILES Once you have set up the directory path this way it should work properly. Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-692065 Share on other sites More sharing options...
naptimeshadows Posted December 4, 2015 Share Posted December 4, 2015 Yes, I did that, even deleted and remade the .scml from scratch.It didn't change anything. Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-692086 Share on other sites More sharing options...
Kzisor Posted December 4, 2015 Share Posted December 4, 2015 @naptimeshadows, you stated you made the code this: owner.AnimState:OverrideSymbol("swordcane", "swap_swordcane", "swap_swordcane") This is not accurate, the OverrideSymbol function requires the symbol which you want to override. The symbol which you want to override is "swap_object", not "swordcane". If this is still the code you're using, more than likely it's not showing because of it. Try changing this code and test to see if it works. Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-692095 Share on other sites More sharing options...
naptimeshadows Posted December 4, 2015 Share Posted December 4, 2015 OY!It worked! Thanks for all the help!I can't imagine helping me back and forth is the most thrilling thing.I appreciate it! Link to comment https://forums.kleientertainment.com/forums/topic/49314-weapon-item-not-showing-up/#findComment-692097 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