Jump to content

I need help to add a component in my script


Recommended Posts

9 hours ago, CarlZalph said:

it actually works, but that wasn't my idea, i want to give him a x2 damage when he is at 0% sanity, and if he is at 1% or above he will lose this buff and become normal damage (i'm using wigfrid damage multiplier as base) if u can help me i would appreaciate it very much

 

Link to comment
Share on other sites

That code can easily be changed to do exactly what you want. All this does, is saying:

(1.0 - SanityPercentage) * 2.0 + 1.0


So if your character has full sanity, it'll be: (1.0 - 1.0) * 2.0 +1.0 = 1.0
And if your character has half sanity, it'll be: (1.0 - 0.5) * 2.0 +1.0 = 2.0
And if your character has no sanity, it'll be: (1.0 - 0.0) * 2.0 +1.0 = 3.0

In your case, just make an if-statement that checks if the character's sanity (inst.components.sanity.current) is 0, and set the multiplier. And in your else-statement, set the multiplier back to what it normally is.

Link to comment
Share on other sites

46 minutes ago, Ultroman said:

That code can easily be changed to do exactly what you want. All this does, is saying:

(1.0 - SanityPercentage) * 2.0 + 1.0


So if your character has full sanity, it'll be: (1.0 - 1.0) * 2.0 +1.0 = 1.0
And if your character has half sanity, it'll be: (1.0 - 0.5) * 2.0 +1.0 = 2.0
And if your character has no sanity, it'll be: (1.0 - 0.0) * 2.0 +1.0 = 3.0

In your case, just make an if-statement that checks if the character's sanity (inst.components.sanity.current) is 0, and set the multiplier. And in your else-statement, set the multiplier back to what it normally is.

and it works, thanks to both for the help

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