Jump to content

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


Malacath
 Share

Recommended Posts

On 11/15/2015 at 5:40 PM, ZuperDuper said:

Hi,I'm working on a mod that used your Handslot item tutorial, but now I don't know where to go from there, you see, I would like to make the item into a hammer with infinite durability, any hints? becaus I cannot find a tutorial ANYWHERE.

 

Cheers.

 

You need to add two lines to your script.

First, you need to add a component saying that the item is a tool.

After that, you have to say what the tool is for and a number for how effective you want it to be at its job.

Just put this code into your prefab script, where it goes should be pretty self explainatory.

inst:AddComponent("tool")
inst.components.tool:SetAction(ACTIONS.HAMMER,1)
--1 is default. 30-40 breaks pretty much anything in one hit.

As for durability, items have infinite uses and are unbreakable by default unless they have a "finiteuses" component, so you don't need to write anything for it.

 

 

On 11/24/2015 at 5:48 PM, JadeJuniper said:

 

Hello! I used this tutorial, and like some others, I'm having an issue where the item appears just fine but only seems to disappear when equipped.

I tried putting the .scml file in a seperate directory than the .png. It didn't work.

Can anyone help me out?

 

 

I looked around your files and I couldn't see anything wrong at first... until I looked at your .scml file...

It was blank. I've attached a fixed file for you if you'd like to use that, just put it where your current one is right now.

 

swap_pgknife scml.zip

 

On 12/3/2015 at 6:43 PM, naptimeshadows said:

Having an issue making my item show up when equipped, which is something everyone seems to have an issue with.

 

Has anyone come up with a solution?

 

I had this problem as well, but I found the problem.

In the item's image folder (where your .scml file should be), you're supposed to create a subfolder named "swap_*whatever your item is called*" and put your png file in there.

help.png

After you do this, you're going to have to make a new scml file (Where it's supposed to be) to make it work. (Don't worry, it'll detect the folder.)

 

On 12/5/2015 at 4:04 AM, OdyseyFBI said:

good tutorial, but

how to create item for DST ???

 

It's the exact same coding. Everything you see in this tutorial works for DST as well.

 

 

Hope that helps everyone!

 

Edited by KyoruKyoruMii
Fixing code that was merged into a single line from forum update
  • Like 3
Link to comment
Share on other sites

I have the problem that the item is not showing up in my modded character's hand no matter how much I scratch my head trying to find what could have been done wrong with :( I tried the solution mentioned in the post above (using a subfolder named swap_*myitem) but it didn't work at all, still an invisible item

Link to comment
Share on other sites

I have the problem that the item is not showing up in my modded character's hand no matter how much I scratch my head trying to find what could have been done wrong with :( I tried the solution mentioned in the post above (using a subfolder named swap_*myitem) but it didn't work at all, still an invisible item

 

Did you start a new scml file and make it exactly as the tutorial asked? From personal experience, you have to start a completely new scml file since the old one thinks your picture is still in the same folder the scml file is in instead of the subfolder. Make sure you rename the animation titles in the file exactly to specifications as well: "entity_000" should be "swap_*itemname" and the animation title under that should be called "BUILD".

 

If you'd like to upload what you got, I can take a look at your files for you to see what's up. 

Link to comment
Share on other sites

Great tutorial!  I'm afraid I possibly missed one thing, though.  I triple-checked the tutorial, but I couldn't find any differences in my work.  Even checked the log and didn't come up with anything.  Anyways, the problem is that the mod loads up fine, my item has an inventory image, it has a "ground" image, but it doesn't show up in my character's hand.  Could you tell me what I might've missed?

 

If you need to see any files I can get them to you as soon as possible.

 

Thanks in advance,

Asiru

 

Edit:  You can ignore my post haha, I'm just being a big dummy.  I deleted all the previously created files in the swap folders and walked back through it.  Successfully done, I may now mod in peace.  Thanks again!

Edited by Asiru
Link to comment
Share on other sites

keep getting an inventory image error whenever my character crafts the item. should I just recompile the image?

 

Edit: wasn't a compiling error, but now I'm having the equip animation issue everyone else is having. Is there a way to compile the images to be similar to how existing items work (since my item is swordlike, make it animate/appear similar to a nightmare sword)

Another issue, which I assume is just because the equip animation doesn't work, but the item is supposed to glow, and currently it only glows when it's put on the ground.

