MemphisMyst Posted February 20, 2017 Share Posted February 20, 2017 I was wondering if there was a way to scale damage higher the lower sanity gets. Is an incremental scaling based off the character losing sanity is something that would be possible of would I have to do it based off it they hit X amount? Link to comment Share on other sites More sharing options...
Lumina Posted February 20, 2017 Share Posted February 20, 2017 Damage based on sanity should be possible. @SuperDavid did something similar if i'm not wrong, but i'm not sure. Link to comment Share on other sites More sharing options...
. . . Posted February 20, 2017 Share Posted February 20, 2017 I only know how to raise the damage at a set number like this, Spoiler inst:ListenForEvent("sanitydelta", function(inst, data) if inst.components.sanity.current >= 30 then inst.components.combat.damagemultiplier = 1.5 elseif inst.components.sanity.current <= 30 then inst.components.combat.damagemultiplier = 2 end end) I don't know how to scale the damage multiplier with max sanity, unfortunately... Link to comment Share on other sites More sharing options...
CarlZalph Posted February 20, 2017 Share Posted February 20, 2017 8 minutes ago, SuperDavid said: I only know how to raise the damage at a set number like this, I don't know how to scale the damage multiplier with max sanity, unfortunately... Maths. inst:ListenForEvent( "sanitydelta", function(inst, data) inst.components.combat.damagemultiplier = (1.0-inst.components.sanity:GetPercent())*4.0+1.0 end ) At zero sanity, multiplier is 5.0. At maximum sanity, multiplier is 1.0. Linear scaling in between. Link to comment Share on other sites More sharing options...
MemphisMyst Posted February 21, 2017 Author Share Posted February 21, 2017 (edited) 20 hours ago, Lumina said: Damage based on sanity should be possible. @SuperDavid did something similar if i'm not wrong, but i'm not sure. Fortunately SuperDavid was able to help me with a few of my issues that I had with the mod prior; this was just something I was seeing if it was possible. 14 hours ago, CarlZalph said: Maths. inst:ListenForEvent( "sanitydelta", function(inst, data) inst.components.combat.damagemultiplier = (1.0-inst.components.sanity:GetPercent())*4.0+1.0 end ) At zero sanity, multiplier is 5.0. At maximum sanity, multiplier is 1.0. Linear scaling in between. inst:ListenForEvent( "sanitydelta", function(inst, data) inst.components.combat.damagemultiplier = (1.0-inst.components.sanity:GetPercent())*1.0+1.0 end ) That should scale the damage to a multiplier of 2.0 at zero sanity right? Edited February 21, 2017 by MemphisMyst Link to comment Share on other sites More sharing options...
Ricoom Posted February 21, 2017 Share Posted February 21, 2017 (1,0 - 0.0) *1.0 + 1.0 = 2.0 so yes Link to comment Share on other sites More sharing options...
MemphisMyst Posted February 21, 2017 Author Share Posted February 21, 2017 Thanks; I just wanted to make sure I understood the line. Thanks to everyone whom helped me with the character! Link to comment Share on other sites More sharing options...
CarlZalph Posted February 21, 2017 Share Posted February 21, 2017 2 hours ago, MemphisMyst said: Fortunately SuperDavid was able to help me with a few of my issues that I had with the mod prior; this was just something I was seeing if it was possible. inst:ListenForEvent( "sanitydelta", function(inst, data) inst.components.combat.damagemultiplier = (1.0-inst.components.sanity:GetPercent())*1.0+1.0 end ) That should scale the damage to a multiplier of 2.0 at zero sanity right? If that's all you're wanting to scale it by then you can simplify the expression down and shorten calculations via: 2.0-inst.components.sanity:GetPercent() 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