Mr.Cuddlesworth Posted June 15, 2017 Share Posted June 15, 2017 The item functions properly in the inventory and all, but when I drop it, it disappears. If you need, this is the code of yarn_ball.lua; (Item) local assets = { Asset("ANIM", "anim/yarn_ball.zip"), Asset( "ATLAS", "images/inventoryimages/yarn_ball.xml" ), } local function fn(Sim) local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("petals") inst.AnimState:SetBuild("yarn_ball") inst.AnimState:PlayAnimation("anim") if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/yarn_ball.xml" --inst:AddComponent("stackable") --inst.components.stackable.maxsize = TUNING.STACK_SIZE_LARGEITEM inst:AddComponent("edible") inst.components.edible.healthvalue = 0 inst.components.edible.hungervalue = 0 inst.components.edible.sanityvalue = 25 inst.components.edible.foodtype = FOODTYPE.MEAT inst:AddComponent("inspectable") return inst end return Prefab("common/inventory/yarn_ball", fn, assets) Yarnball.xml: <Atlas><Texture filename="yarn_ball.tex" /><Elements><Element name="yarn_ball.tex" u1="0.0078125" u2="0.9921875" v1="0.0078125" v2="0.9921875" /></Elements></Atlas> Link to comment Share on other sites More sharing options...
Lumina Posted June 15, 2017 Share Posted June 15, 2017 Did you rename the build ? Link to comment Share on other sites More sharing options...
Mr.Cuddlesworth Posted June 15, 2017 Author Share Posted June 15, 2017 I don't know what you mean, but I think so: inst.AnimState:SetBuild("yarn_ball") Link to comment Share on other sites More sharing options...
Lumina Posted June 15, 2017 Share Posted June 15, 2017 1 minute ago, Mr.Cuddlesworth said: I don't know what you mean, but I think so: Ok, so you probably didn't. There are two ways to create a new item (for the anim part). First, creating custom anim in spriter. Very quick when you just want a static anim for a simple item. Second, using one existing anim, and changing the build. For that, you need to create a new .tex file (same size of the existing item you use as a base), and change the name of the build. You need this tool : You use this tool to rename the build of your yarn_ball.zip file. You should end with only the .tex file(s) and a build.bin file (because the anim is the one of petals, meaning it already exists in game files.) What you did is saying the game "my anim is petals and my build is yarn_ball". It's important, of course, because wrong names here will not work, but the game can't find a build named yarn_ball, so the item is invisible. It's why you need to rename the build. (You could also try creating anim on spriter, it's a little longer the first time but faster and cleaner when you master it. You need your image, one folder "yarn_ball", you put your image in the folder, create the .scml project (yarn_ball) in the folder, put the image as an anim (usually, 3* the original size for a proper size in game), name your entity "yarn_ball" and your anim "anim" or "idle" (or whatever you want, it just must be the same here : inst.AnimState:PlayAnimation("anim") Then compile your anim, and use "yarn_ball" as a name for both bank and build.) I'm not sure it's clear, it's late here. If you have questions i'll try to help. Link to comment Share on other sites More sharing options...
Mr.Cuddlesworth Posted June 15, 2017 Author Share Posted June 15, 2017 This is clear, I understand it. I'll try to do that, if it works, I'll edit and tell you. Thanks for the really detailed explanation! I really appreciate it. Link to comment Share on other sites More sharing options...
Mr.Cuddlesworth Posted June 15, 2017 Author Share Posted June 15, 2017 Everything, as I can tell, is named correctly. But still, when I drop it, it disappears, and I can't pick it up either, due to it not being there. 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