Jump to content

Damage Scaling on Lower Sanity


Recommended Posts

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

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

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
Link to comment
Share on other sites

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

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
 Share

×
  • Create New...