Jump to content

Potential reference points for a sanity management character perk?


Recommended Posts

I've been playing around a bit with modding for the past couple of months, and have been enjoying myself poking through a few guides + looking through existing character code for help in puzzling out what have basically been reskins up to this point, character mod wise. However, I have my first very ambitious idea I'm now considering trying to mod, and I thought I'd at least ask around here in case anyone had any insight?

My idea is for a character who (among other features) functions somewhat similarly to Walter in that sanity management comes in extremes—they wouldn't lose sanity from most sources other characters would, such as boss sanity auras or darkness (though they would from the existence of ghost players), which are all things I feel like I could probably puzzle out from Walter's code if nothing else (and some things I already know how to do from playing around some already).

What may be a little more potentially confusing are my other ideas—I thought it might be interesting for a character to take sanity penalties not from their own health loss, but from the health loss of others around them (other player characters within a certain range, followers with that character set to their leader, Chester, et cetera), or if in the immediate presence of other players below a certain health threshold. (I would also include a config in the mod for 'solo mode' to dial this back + make them not totally OP for solo play? Though I am also aware of the additional uncontrollable variables at play here and their potential implications balance wise, even in team play, and definitely will be thinking more on it.)

This obviously might be a bit more complicated than Walter's sanity management, but I was at least figuring I could look at his code as well as possibly characters like Wormwood and others for reference here (though I'm drawing a blank currently as to which characters in specific might have helpful things to look at). The main reason I'm posting here, though, is that I'm pretty certain I've heard of character mods that exist that have perks that might be similar to this or adjacent, such as gaining sanity when in the proximity of other players, et cetera.

I'm not asking for someone to simply tell me how to do this (although I guess I can't stop you if you really want to), but instead just wanted to ask if anyone had insight on modded characters (or other mods) with code I could look at for reference in learning how to do something like this, or if there's an existing character with a similar feature I'm not thinking of? I like the process of puzzling out how things work (even if I'm definitely still learning how Lua functions), so even just hints about where to point myself when looking into this would be very much appreciated!

Edited by flipwix
Link to comment
Share on other sites

You can make other players gain sanity when near players by giving players the sanityaura component.

So for example if you wanted your character to lose sanity from healthloss of players around them, you could either give all players a sanityaura component that with the aurafn that checks if it's your character and then reduces the sanity proportionally to the health percentage or you could run a periodic task on your character where you check if players are within a certain range of you and if yes, you check their health and then reduce the sanity by the appropriate amount.

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