Jump to content

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


Malacath
 Share

Recommended Posts

Thank you so much!. And now to sacrifice a small bird in your honor! 

 

That was, until the pagan gods of script errors came and ruined the ritual. Riddle me this, Apparently, I'm getting an error "can't find the Prefab "shiplantern" 

BUT

instead of saying that, it's missing the letter P

so it states "cannot find the refab "shilantern" 

So I looked at all my LUA files, I didn't see anywhere where prefab or shiplantern was misspelled. HAve any of you ever come across something like this? To be on the safeside, I tried doing a find and replace in notepad++. I didn't get any hits. Is there anywhere else, other then the mod folder I can look? 

Edited by RedRock911
Link to comment
Share on other sites

Console sometimes spits out stuff with missing letters, its a mess :p . There should be no reason it is not loading shiplantern.lua, if you could go ahead and upload the file again I can take a look and see if I can find anything, but I do not see a reason as to why it is not loading the prefab. Also, don't feel bad about spending half a day on it, I spent over 16 hours trying to figure it out.

Link to comment
Share on other sites

Console sometimes spits out stuff with missing letters, its a mess :razz: . There should be no reason it is not loading shiplantern.lua, if you could go ahead and upload the file again I can take a look and see if I can find anything, but I do not see a reason as to why it is not loading the prefab. Also, don't feel bad about spending half a day on it, I spent over 16 hours trying to figure it out.

 

 HAHAHA ok, I'll upload it, here in a sec, i'll upload a pic of a custom item that did work as an edit to this post , just so everyone knows we're not batshit crazy as well ;)

well, maybe a little crazy...just not THAT crazy. 

 

it will be as an added spoiler text. shiplantern.zip

 

 

heres the edited proof it works

 

post-568384-0-48733400-1425337692_thumb.

 

post-568384-0-88942700-1425337741_thumb.
Edited by RedRock911
Link to comment
Share on other sites

@bigpak, @RedRock911,

 

Specifically, the console drops letters that have parts below the baseline. So letters like y, p, and q all disappear.  Only while they're on the last line, though.  If you print a blank line they'll all show up again.

 

 

I'll take a look at the latest iteration of the mod though to see if I can find anything.

 

Edit:  I have no problem spawning in a shiplantern prefab from the last copy of the mod you attached.

Edited by Corrosive
Link to comment
Share on other sites

RedRock, to me when I downloaded the new file, it was not the way it should be, I'm going ot give the thing I fixed a quick test and then if it works I will upload it and I want you to take a look at yours and the fixed one so you can tell what I changed.

 

EDIT: it works, let me upload it

shiplanternfixedagain.zip

Edited by bigpak
Link to comment
Share on other sites

RedRock, to me when I downloadedarrow-10x10.png the new file, it was not the way it should be, I'm going ot give the thing I fixed a quick test and then if it works I will upload it and I want you to take a look at yours and the fixed one so you can tell what I changed.

 

EDIT: it works, let me upload it

I must of found it the same time you did! I don't even know how that happend! lol. getting back to it, i'll post the final pic once completed. 

 

If anyone wants to know, this is for a charecter mod I am working on "FlapJack and Knuckles" They are finished mostly, I'm just making a few items for them, and then I plan on making K'nuckles a standalone toon, as well as a mobile container/minion for Flapjack. As soon as I get a good Alpha together, I'll post in the forums. Thank you bigpak and Corrosive. And of course Malacath for making this tutorial for us non coding dummies!

Edited by RedRock911
Link to comment
Share on other sites

I've followed the tutorial exactly and everything works fine, except I can't see the weapon in my hand. I can see it on the ground and in my inventory but when I equip it I can't see it.

 

And yes I've read through the entire thread and tried every single solution like .scml in the innermost swap_item folder then moving it back out, and overwriting the default pivot and setting it again. 

 

I've been through my code for about 6 hours today trying different stuff and I just can't even right now. 

 

Please help.extended sample character-DST.zip

 

 

Link to comment
Share on other sites

@dave9664,

 

You have a typo in your spriter project.  Not in the project itself, but in the folder name that holds the image, and the image itself:  swap_chainword/swap_chainword-0.png.

 

The image name doesn't matter, but peculiarly enough, folder paths are actually baked into the build.  Check the swap_chainsword.zip file inside the exported folder:

<Build name="swap_chainsword.scml"> <Symbol name="swap_chainword">  <Frame framenum="0" duration="10" image="swap_chainsword" w="100" h="100" x="0.907902" y="-46.730759"/> </Symbol></Build>

In order to get it to work as-is, you would need to use OverrideSymbol("swap_object", "swap_chainsword", "swap_chainword")

 

There is one other issue, though-- a 100x100px image is pretty small for a sword.  It'd make sense for a wand, but I assume you want a sword that's bigger than a glowstick.  You need to scale up the actual image to increase its size.

  • Like 1
Link to comment
Share on other sites

The image name doesn't matter,

Id like to add that capitalization DOES matter and if you change capitalization the mod usually works on windows, but will crash on any OS that understands that AAA.ext  is a different file than aaa.ext 

Link to comment
Share on other sites

I have no idea what I'm doing wrong. I'm actually embarrassed since I'm a game design grad, but I'm just not getting what I'm messing up here. Bad with lua I guess? But I want to learn, and I humbly request the forums help. I've attached my mod folder.

shepard.zip

Link to comment
Share on other sites

I have no idea what I'm doing wrong.

 

..\source\renderlib\BaseTexture.cpp(71) : - ../mods/shepard/images/inventoryimages/shepard.tex is not a valid Klei texture.

 

The tex file doesnt seem to be in Klei's format. The first few bytes should be "KLEI" "KTEX"

Edited by Corrosive
Link to comment
Share on other sites

huh, I guess I need to use the simplex converter... I thought it might be something different since I'm on Windows, but I guess I misread the tutorial


huh, I guess I need to use the simplex converter... I thought it might be something different since I'm on Windows, but I guess I misread the tutorial


huh, I guess I need to use the simplex converter... I thought it might be something different since I'm on Windows, but I guess I misread the tutorial

Link to comment
Share on other sites

Yes, they are converted.png
and I also converted the inventory image to .tex with the TEXTool

it seems like my scripts are fine too. I don't get it.
If someone could look through the files and see I would definitely appreciate it. I've tried everything I can think of.

 

shepard.zip

Link to comment
Share on other sites

it seems like my scripts are fine too. I don't get it.

 

Check your log file when your mod crashes:

 

...apps/common/dont_starve/data/../mods/shepard/scripts/prefabs/shepard.lua:49: '<eof>' expected near '1'

 

shepard.lua:

return  Prefab("common/inventory/shepard", fn, assets, prefabs)1

I'm pretty sure you can figure out what's wrong there ;)

 

 

By the by, it's spelled "shepherd" when referring to the sheep herding profession.  Shepard is a surname that comes from the same root. ;)

Link to comment
Share on other sites

Yes, they are converted.png

and I also converted the inventory image to .tex with the TEXTool

it seems like my scripts are fine too. I don't get it.

If someone could look through the files and see I would definitely appreciate it. I've tried everything I can think of.

 

attachicon.gifshepard.zip

One sec, I think you made the same mistake I did, give me about 45 minutes

Link to comment
Share on other sites

One sec, I think you made the same mistake I did, give me about 45 minutes

 

HA! I solved someone else's problem for once! feels pretty cool

So. you had Don't Starve set in your modmain as false, i'm not sure if that was a reason it was failing or not, you had some color coded line in your script that was calling for a false value. AND Spriter couldn't find your images. you may have made a change to something and forgotten to save the project. 

here is your fixed file.

 

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