Jump to content

Need help with character transform when attacked or low sanity


Recommended Posts

I want to make the character in my mod able to transform when attacked or below a certain amount of sanity.

I do understand some code but not all of it, I looked at Woodie's code but some of the code that allows him to transform I don't really understand, so I was hoping to get a little bit of help with how to make my character transform when attacked or below a certain amount of sanity.

Link to comment
Share on other sites

Let me explain what i'm trying to do, so it's easier for people.

I want my character to be able to transform when attacked by a mob and if sanity is below 80 (two ways for him to transform), he's a bit more stronger but losses sanity fast, gains 5 sanity for each mob killed. If he was attacked by a mod he will be stay in that form for a certain amount of time (i'm thinking of making it 2 minutes), every time he is attacked the time resets.

Link to comment
Share on other sites

 

You can instead listen for the event "attacked" on your character, and check his current sanity then, instead of listening for sanity change, or you can do both. The isInSecondForm bool should make sure that subsequent calls to transform into the current form should not apply the form change.

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