Jump to content

[SSE] Raise Damage Resistances as Health lowers


lucidaxe

Recommended Posts

Is there a mod that can dynamically increase the player's physical and magical damage resistances as the player's health lowers? Would it be hard to make such a mod?

The idea is that it would be harder to kill the player the lower their health gets, so that players have a bit more time to reconsider, strategize and combat damage by healing.

Say the mod implements a damage resistance cap of 95% on either damage resistance type.

 

As an example of how it would work:

1) A player for example has 200 health at full health.

2) The game registers the player taking a hit that subtracts 40 health from the player's health. The mod is listening for any event that modifies the player's health, and activates its function when that happens.

3) The mod immediately calculates that the player is now at 160 out of max 200 health. Player current health percentage is thus 160 / 200 = 0.8. The mod subtracts the player current health percentage from 1 (in this case, 1 - 0.8 ) to learn that the player is missing (0.2 =) 20% of their health. 20%, as the percentage of missing health, becomes the target percentage of increase towards the physical and magical damage resistance cap.

 

The mod compares the player's current physical damage resistance percentage with its damage resistance cap of 95%. If the player has base 30% physical damage resistance, then that means the player is 65% below the cap. As 20% is the target percentage of increase towards the cap, it wants to bring the player 20% of the way closer to the resistance cap. The mod takes 20% of 65, which is 13, and thus adds a temporary (until the next hit or heal) 13% to the player's base physical damage resistance, bringing their modified physical damage resistance for any following physical damage hit up to 43% (base 30% + 13%).

The mod compares the player's current magical damage resistance percentage with its damage resistance cap of 95%. If the player has base 63% magical damage resistance, then that means the player is 32% below the cap. As 20% is the target percentage of increase towards the cap, it wants to bring the player 20% of the way closer to the resistance cap. The mod takes 20% of 32, which is 6.4 (rounded to 6), and adds a temporary (until the next hit or heal) 6% to the player's base magical damage resistance, bringing their modified magical damage resistance for any following magical damage hit up to 69% (base 63% + 6%).

 

Innate low resistances get a bigger boost, while innate high resistances get a smaller boost, all dependent on how much damage the player has taken. For player protection, that is exactly what I want.

 

4) Whenever an event in the game increases or decreases the player's health again, the mod recalculates how much health the player is missing and adjusts its bonuses to the damage resistances accordingly.

Suppose the player heals themself back up to full health, then they have 0% missing health. In that case, upon evaluating missing health, the mod brings the player 0% of the way closer to the damage resistance cap, and overwrites the earlier damage resistance increases of 13% to physical resistance and 6% to magical resistance with an increase of 0% instead. The player gets base 30% physical damage resistance + 0%, and 63% magical damage resistance + 0%, which leaves the player once again with their base damage resistances at full health.

 

If anyone has found a mod that does this, or is willing to make such a mod, or is willing to help me make it myself, please reach out!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...