Jump to content

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


Malacath
 Share

Recommended Posts

yes i did.

is it possible that i put the folder in the wrong place?

 

Your mod is a folder in Don'tStarve/mods. In that folder, there is modinfo.lua, modmain.lua and the scripts folder(which contains a prefab folder). Here's a simple path guide:

 

Don'tStarve -> mods -> Mymod (contains modmain.lua and modinfo.lua) -> scripts -> prefabs (contains myitem.lua)

 

You should already know that though.

 

On a side note, it is kinda odd that you have all "local function"s inside of the main function (underneath "local function fn()"). It shouldn't affect the functionality, I think. It's just unusual.

Link to comment
Share on other sites

think you could make a tutorial on how to make a craftable item? I've really wanted to make an infinite light source mod with the light source being expensive as all hell to make it, not only an end game item, but the peak of survival (kinda like a trophy if that makes any sense)

Link to comment
Share on other sites

think you could make a tutorial on how to make a craftable item? I've really wanted to make an infinite light source mod with the light source being expensive as all hell to make it, not only an end game item, but the peak of survival (kinda like a trophy if that makes any sense)

GLOBAL.Recipe("firepit", {Ingredient("log", 2),Ingredient("rocks", 12)}, GLOBAL.RECIPETABS.LIGHT, GLOBAL.TECH.NONE, "firepit_placer")--first thing (firepit) is the thing to craft, then come the ingredients ({Ingredient("stuff",5),etc.}), then comes the recipe tab (light), then the science/magic tier (none, avaible at all times), then the placer (structures only, items don't need this)GLOBAL.Recipe("turf_road", {Ingredient("turf_rocky", 1), Ingredient("boards", 1)}, GLOBAL.RECIPETABS.TOWN,  GLOBAL.TECH.SCIENCE_TWO)--this is another example

This line of code goes into modmain.lua, but you should download some simple mods to see more examples, and find solutions for any possible issues occuring

Edited by Mobbstar
Link to comment
Share on other sites

I have a problem with creating the swappable build. I got everything else but when I followed all the steps for the swappable build, the image doesn't show up in the game. My inventory image wokrs fine, my ground image workes fine too, but my swappable image just does't show up at all no matter what I try..... 

 

When I save my swappable build as "swap_myitem.scml", no window pops up and it just saves it. I think this is way my image doesn't show up,,, but im not sure about it....

 

could you help me with this??

Link to comment
Share on other sites

The swap animation isn't working right for me. When i drag and drop the image onto the canvas in Spriter the pivot circle defaults to the top left corner of the image. I moved it to the handle of the item and saved and did all that junk. When I test it in game the image appears when my character is holding it but instead of holding it where i moved the circle, he's holding it where the top left corner of the image would be. As if i never moved the circle at all and left it in the default position. I reloaded spriter and opened the project to make sure I put the circle in the right place and I did.

Link to comment
Share on other sites

Save that file as "myitem.scml", without the ".scml" this will be the name of our build.

 

I'm confused at that part - do I save it first as an scml file and then rename it to .bin?

EDIT: Ok, nevermind, I see what you mean.

But where do I make my anim.bin file?

Edited by MikeRobe
Link to comment
Share on other sites

Followed the guide, but no zip files are created. I have the same structure as the guide states, but the guide differs from your sample.

My game crashes, since it can't find any zip files.

 

What do I do? :(

You must be doing something wrong. I had the same problem. Try starting over, because I don;t think tweaking it makes it start working again.

Keep in mind that in the folder "exported" the folders are organized like this:

exported

              >myitem

                            >ground_myitem

                                   myitem.scml--note that in a new spriter file created in this directory, you name                                                                    --entity000 to myitem 

                                   myitem.png

                            >swap_myitem

                                        swap_myitem.scml

                                           >swap.myitem

                                                       myitem.png

 

Edited by goldfish911
Link to comment
Share on other sites

For some reason everything worked fine until I tried to turn it into a weapon. Then the UI disappeared when I tried to Spawn it in. Here's the prefab script.

Learn to find/read your log.txt for don't starve. The UI disappearing indicates the game has crashed, assuming you couldn't use any mouse or keyboard controls except maybe the "open developer console" button.

Link to comment
Share on other sites

@Malacath, you should probably mention that the pivot must be right-clicked and overwritten when making the swappable build file, otherwise the item will be held weirdly by the corner in-game. this issue has been addressed several times in the replies to this topic, but you haven't edited it into the OP yet so...

Edited by goldfish911
Link to comment
Share on other sites

Tried using the sample file and rewriting the prefab and modmain as well as renaming the prefab and replacing the images with my own. I generated a file using the spriter but it still won't let me make a zip file. I'm running win 8, any known issues?

Link to comment
Share on other sites

Tried using the sample file and rewriting the prefab and modmain as well as renaming the prefab and replacing the images with my own. I generated a file using the spriter but it still won't let me make a zip file. I'm running win 8, any known issues?

 

I am running windows 8 as well...

here is a tip to try and fix your problem.

You can rename the file "hat_bee_bw_swap.scml"(from the example hat mod) , open it in spriter, change swap_hat_bee_bw in the menu on the right to "swap_youritem", and then put it in any subfolder in "yourmod/exported". Make sure that the folder "swap_hat" and all files in it are moved to that same directory.

DO NOT RENAME THE PICTURE FILES OR THE FOLDER "swap_hat" HOLDING THEM BECAUSE THEY ARE REFERENCED IN THE SCML FILE. I made this mistake and broke the compiler, as I think the game was finding the scml file but it couldn't find the directory or pictures the .scml file was telling it to use.

Link to comment
Share on other sites

I am running windows 8 as well...

here is a tip to try and fix your problem.

You can rename the file "hat_bee_bw_swap.scml"(from the example hat mod) , open it in spriter, change swap_hat_bee_bw in the menu on the right to "swap_youritem", and then put it in any subfolder in "yourmod/exported". Make sure that the folder "swap_hat" and all files in it are moved to that same directory.

DO NOT RENAME THE PICTURE FILES OR THE FOLDER "swap_hat" HOLDING THEM BECAUSE THEY ARE REFERENCED IN THE SCML FILE. I made this mistake and broke the compiler, as I think the game was finding the scml file but it couldn't find the directory or pictures the .scml file was telling it to use.

 

Didn't work! But I didn't have the hat_bee_swap.scml since I used the sample in this thread which was a wand. Not that it matters, since I replaced everything and just kept the structure.

 

But yeah, I tried renaming the scml-file and nothing happened.

When I start my game the cmd says

Traceback (most recent call last):

 File "..\..\Don't Starve Mod Tools\mod_tools\compiler_scripts\image_build.py",

line 110, in <module>

    process_file_to_atlas()

 File "..\..\Don't Starve Mod Tools\mod_tools\compiler_scripts\image_build.py",

line 85, in process_file_to_atlas

    assert len( atlas_data ) == 1

AssertionError

ERROR: Command failed!

'..\..\Don't' is not recognized as an internal or external command,

operable program or batch file.

Edited by SophieTheDog
Link to comment
Share on other sites

Didn't work! But I didn't have the hat_bee_swap.scml since I used the sample in this thread which was a wand. Not that it matters, since I replaced everything and just kept the structure.

 

But yeah, I tried renaming the scml-file and nothing happened.

When I start my game the cmd says

Traceback (most recent call last):

 File "..\..\Don't Starve Mod Tools\mod_tools\compiler_scripts\image_build.py",

line 110, in <module>

    process_file_to_atlas()

 File "..\..\Don't Starve Mod Tools\mod_tools\compiler_scripts\image_build.py",

line 85, in process_file_to_atlas

    assert len( atlas_data ) == 1

AssertionError

ERROR: Command failed!

'..\..\Don't' is not recognized as an internal or external command,

operable program or batch file.

 

It looks like your mod tools may be broken then? Try verifying tool cache. It seem's it's trying to run a folder name as a program.

 

Link to comment
Share on other sites

I made images for an item, followed the tutorial , had some issue but fixed them , and now all work except that my images are really small in-game. In fact I made a spear but it look like a pencil or a wand when Wilson hold it in his hand. Even the ground image is small but all my images are bigger then for example the normal spear and in-game the normal spear appear really bigger then my own spear...

Link to comment
Share on other sites

I got kinda stuck on this one. I'm building a swiss armyknife "swissblade". I copy pasted the code snippets in notepad++ and used the recommented folder tree. When compiling however the autocompiler seems to get stuck somewhere then keeps looking an endless poolworker thing. The spriter steps seemed to work fine. Can anyone enlighten me?

 

Also for some reason when I do the early step of commenting out to at least see the inventory image version is also doesn't work. The debugger/console says it couldn't find refab swissblade (which for some reason is spelled refab instead of prefab)

post-488842-0-47342600-1421024219_thumb.

swissblade.zip

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...