Jump to content

Need help with custom item, a book item that restores sanity.


Recommended Posts

I'm making my own character.

I want to be able to have this character able to craft a "Sketch Book" using 2 papyrus and 2 charcoal. Then "draw in it" (ie' read it) and have it filling sanity while also emptying hunger.

 

I've tried parsing through the book code and the librarian's code but I'm not yet familiar enough with the code to know how to do this properly.

 

Can anyone help me out with it?

Link to comment
Share on other sites

Step 1) Make a custom item. If you don't know how to do that, I can't help you. However, there are tutorials that exist that supposedly show you how to make them work.

 

Step 2) Make that custom item use the code that represents the books. Chances are that you'll copy the code over instead of being able to just have it "extend book," but most of the code you want is still there. Now, the way books work in the game, each book has it's own function. When that function is called, all the effects of that book take place right then and there. This includes, but is not limited to a line that should look something like this:

reader.components.sanity:DoDelta(-TUNING.SANITY_LARGE)

Now, you can look up more values like TUNING.SANITY_LARGE in the tuning.lua file. But this line has several variations that can be incredibly helpful. If you want to instead increase sanity instead of decreasing it, you would use

reader.components.sanity:DoDelta(TUNING.SANITY_LARGE)

Note that this is literally the same line but without the negative sign. If, instead, you wanted it to decrease hunger instead of sanity, you would use something like this:

reader.components.hunger:DoDelta(-TUNING.CALORIES_HUGE)

Step 3) Make art that works for the item. I've tried and tried to make things work without having to have custom art, but my experience is that you can't just copy-paste crap. I hate the way Don't Starve handles art, but, basically, don't even try to do a thing unless you have some art with the same name as the item you're working on, and that the art was designed that way. You can't just rename it. Don't know why, but it just doesn't work.

 

Step 4) Make it possible to craft this item. While I don't actually know how to do that, there are tons of mods that do it. Look up any mod that has crafting recipes that can only be done by one specific character (if you can't think of one, I know that Link: The Hero has several such recipes) and see how they do it.

Link to comment
Share on other sites

 
reader.components.sanity:DoDelta(-TUNING.SANITY_LARGE)
 
 
 
reader.components.sanity:DoDelta(TUNING.SANITY_LARGE)
 
 
reader.components.hunger:DoDelta(-TUNING.CALORIES_HUGE)
 
 
I am also recommend thsi
 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...