Sign in to follow this  
MemphisMyst

Damage Scaling on Lower Sanity

Recommended Posts

MemphisMyst    1

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

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
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
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 by MemphisMyst

Share this post


Link to post
Share on other sites
CarlZalph    4761
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

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