Sign in to follow this  
R3YGA

I need help to add a component in my script

Recommended Posts

R3YGA    6

im creating a character mod and i want to make him stronger when he is insane, but i dont know what i need to add in his prefab lua, any ideas?

Share this post


Link to post
Share on other sites
R3YGA    6
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

 

Share this post


Link to post
Share on other sites
Ultroman    726

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.

Share this post


Link to post
Share on other sites
R3YGA    6
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

Share this post


Link to post
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
Sign in to follow this