Jump to content

[Tutorial] Creating a "handslot-equippable-item" from scratch


Recommended Posts

Where I should take myitem.zip and swap_myitem.zip for *anim* folder? I have those in *exported* but its anim and build have XML extension, not BIN. Is there smth I have missed in your tutorial? 

I'm looking forward for your answer. THX

Link to comment
Share on other sites

Anyone with invisible items in-hand and items being too small in-game (in need of scaling) please read this:

I have spent the last absurd amount of hours trying to figure out these two issues (more so the invisible item part), and I have found what worked for me, assuming you have your .lua files typed accordingly and you compile the two animation files with the proper names (yourmod - idle and yourmod - BUILD). I had all the assets listed, no "errors" in the pre-game compile in CMD, and the inventory and ground animations I could see just fine.


Thanks to Cheerio and his example item mod, I was able to properly rule out the file system layout. I followed the OP's file layout, and everyone else's supposed "correct" layout they had responded to other people with the same issue's question to and had no luck in resolving this issue. To have no invisible item in-hand, copy his EXACT file layout. Do not worry about the .zip files for they will be compiled automatically.

The PROPER mod file system layout for Don't Starve: Together is the following:

This is for the ground animation (your item just sitting on the ground.)

yourmod > exported > yourmod (contains yourmod.scml) > yourmod > yourmod.png

This is for the in-hand animation (your item being held by a player.)

yourmod > exported > swap_yourmod (contains swap_yourmod.scml) > yourmod > yourmod.png

This is for the inventory icon (your item in your inventory.)

yourmod > images > inventoryimages > yourmod.png


If this does not resolve the issue for you, then I simply advise to triple check your .lua files and .scml data.


As for the item being scaled too small, simply change the resolution of the .png files used for the compiling. I found that these sizes worked perfectly for me:

Inventory icon - 64 x 64

Item on ground - 200 x 200

Item in-hand - 200 x 200


I really hope this helps someone. This process was very painful and honestly should have been updated for 2019 by at least one person by now. The method listed by the OP still works of course, but it is definitely outdated and unclear in specific areas. Thanks again ,OP! I guess as the game updated some of the old layouts needed updating.

(That wasn't supposed to sound hostile lol I'm genuinely thankful for your post, I couldn't have done anything with out it :D)

Edited by Cthonicus
  • Thanks 1
Link to comment
Share on other sites

Hello, I am making the rejuvenator from the Steven Universe Movie and i want to make it a weapon. How do i do that?

Edit: i did it, but the item is called "MISSING NAME". How do i add a name?

Edited by hhan
Link to comment
Share on other sites

On 11/6/2013 at 7:18 AM, Malacath said:

local assets={    Asset("ANIM", "anim/myitem.zip"),    Asset("ANIM", "anim/swap_myitem.zip"),    Asset("ATLAS", "images/inventoryimages/myitem.xml"),    Asset("IMAGE", "images/inventoryimages/myitem.tex"),}prefabs = {}local function fn()    local function OnEquip(inst, owner)        owner.AnimState:OverrideSymbol("swap_object", "swap_myitem", "swap_myitem")        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()    local sound = inst.entity:AddSoundEmitter()    MakeInventoryPhysics(inst)        anim:SetBank("myitem")    anim:SetBuild("myitem")    anim:PlayAnimation("idle")    inst:AddComponent("inspectable")        inst:AddComponent("inventoryitem")    inst.components.inventoryitem.imagename = "myitem"    inst.components.inventoryitem.atlasname = "images/inventoryimages/myitem.xml"        inst:AddComponent("equippable")    inst.components.equippable:SetOnEquip( OnEquip )    inst.components.equippable:SetOnUnequip( OnUnequip )    return instendreturn  Prefab("common/inventory/myitem", fn, assets, prefabs)

hey how the crap do I seperate these for the item prefab???

Link to comment
Share on other sites

On 1/23/2021 at 3:27 PM, groxida said:

Hi! Can someone help me? when i open the mymod exported folder there is no myitem folder ... should i create one or will it break? And when it appears or is created ... should I do the others too?

You should be able to create one and it'll be fine!

Link to comment
Share on other sites

On 11/6/2013 at 6:18 AM, Malacath said:


hello! im very new to this site as i am to modding even tho ive been playing the game for years lmao, so sorry if i do/ask rlly dumb crap, ok so basically ive got all the sprites and crap working on the object (its a just pocket knife lol) but like... now what? ig, idk right now all i can really do is hold it and attack hostile mobs at the dmg as my fist, how do i increase the damage or make it so i can attack every creature instead of just hostile ones? also, this may be a very dumb thing to ask but in game its called something like 'unnamed object" or whatever, how do i change the ign? again im very new to this and computers in general so explaining this to me like i was 3 would be much appreciated :,)

Link to comment
Share on other sites

Hi!  Thank you very much for this guide, it really helped me a lot in modding my item.  But I have a question.  I want to make my own axe.  Accordingly, it must have all the functions of an ax and animation for it.  How can i do this?

(Sorry for bad english, I use google translator)

Edited by rikona_blaicl
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...