MemphisMyst 1 Report post 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? Share this post Link to post Share on other sites
Lumina 2151 Report post 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. Share this post Link to post Share on other sites
--- -.- 4050 Report post 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... Share this post Link to post Share on other sites
CarlZalph 4761 Report post 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. Share this post Link to post Share on other sites
MemphisMyst 1 Report post 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 Share this post Link to post Share on other sites
Ricoom 15 Report post Posted February 21, 2017 (1,0 - 0.0) *1.0 + 1.0 = 2.0 so yes Share this post Link to post Share on other sites
MemphisMyst 1 Report post Posted February 21, 2017 Thanks; I just wanted to make sure I understood the line. Thanks to everyone whom helped me with the character! Share this post Link to post Share on other sites
CarlZalph 4761 Report post 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() Share this post Link to post Share on other sites