R3YGA Posted December 15, 2018 Share Posted December 15, 2018 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? Link to comment Share on other sites More sharing options...
CarlZalph Posted December 15, 2018 Share Posted December 15, 2018 Link to comment Share on other sites More sharing options...
R3YGA Posted December 15, 2018 Author Share Posted December 15, 2018 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 More sharing options...
Ultroman Posted December 16, 2018 Share Posted December 16, 2018 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 More sharing options...
R3YGA Posted December 16, 2018 Author Share Posted December 16, 2018 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now