Jump to content

[Need Help] Item disappears when dropped

Recommended Posts

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()



    if not TheWorld.ismastersim then
        return inst


	inst.components.inventoryitem.atlasname = "images/inventoryimages/yarn_ball.xml"

	--inst.components.stackable.maxsize = TUNING.STACK_SIZE_LARGEITEM
    inst.components.edible.healthvalue = 0
    inst.components.edible.hungervalue = 0
    inst.components.edible.sanityvalue = 25		
    inst.components.edible.foodtype = FOODTYPE.MEAT


    return inst

return Prefab("common/inventory/yarn_ball", fn, assets)


<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


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 :



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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...