Edited by mf99k
Link to comment
Share on other sites

On 4/16/2016 at 7:25 AM, Dodgerer said:

The third, fourth and fifth reveal hidden content have nothing for me... what was on these images, I don't understand from the massive array of lines and arrows under it.

 

 

A layout update to the site some time ago took the text boxes that were originally in the hidden content and put them directly under the hidden content boxes as well as removed most of the formatting. The third hidden content box had a diagram of how the files for the item were supposed to be placed for the item to work. It's been rendered into a single line by the update, but here's an image with the details. If it doesn't have ".png" or ".lua" at the end of the name, it's a folder.

diagram.png

 

The fourth and fifth hidden content boxes (in fact, all the ones with text boxes underneath) had the code you put into the lua files in them. 

This fourth box was the base prefab file "myitem.lua"

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 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 function fn()
	local inst = CreateEntity()
	inst.entity:AddTransform()
	inst.entity:AddAnimState()
	inst.entity:AddNetwork()
	MakeInventoryPhysics(inst)
	
	inst.AnimState:SetBank("myitem")
	inst.AnimState:SetBuild("myitem")
	inst.AnimState:PlayAnimation("idle")
	
	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 inst
end

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

It's not an exact copy, but it should do the trick. (Hopefully, I didn't make any mistakes recreating these.)

Text box #5 was a modified "myitem.lua" that you used for testing for the inventory image. It had some lines cut out, so the game wouldn't go looking for the other item files, then complain that it couldn't find them when you want to just test the inventory image.

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 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 function fn()
	local inst = CreateEntity()
	inst.entity:AddTransform()
	inst.entity:AddAnimState()
	inst.entity:AddNetwork()
	MakeInventoryPhysics(inst)
	
	--inst.AnimState:SetBank("myitem")
	--inst.AnimState:SetBuild("myitem")
	--inst.AnimState:PlayAnimation("idle")
	
	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 inst
end

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

That's about all he had there. Hope this helps! (And hopefully, I didn't make a mistake somewhere!)

Also, for future readers who're wondering about the sixth hidden content box, the text box below it is actually how the xml files are supposed to be written.

Edited by KyoruKyoruMii
Link to comment
Share on other sites

On 1/15/2016 at 0:23 AM, DragonAvenger24 said:

I got it all working, but I have the issue that seems to be fairly common here, I can't see the item when I equip it, but can see it on the ground/inventory/etc. I tried the suggestions on this page, but I must be missing something, any advice?

Kurikara.rar

Ah, I see you're like the vast majority of the people here. (Myself included at one point.)

The problem is that your "swap_kurikara.png" needs to be in a subfolder named "swap_kurikara". Take a look at the diagram in post I made above to see how it's supposed to be organized.

Don't forget to rework or remake your Spriter (.scml) file after you put the image in its folder! The autocompiler will look for the image in its old place otherwise!

Hope this helps! (And sorry for the late reply!)

Link to comment
Share on other sites

On 5/11/2016 at 2:36 AM, KyoruKyoruMii said:

Ah, I see you're like the vast majority of the people here. (Myself included at one point.)

The problem is that your "swap_kurikara.png" needs to be in a subfolder named "swap_kurikara". Take a look at the diagram in post I made above to see how it's supposed to be organized.

Don't forget to rework or remake your Spriter (.scml) file after you put the image in its folder! The autocompiler will look for the image in its old place otherwise!

Hope this helps! (And sorry for the late reply!)

Thank you for taking the time to help me with this. I actually fixed this problem a while ago (after much trial-and-error), so now it works without a problem! I think the diagram you made will be very helpful to other people though, as the layout of the files is very confusing and difficult to get exactly right.

Link to comment
Share on other sites

Hi

I've a hard time creating my weapon. I followed the tutorial step by step and I don't see any difference, but I have some issues: before doing the ground/swap steps, everything worked as expected, I was able to spawn my weapon and see it in my inventory. Then, I tried to add the ground step but I couldn't make it work, the game crashed each time I used the DebugSpawn. I thought that I put a comment on the wrong lines (because of the ****ty formatting on the tutorial), then I added the swap part in order to have the full code working without any comment. I couldn't even load my game after that, I got stuck after enabling the mod. I tried to comment all the anim related lines in order to go back at the first working step, but when I run the DebugSpawn, I can have the weapon but I can't see the pic anymore in my inventory...

