Jump to content

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


Malacath
 Share

Recommended Posts

I'm having a hard time to get this working at all, I believe its in my folder layout because I couldn't understand how you wanted us to set it up

 

Did you click the button marked "spoiler" in the beginning of the tutorial? The first one I believe. It shows you the exact folder layout, but pay special attention the "swap_myitem" folders. You need two folders with that name(replace myitem with your item's name), one inside the other.

 

Then also, read through the comments here about the Spriter bug and try some of the things suggested.

Yeah, I'm having that same problem with the folder kicking, so exported the scml while it was in the inner folder and then just moved everything up. When I tried to move the scml up first and then export, the command console said there was no image associated with the file, so I assumed that was why it was blank -- but apparently not.

 

I also just edited the scml the way you described (with the scml still in the upper folder) but the prefab's still showing up invisible for me. I also deleted the exported anim files, thinking it just needed to export from scratch rather than overwriting something, but no luck.

 

Also nope, it spawns in just fine for me. I used c_spawn("prefab") and DebugSpawn("prefab") and both worked. Sorry it took me a bit to get back to you, my game is running like molasses right now, which is weird because this is literally the only mod I have installed at the moment.

 

What version of Windows are you running?

Link to comment
Share on other sites

 

 

What version of Windows are you running?

 

Windows 7. Thanks so much for taking the time to help me with this, by the way!

 

EDIT: i changed the bit of the scml file you mentioned and it works now! Thank you so much. Related: Do you know how to tell Spriter to include different pictures in the build (say, if I wanted it to be like the axe, where it's seen from a different angle depending on the way the character is facing). This isn't Super Important but it would look better, I think.

Edited by misterinkwell
Link to comment
Share on other sites

Windows 7. Thanks so much for taking the time to help me with this, by the way!

 

EDIT: i changed the bit of the scml file you mentioned and it works now! Thank you so much. Related: Do you know how to tell Spriter to include different pictures in the build (say, if I wanted it to be like the axe, where it's seen from a different angle depending on the way the character is facing). This isn't Super Important but it would look better, I think.

 

No problem at all. I wouldn't know squat if it wasn't for other people here helping me. I'm still really new at this honestly. I just happened to have messed with this particular issue alot.

 

So just to be clear, it was the name="swap_rainbowflag" that fixed it? Is that right? If so, that's odd that the ground image wouldn't require it to be there in the scml file... maybe since the BUILD part is based off of the swap files and not the ground files? I dunno. I'm still not sure I understand the "bank" and the "build" even tbh.

 

As to your second question.. I think I'm confused. I just double checked, but the axe looks exactly the same from every angle no matter which way the character is facing. All it does is mirror it to the left if your facing left, and right if you're facing right, but it's the same exact image. Is your image not mirroring? Or do you mean something else?

Link to comment
Share on other sites

No problem at all. I wouldn't know squat if it wasn't for other people here helping me. I'm still really new at this honestly. I just happened to have messed with this particular issue alot.

 

So just to be clear, it was the name="swap_rainbowflag" that fixed it? Is that right? If so, that's odd that the ground image wouldn't require it to be there in the scml file... maybe since the BUILD part is based off of the swap files and not the ground files? I dunno. I'm still not sure I understand the "bank" and the "build" even tbh.

 

As to your second question.. I think I'm confused. I just double checked, but the axe looks exactly the same from every angle no matter which way the character is facing. All it does is mirror it to the left if your facing left, and right if you're facing right, but it's the same exact image. Is your image not mirroring? Or do you mean something else?

 

Yeah, I changed <folder id="0"> to <folder id="0" name="swap_smellyalater"> and that was what got it working, as far as I can tell. Maybe it's because of the extra inner folder, and it needing to know it's there? Just to hazard a guess.

 

Also wow, you're totally right, for some reason I always thought there was a change with the angles! Though when the character puts it down (say, to harvest some grass) it does flatten out when placed on the ground, which this prefab doesn't seem to do.

Link to comment
Share on other sites

Yeah, I changed <folder id="0"> to <folder id="0" name="swap_smellyalater"> and that was what got it working, as far as I can tell. Maybe it's because of the extra inner folder, and it needing to know it's there? Just to hazard a guess.

 

Also wow, you're totally right, for some reason I always thought there was a change with the angles! Though when the character puts it down (say, to harvest some grass) it does flatten out when placed on the ground, which this prefab doesn't seem to do.

 

Yeah, I always assumed there was a change too til I really looked close. That's one of the things I love about this game's art is the way it looks a lot more 3D than it actually is, but you don't notice unless you really look close. As far as the animation for when you put it down, I think you would need to know what the name of the animation state is that the game uses for when you put something down while performing an action. Like "idle" is what you name the normal animation state for carrying an item in your hand and so the game knows to attach it to the "idle" animation state because that's what you named it in Spriter. You MAY be able to just code in a separate local function to override whatever it's normally called. but like I said, I'm really new to the coding so I'm not sure if that's possible. I'm pretty sure it will be possible for you to find the name somewhere in the Don't Starve data files, but you'll have to do some digging. I just looked for a bit and couldn't fit it so far, but you probably understand lua better than I do and might know what you're looking for easier.

 

If you haven't already done this, one thing that has helped me in understanding the game structure and finding where certain functions are within the base game data, type "search" in the main start button field, and then choose "change how windows searches" in the list. Click "advanced", then click the "file types" tab. Scroll down to .lua files and change the option so that it will index the file contents the way it does text and some other file types. Let it finish indexing before you use it, but once you do, then you can use the basic windows search to search around for various functions and bits of code in the main don't starve data.. if you want. It's helped me a bit to understand how some things work by looking through the main code.

Link to comment
Share on other sites

Yeah, I changed <folder id="0"> to <folder id="0" name="swap_smellyalater"> and that was what got it working, as far as I can tell. Maybe it's because of the extra inner folder, and it needing to know it's there? Just to hazard a guess.

 

Also wow, you're totally right, for some reason I always thought there was a change with the angles! Though when the character puts it down (say, to harvest some grass) it does flatten out when placed on the ground, which this prefab doesn't seem to do.

 

I may be totally wrong on that(the post above), but I AM pretty sure the general way to do that would be to create a new animation state on the entity in Spriter(I think on the ground build? since that's the bank.. isn't it? I'm confusing myself) and then name it the proper thing. I'm just not positive if the name is something already programmed into the game as a state or if you need to code it in yourself, or maybe both are true. You might try getting Dana into this thread or just message her. She may know. Let me know what you find out. I'm curious myself.

Link to comment
Share on other sites

I may be totally wrong on that(the post above), but I AM pretty sure the general way to do that would be to create a new animation state on the entity in Spriter(I think on the ground build? since that's the bank.. isn't it? I'm confusing myself) and then name it the proper thing. I'm just not positive if the name is something already programmed into the game as a state or if you need to code it in yourself, or maybe both are true. You might try getting Dana into this thread or just message her. She may know. Let me know what you find out. I'm curious myself.

I definitely will if I go digging! I have a lot of other planned prefabs I'd like to do first, since it not flattening out when on the ground isn't TOO big a deal, but once I have everything at least mostly done I'll check it out and report back. And again, thanks so much for helping me with getting this working.

Link to comment
Share on other sites

I definitely will if I go digging! I have a lot of other planned prefabs I'd like to do first, since it not flattening out when on the ground isn't TOO big a deal, but once I have everything at least mostly done I'll check it out and report back. And again, thanks so much for helping me with getting this working.

 

No problem at all, man. I might actually ask you for some help soon if you don't mind. I've been slowly working on my rainbow flag mod, and I have a few plans I think I might have trouble with in the coding.. I may just PM you when I get there if that's ok?

Link to comment
Share on other sites

No problem at all, man. I might actually ask you for some help soon if you don't mind. I've been slowly working on my rainbow flag mod, and I have a few plans I think I might have trouble with in the coding.. I may just PM you when I get there if that's ok?

Sure! I don't actually know a ton about LUA beyond sort of smashing at it until it does what I want, but with modding it really is the more the merrier, if we bounce ideas back and forth we could probably work something out faster than just you doing it on your own.

Link to comment
Share on other sites

Sure! I don't actually know a ton about LUA beyond sort of smashing at it until it does what I want, but with modding it really is the more the merrier, if we bounce ideas back and forth we could probably work something out faster than just you doing it on your own.

 

Sounds great to me. :-) I've got the art for the item done for the most part(I may tweak a couple things later on), but that was such a feat for me even on such a simple thing, that now I'm just trying to get my motivation up to dive into the coding. I actually kind of enjoy it, but it's intimidating too. Plus I'm just a scatterbrain and I've always got 85 projects I've started and working on but rarely actually finish one. 

 

Hey, actually, if you wanted to try it out and just let me know what you think so far on the item itself, that would be cool. I know it's simple art, but I tweaked at it forever. I'll PM you since I'm starting to get a bit off topic for this thread.

Edited by zeropoint101
Link to comment
Share on other sites

How do I create the zip files that go into the anim folder?

 

I see that you've posted in another thread about this too, and the problem is that you don't have Steam, right? You have the mod tools, but can't get the autocompiler to find your files correctly? I honestly have no idea. I believe I've seen info about this somewhere, but I can't remember where. You could either try searching the forums for "autocompiler" and see if you run across an answer, or you could try posting in one of these threads with the question. Some of the devs and senior forums member are all over these threads.

 

http://forums.kleientertainment.com/topic/27247-new-asset-tools-animations-textures-sounds-and-layouts/

 

http://forums.kleientertainment.com/topic/18801-modders-your-new-friend-at-klei/

Edited by zeropoint101
Link to comment
Share on other sites

thanks for the help zero, I was able to get on Skype with someone from forums and they should me all the basics when it comes to making your first mod.

 

No problem at all. Glad to hear you were finally able to work it out. I saw from your other posts you've been trying at it for a while.

Link to comment
Share on other sites

Helo,  I want to make my item when i atack show diferent, with fire, how can i do?

 

You have to create a different animation in Spriter in your entity. Unfortunately though, I'm pretty sure you have to name it something specific to know what to put in your code and connect it properly with the character, and I don't know what that name would be at this point. Try making your own thread about this, or you could try asking in the second link I posted 4 posts up.

Link to comment
Share on other sites

You have to create a different animation in Spriter in your entity. Unfortunately though, I'm pretty sure you have to name it something specific to know what to put in your code and connect it properly with the character, and I don't know what that name would be at this point. Try making your own thread about this, or you could try asking in the second link I posted 4 posts up.

I do the entity, but how can i put in the prefab files?

Link to comment
Share on other sites

Hi, just followed this tutorial wich is very nice by the way. Thank you Malacath.

I've got an issue with the mod i've done, every things is fine unless when i equip it, sprite doesn't appears in character's hand but the character's is like he is holding something invisible. Any idea to solve it ?

Link to comment
Share on other sites

Hi, just followed this tutorial wich is very nice by the way. Thank you Malacath.

I've got an issue with the mod i've done, every things is fine unless when i equip it, sprite doesn't appears in character's hand but the character's is like he is holding something invisible. Any idea to solve it ?

 

Read through the other posts in this thread.

Link to comment
Share on other sites

Way late for this thread, but I have done everything on this thread that has been mentioned, and my mod still isn't acting nice enough to show up. I was going to send it to time out, but...yeah, it wouldn't work. Anyways, if I could get a diagnosis of what might be going on, it would be appreciated.

Link to comment
Share on other sites

I'we worked on it a little.Managed to get it in-game.The problem is the spaw animation seems to be not working. It just hangs in air.Im pretty sure that I did what the author said but still, couldn't fix it.A little help would be appreciated!

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