Jump to content

Health Regen on Key Press with Stats Conditions


Recommended Posts

Hello Everyone,

I am trying to create a mod. 
If any players that are not starving, freeze, or insane, or hurt they can press the "R" on the keyboard to regen their life.
However, this will cause their hungry level to drain.  

I am very new to the mod and want to know how to start.  If anyone has any direction or pointer, please share.  Thanks!

My first problem to solve, is how to create the press a "R" keyboard to trigger a health regen.

Edited by Dynatomic
Link to comment
Share on other sites

Best course of action for learning, is looking at existing mods, which do something similar to what you want. Try to find ANY mod, that says it has a button to press. Like, "Cook Key".

Regenerating life is pretty easy. Just get the health-component and call healthComponent:SetPercentage(value) (I think that's what it's called). For your checks, you need the hunger-, temperature- and sanity-components, and check their status (unless the player-inst gets tags saying whether they are freezing, starving and their current sanity-status. I can't remember which of these add tags to the player, if any, but that would make it MUCH easier to do your checks, since you could just look up a tag on the player-inst, instead of grabbing the components every frame.

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