Could you check on my files and tell me if you see something wrong? Thanks !

custom-powersaw.zip

Link to comment
Share on other sites

I don't get what 

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

means pls help

Link to comment
Share on other sites

whilst following the steps I've come across this problem with my mod Angeloid Weapons whilst running the game

mod.png

mod freezing.png

mod log file.png

Angeloid Weapons.rar

these have all the files for the mod i'm making if anyone has any solutions or how to fix it then please feel free to let me know or you can take a look at the fiel and screen shot where i went wrong and what i need to add or change if there is anything

modinfo.lua

modmain.lua

apollon_bow.lua

Link to comment
Share on other sites

Hello @Malacath first of all thank you very much for this guide it's very helpful. 

I have few questions. The first of all i made a animation for ground_myitem but it's being too fast and finish. How i can make it does not finish and more slower? Also swap_myitem is invisible in game. I don't know what do you need for help me so i'm putting my character file.

Edit:

Well i fix the second problem i just tell what i do because it may help someone like me. It's all because this part of code

local function OnEquip(inst, owner)
    owner.AnimState:OverrideSymbol("swap_object", "swap_fuingetsu", "swap_fuingetsu")
    owner.AnimState:Show("ARM_carry")
    owner.AnimState:Hide("ARM_normal")
end

i just changed to second "swap_fuingetsu" with "symbol0" because in build.bin there was only one thing that i can read and it was "symbol0" so i just tried and it worked. Like this

local function OnEquip(inst, owner)
    owner.AnimState:OverrideSymbol("swap_object", "swap_fuingetsu", "symbol0")
    owner.AnimState:Show("ARM_carry")
    owner.AnimState:Hide("ARM_normal")
end

I hope that will help someone. But i still have animation speed problem.

 

Thanks for help.

alishia.rar

Edited by AkaiNight
Link to comment
Share on other sites

Not sure if this is a necropost or not, but I seriously need some help here.

My autocompiler does not work, despite my various attempts to fix it. It doesn't make any .zip files. I've tried uninstalling every mod I have, reinstalling DST, starting the whole mod creation process over, and even installing the mod tools on a separate machine and transferring the files to my own. I've been scouring this thread, many others, and reverse engineering any code I can find to figure this out. Maybe it's much simpler than I imagine, or maybe I just can't mod with my computer.

Please, somebody lend me a hand to see if I'm doing something wrong.

Arthro knife.zip

Link to comment
Share on other sites

On 9/24/2017 at 12:03 PM, Arthro said:

Not sure if this is a necropost or not, but I seriously need some help here.

My autocompiler does not work, despite my various attempts to fix it. It doesn't make any .zip files. I've tried uninstalling every mod I have, reinstalling DST, starting the whole mod creation process over, and even installing the mod tools on a separate machine and transferring the files to my own. I've been scouring this thread, many others, and reverse engineering any code I can find to figure this out. Maybe it's much simpler than I imagine, or maybe I just can't mod with my computer.

Please, somebody lend me a hand to see if I'm doing something wrong.

Arthro knife.zip

@Arthro

Hi, I'm also playing DST, but I guess that's why this tutorial doesn't quite work for us because this was posted under DS forum. Maybe it means something.

I followed exactly what's showed in this guide and couldn't load into the game. Is this the same issue as you had? I'm looking for DST tutorials instead, trying to find out what I missed.

Link to comment
Share on other sites

I'm working on a test item so I can figure out how items work and really how you'd use them, and I can't get the held item image to show, nor get it to be a weapon, or chop trees. I'm not sure if it's still relevant to post on this old thread but I'd like to still try.to ask here. I've seen people helping out others with this issue but for me, I've done it myself as well and it doesn't fix.

 

Edit; Forgot to mention! The ground and inventory images do work.

 

blade.zip

On 8/5/2017 at 6:45 AM, AkaiNight said:

Hello @Malacath first of all thank you very much for this guide it's very helpful. 

I have few questions. The first of all i made a animation for ground_myitem but it's being too fast and finish. How i can make it does not finish and more slower? Also swap_myitem is invisible in game. I don't know what do you need for help me so i'm putting my character file.

Edit:

Well i fix the second problem i just tell what i do because it may help someone like me. It's all because this part of code


