Jump to content

Guide on making a hat that gives sanity?


Recommended Posts

Hello fellow starvers, I have never thought I'd be using the Don't starve forum but here I am now, My first post

I have actually thought of making a simple mod/ script of making a hat thats only exclusive to one character I just made. I'll deal with the character itself later but for now I am actually kinda stuck on the scripting part where the hat gives off sanity when equiped.

I want to make a hat that has the same sanity regen as a tophat. Any of you got any idea for the script into making the Sanity regen?

Link to comment
Share on other sites

Why not look at the tophat prefab? It does very few things but exactly this. Before you get too far, you should take a LUA crash course, and preferably more. Also, look at the current game code, otherwise, you'll be in over your head before you can count to tophat.

I think it's a pretty good idea to start with the item since they're much simpler than a character. They're already difficult, since making the graphics work in the game is a chore in itself (and not something I can help with; I only do code). For the code, you'll end up with something almost identical to the tophat, so go look at that. You'll find the game scripts in steamapps\common\Don't Starve Together\data\databundles\scripts.zip
Unpack that somewhere far away from your game folder. In the "prefabs" folder you'll find all the entities in the game (players, items, creatures, bosses etc.). Some prefabs files hold more than one creature, like the "spider" and "cavespiders" prefabs. You're looking for the "hats" prefab, which contains all the hats. Since that file might be daunting in itself, I would take a look at other mods, like "Gray Wizard Hat", which adds a simple wizard hat to the game, with a recipe and everything. Then you can look at restricting it to your future character later.

Edited by Ultroman
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...