Jump to content

Mod Help Request: Gaining Sanity When near one object with another equipped

Recommended Posts

Hey I'm making a character mod for a friend, and I'm in a spot that's troubled me for a good two weeks now. The character is built around different dusters and coats they can make and equip for themselves that allow them to nomad and explore without being tied down to a base. Well, all six dusters work as intended except for one, the one meant for traveling on boat.

The pirate coat is supposed to give the wearer a sanity bonus while on or around a boat, almost identical to how the Shark Tooth Crown from the Shipwrecked DLC for Don't Starve works. Problem is, almost every method I've tried to implement has either crashed the game or flat-out not worked when in-game. I've tried applying an aura to the boat under the condition of the coat being equipped, I've tried having the coat give sanity while on the boat's surface using a ListenFor function, I've even tried reverse-engineering the Walter tree affinity perk and dug through other mods like the ports of Shipwrecked items to DST; but I get the same results every time. A series of crashes, followed by fixes, to the game loading and the coat being usable, but the intended sanity buff unfunctional.

I'm told by the great modders over at the Don't Starve discord that the fix is simple, and where they've been real helpful, I'm still unable to get it working. I'm not sure if I'm just putting the scripts in the wrong areas of the coat's lua, if I don't have the correct tags or prefab names for the boat or its surface, or both problems. I followed tutorials and read through forum posts for items similar to my own, and where they also helped some, I'm kind of at a point that I feel stuck.


I'm not the best at LUA at all, in fact my knowledge is surface level at best, but I managed to get the character and all other dusters to work, even under their own crafting tab with little help. (Aside from the tutorials and templates of course.) I'm not asking the class to do my math homework for me, but I'm out of ideas and clearly need the help, so I'd love to see how you guys would type or structure the script for my item, and maybe some guidance on where I'd place them in my lua file. Any method is welcome, as long as it works and is kept simple. Even a port of the Shark Tooth Crown script to work for DST would be enough for me to try and work with. Thank you for your time, let alone if you choose to help.


Included is the LUA for the coat and a couple notes I wrote on where I placed things and my thought process, no fixes I tried are included. 


TL;DR: I need a script/component for an equippable coat that works like the Shark Tooth Crown for DST, when standing near or on a boat gives the player it a sanity aura or gives them sanity.

Edited by PoggersPossum
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

  • Create New...