local function OnEquip(inst, owner)
    owner.AnimState:OverrideSymbol("swap_object", "swap_fuingetsu", "swap_fuingetsu")
    owner.AnimState:Show("ARM_carry")
    owner.AnimState:Hide("ARM_normal")
end

i just changed to second "swap_fuingetsu" with "symbol0" because in build.bin there was only one thing that i can read and it was "symbol0" so i just tried and it worked. Like this


local function OnEquip(inst, owner)
    owner.AnimState:OverrideSymbol("swap_object", "swap_fuingetsu", "symbol0")
    owner.AnimState:Show("ARM_carry")
    owner.AnimState:Hide("ARM_normal")
end

I hope that will help someone. But i still have animation speed problem.

 

Thanks for help.

alishia.rar

In the spriter, you can modify the timeline to make the animation take longer, hopefully this'll help you out.

Edited by Backtalker
Forgot info
Link to comment
Share on other sites

On 6.11.2013 at 3:18 PM, Malacath said:

Preface:
This whole tutorial will lead you through the process of creating a "handslot-equippable-item", not including the creation of artwork. That means we will convert an inventoryimage, create a "ground"-animation and create a swappable build, that is when the player holds it in his hand. Why would you want to do this instead of the usual build-renaming of existing animations? Well, this here is a thousand times more flexible and easier to troubleshoot because, honestly, everyone can make mistakes when using other peoples files as a basis. It also feels a lot less "hackish" than renaming the builds and the endproduct will be completely yours.
Also please keep in mind that when making your own mod you should always refrain from using generic names like I do in this tutorial. So do not use "myitem"!
Currently the full tutorial works sadly only for Windows user as the *.tex/animation compiler Klei provides is not yet ported to Mac or Linux. For the relevant parts (I will mark these) you will have to push the mod to a Windows user and have them convert it.



0 Prerequisites
To successfuly finish this tutorial you will need:
-the "Don't Starve Mod Tools" which you can download from Steam

 

 

Hidden Content


-image assets you want to use for your item

 

 

Hidden Content


-some patience
-maybe a drink (coffee or tea would be good)
-alternatevly some good music
-preferably a bit of knowledge about "Don't Starve" modding



1 Setting up our mod
Let me assume that you already have your artwork in the form of an inventoryimage of size 64x64 pixels, an image you intend to use for the "ground"-animation and an image you intend to use for the swappable build all in the *.png format.
With those we aim for the following folder structure in our mod-folder

 

 

Hidden Content


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

 

You can in fact use more than one image to create your animations and get as complex as you want with your folder structure, but let us keep it basic while still maintaining a certain level of structure for the sake of this tutorial. If you ever work on something more complicated keep in mind that a good structure can be crucuial to a good workflow.
We will also want to set up our two necessary scripts "modmain.lua" and "myitem.lua". The first of these is easy to do


PrefabFiles = {    "myitem",}

If you already have other prefabs registered for your mod then you have to expand the table "PrefabFiles", you should neither create a new one nor override your old one. "myitem.lua" will be a totally generic "handslot-equippable-item" without any use for now. We can go back later and make it a tool, a weapon, a staff... anything you want to do with it basically.

 

 

Hidden Content


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)

 

Do not forget that all instances of "myitem" in these two scripts as well as all following appearances of it have to be replaced by whatever name you choose for your item.
Starting your game now will cause an error because the assets specified at the top are missing. Why? Of course because we did not create them yet. But we will fix that next.



2 Creating the inventoryimage
If you put your "myitem.png" file where I told you... then you are basically done. If you want to test it you will want to comment out lines 3-4 and 29-31 in "myitem.lua". Thus the file should look like this:

 

 

Hidden Content


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)

 

Start the game and you should see a "cmd" window pop up. It will say some stuff and close itself and run "Don't Starve". Activate your mod, load/create a save, open the console and while having the cursor close to the player type


DebugSpawn("myitem")

and hit enter. Hit the spacebar to pick up your item (since it will be invisible you cannot use the mouse) and see the new inventoryimage in all its tiny glory. If you need you can close the log which overlays the screen by pressing "Ctrl"+"L"

 

 

Hidden Content


If you are on Linux or Mac you can use simplex's program to convert your image to the "*.tex" format, for which you can find a thread here. Put the converted "myitem.tex" into "mymod/images/inventoryimages/" and create a simple text file next to it, change its name to "myitem.xml" and write the following content inside it

 

 

Hidden Content


<Atlas>    <Texture filename="myitem.tex" />    <Elements>        <Element name="myitem.tex" u1="0" u2="1" v1="0" v2="1" />    </Elements></Atlas>

 

Note that you need to change the filetype here and I actually don't know if this functionality is hidden by default in Mac or Linux like it stupidly enough is in Windows, but I trust you know what you're doing.

Alternatevly you can give the mod to someone who has Windows and ask them to start the game once while it's enabled and give it back to you.



3 Creating the "ground"-animation
Now comes the stuff that makes this approach worthwhile. Start up "Spriter" via the "Mod Tools" through Steam or if you have it installed seperately you can use that as well (i.e. when you are on Mac or Linux). Choose "File"-"New Project" or "Ctrl-N" and navigate to your mods folder. Choose to create a new project in "mymod/exported/myitem/ground_myitem"

 

 

Hidden Content

 

The first thing you will want to do is change names. In the lower right corner you can see "entity_000" and "NewAnimation". Rename "entity_000" to "myitem", this will be the name of our bank (which is important while coding) Now rename "NewAnimation" to "idle", this will be... well... the name of our animation.

 

 

Hidden Content

 

You can add more animations by clicking the third button from the left above the name of the bank. But for this tutorial it will not be necessary. Now you need to add the image by "drag-and-dropping" the image in the top right corner of the window into the grey area in the middle. You can adjust its position simply by "drag-and-dropping" it again within that area. The cross can see in that area is the origin of your animation. That means that in "Don't Starve" this will be the point where your item makes contact with the ground and where the shadows and the collisions centers are (if you add those of course). So adjust the position of the image accordingly. Save that file as "myitem.scml", without the ".scml" this will be the name of our build.
Now get back to your prefabs file. Uncomment lines 3 and 29-31 if you commented them out earlier. When you run the game now you will see the "cmd" window again.

 

 

Hidden Content

 

This time it will say something about exporting animations and atlasing files, nothing we really care about though. Load a save and spawn the item like you did before (part 2) and it should now be visible. Take a few minutes to admire the beauty of your creation and then go on.
If you are on Linux or Mac there is currently no way of compiling the animation yourself. You will have to give the mod to a Windows user and have them run the game once and give the mod back to you.



4 Creating the swappable build
This part is very close to the last one, but you will have to look out for a few things. Create a new project in "Spriter" in the "mymod/exported/myitem/swap_myitem". Raname "entity_000" to "swap_myitem" and be careful about the name of the animation. We do not have a free choice here, in order to create a swappable build we need to name it "BUILD". Drag and drop the image into the grey area again.

 

 

Hidden Content

 

For swappable builds we do not much care for the size, rotation or position of the image, instead you need to move the pivot, that is the red circle in the top left of the bounding box of the image we just dropped into the workspace. When you come close to it it will grow and you can drag and drop it. Wherever you put that pivot will be where the players fist grabbing the item will be. So you will want to move it to the handle of your item, for my example I have to move it a bit lower because the image is very small so that the fist could almost completely cover it. Now right-click on the pivot and choose "Overwrite default pivot". Save the file as "swap_myitem.scml". Note that the window popping up to save your file is very problematic for this task. You will need to write exactly "swap_myitem.scml" as the filename, if you skip the ".scml" part you will jump into the folder with the same name. Now uncomment line 4 in your prefabs file.

 

 

Hidden Content


Start the game, watch the white text rush by, load a save, spawn the item and equip it. Lo and behold you have created your own "handslot-equippable-item" and it did not even take that long.
If you are on Linux or Mac there is currently no way of compiling the animation yourself. You will have to give the mod to a Windows user and have them run the game once and give the mod back to you.



5 Polishing and finishing up
The best part of this is how easy it is to polish your artwork now. You can simply edit your images in your favourite image editor and the "Mod Tools" will compile the animations/inventoryimage again. You can also tweak the animation files and have them compiled in the next startup of the game.

 

 

 

Spriter Example: Equippable Item

This is the finished product created by Cheerio using the assets uploaded with this post.

 

 

 

Confused? Curious? Feel free to post your questions here and pray that you will get a good answer  ^^

I might expand this tutorial at a later point in time, depending on what questions come up and if people want it. But for now I hope this will help, enjoy your cold coffee  : P

Those block with codes and folder structure are all in one line, can you fix it so its readable?

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
 Share

×
  • Create New...