I have updated my mod to version 4.0. I spent about 8 hours last night (4:54 AM, have to work at 9:00 AM, Oh my God...) rewriting, reorganizing, and removing redundant code from my script, AND made an epic change. My mod now adjusts HP according to percentages and it has a health and damage counter that actually correctly functions! My mod now heals you when you receive damage if your health is fortified, and stops healing you when the total damage exceeds your fortified health value. This basically makes Fortified Health a spell that heals you before battle. But because it also raised your Maximum HP, it makes healing before it wears off more effecient.
Three bad things though:
1) Now, if your Fortified Health runs out *after* your Fortified Endurance or Fortified Strength, you end up taking a very small percentage extra of damage. Not so bad that it's noticeable. Maybe 1 to 10 extra, depending on the amount of total health.
2) You will still drop dead if you take damage equal to or greater than your natural health + fortified health. I think this is fair, however.
3) Currently, I have found no way to counter this problem. You see, because of how scripting works, I can't differentiate between constant effects and spells with temporary durations. This means, that by constantly reequiping over and over something with a constant effect fortify health spell, inbetween hits from enemies, you can basically heal yourself for free. It is really [censored], and I can find NO solution to this. I spent 3 hours just laying in bed brainstormig, and there is just no way man.
My ultimate wish would be to have Fortified Health only drop you to 1 health when it wears off, like in Oblivion, OR have it be just bonus health that you receive that can either be used or will disappear when the duration is over, and if it used up BEFORE the duration is over, will automatically be removed. However, with the way it is now, it is basically impossible to accomplish this with scripting.
I haven't given up hope just yet, though. I am including my version 4.0 script code. It is fully functional, with only the 3 problems that I have listed. I will continue to try to think of new ideas, and fiddle with the code in an attempt to make it less irritating.
Thanks for any help anyone can give me, or suggestions. I will appreciate it greatly.
TWO GLOBAL VARIABLES:
Tal_EXTRAHP
TDamageCounter
Both start at 0.
CODE: (I apologize, I cannot format the code with indentions on this forum correctly.)
begin Tal_RetroactiveHP
float TCurrentHP
float TMaxHP
float TBasicLife
float TDamage
float TDamageRatio
float TFortifiedHP
float TFortifiedHPAdd
float TLeveledHP
float Overflow
float Test
short TFirstLevelHPBonus
short TLevel
short TEndurance
short TStrength
short TDoOnce
short TAllClear
if ( TDoOnce == 0 )
if ( Player->GetEffect, sEffectFortifyHealth == 1 )
set TDamageRatio to ( Player->GetHealthGetRatio )
set TCurrentHP to ( Player->GetHealth )
set TMaxHP to ( TCurrentHP / Player->GetHealthGetRatio )
set TLevel to ( Player->GetLevel )
set TLeveledHP to ( TEndurance / 10 )
set TLeveledHP to ( TLeveledHP * ( TLevel - 1 ) )
set TFirstLevelHPBonus to ( ( TEndurance + TStrength ) / 2 )
set TBasicLife to ( TLeveledHP + TFirstLevelHPBonus )
set TFortifiedHP to ( TMaxHP - TBasicLife )
set TFortifiedHP to ( TFortifiedHP - Tal_ExtraHP )
set TEndurance to ( Player->GetEndurance )
set TStrength to ( Player->GetStrength )
set TLevel to ( Player->GetLevel )
set TLeveledHP to ( TEndurance / 10 )
set TLeveledHP to ( TLeveledHP * ( TLevel - 1 ) )
set TFirstLevelHPBonus to ( ( TEndurance + TStrength ) / 2 )
set TBasicLife to ( TLeveledHP + TFirstLevelHPBonus )
set TMaxHP to ( TBasicLife + TFortifiedHP + Tal_ExtraHP )
set TCurrentHP to ( TMaxHP * TDamageRatio )
set TDamage to ( TCurrentHP - TMaxHP )
set Test to ( TMaxHP )
Player->SetHealth, TMaxHP
Player->ModCurrentHealth, TDamage
set TAllClear to ( 0 )
else
set TDamageRatio to ( Player->GetHealthGetRatio )
set TEndurance to ( Player->GetEndurance )
set TStrength to ( Player->GetStrength )
set TLevel to ( Player->GetLevel )
set TLeveledHP to ( TEndurance / 10 )
set TLeveledHP to ( TLeveledHP * ( TLevel - 1 ) )
set TFirstLevelHPBonus to ( ( TEndurance + TStrength ) / 2 )
set TBasicLife to ( TLeveledHP + TFirstLevelHPBonus )
set TMaxHP to ( TBasicLife + Tal_ExtraHP )
set TCurrentHP to ( TMaxHP * TDamageRatio )
set TDamage to ( TCurrentHP - TMaxHP )
set Test to ( TMaxHP )
Player->SetHealth, TMaxHP
Player->ModCurrentHealth, TDamage
set TAllClear to ( 1 )
endif
set TDoOnce to ( 1 )
endif
if ( Player->GetHealthGetRatio == 0 )
return
endif
if ( Player->GetEffect, sEffectFortifyHealth == 1 )
if ( Player->GetEndurance != TEndurance )
set TDamageRatio to ( Player->GetHealthGetRatio )
set TCurrentHP to ( Player->GetHealth )
set TMaxHP to ( TCurrentHP / Player->GetHealthGetRatio )
set TLevel to ( Player->GetLevel )
set TLeveledHP to ( TEndurance / 10 )
set TLeveledHP to ( TLeveledHP * ( TLevel - 1 ) )
set TFirstLevelHPBonus to ( ( TEndurance + TStrength ) / 2 )
set TBasicLife to ( TLeveledHP + TFirstLevelHPBonus )
set TFortifiedHP to ( TMaxHP - TBasicLife )
set TFortifiedHP to ( TFortifiedHP - Tal_ExtraHP )
set TEndurance to ( Player->GetEndurance )
set TStrength to ( Player->GetStrength )
set TLevel to ( Player->GetLevel )
set TLeveledHP to ( TEndurance / 10 )
set TLeveledHP to ( TLeveledHP * ( TLevel - 1 ) )
set TFirstLevelHPBonus to ( ( TEndurance + TStrength ) / 2 )
set TBasicLife to ( TLeveledHP + TFirstLevelHPBonus )
set TMaxHP to ( TBasicLife + TFortifiedHP + Tal_ExtraHP )
set TCurrentHP to ( TMaxHP * TDamageRatio )
set TDamage to ( TCurrentHP - TMaxHP )
set Test to ( TMaxHP )
Player->SetHealth, TMaxHP
Player->ModCurrentHealth, TDamage
elseif ( Player->GetStrength != TStrength )
set TDamageRatio to ( Player->GetHealthGetRatio )
set TCurrentHP to ( Player->GetHealth )
set TMaxHP to ( TCurrentHP / Player->GetHealthGetRatio )
set TLevel to ( Player->GetLevel )
set TLeveledHP to ( TEndurance / 10 )
set TLeveledHP to ( TLeveledHP * ( TLevel - 1 ) )
set TFirstLevelHPBonus to ( ( TEndurance + TStrength ) / 2 )
set TBasicLife to ( TLeveledHP + TFirstLevelHPBonus )
set TFortifiedHP to ( TMaxHP - TBasicLife )
set TFortifiedHP to ( TFortifiedHP - Tal_ExtraHP )
set TEndurance to ( Player->GetEndurance )
set TStrength to ( Player->GetStrength )
set TLevel to ( Player->GetLevel )
set TLeveledHP to ( TEndurance / 10 )
set TLeveledHP to ( TLeveledHP * ( TLevel - 1 ) )
set TFirstLevelHPBonus to ( ( TEndurance + TStrength ) / 2 )
set TBasicLife to ( TLeveledHP + TFirstLevelHPBonus )
set TMaxHP to ( TBasicLife + TFortifiedHP + Tal_ExtraHP )
set TCurrentHP to ( TMaxHP * TDamageRatio )
set TDamage to ( TCurrentHP - TMaxHP )
set Test to ( TMaxHP )
Player->SetHealth, TMaxHP
Player->ModCurrentHealth, TDamage
endif
if ( TAllClear == 1 )
set TLevel to ( Player->GetLevel )
set TLeveledHP to ( TEndurance / 10 )
set TLeveledHP to ( TLeveledHP * ( TLevel - 1 ) )
set TFirstLevelHPBonus to ( ( TEndurance + TStrength ) / 2 )
set TBasicLife to ( TLeveledHP + TFirstLevelHPBonus )
set TFortifiedHP to ( TMaxHP - TBasicLife )
set TFortifiedHP to ( TFortifiedHP - Tal_ExtraHP )
set TAllClear to ( 0 )
endif
set TCurrentHP to ( Player->GetHealth )
set TMaxHP to ( TCurrentHP / Player->GetHealthGetRatio )
if ( Test != TMaxHP )
if ( Player->GetEndurance == TEndurance )
if ( Player->GetStrength == TStrength )
set TFortifiedHPAdd to ( TMaxHP - Test )
set TFortifiedHP to ( TFortifiedHP + TFortifiedHPAdd )
endif
endif
set Test to ( TMaxHP )
endif
set TDamage to ( TMaxHP - TCurrentHP )
if ( TDamageCounter > TFortifiedHP )
set TDamageCounter to ( TFortifiedHP )
endif
if ( TDamageCounter < TFortifiedHP )
set TDamageCounter to ( TDamageCounter + TDamage )
if ( TDamageCounter > TFortifiedHP )
set Overflow to ( TDamageCounter - TFortifiedHP )
set TDamage to ( TDamage - Overflow )
endif
Player->ModCurrentHealth, TDamage
endif
endif
if ( Player->GetEffect, sEffectFortifyHealth == 0 )
if ( Player->GetEndurance != TEndurance )
set TDamageRatio to ( Player->GetHealthGetRatio )
set TEndurance to ( Player->GetEndurance )
set TStrength to ( Player->GetStrength )
set TLevel to ( Player->GetLevel )
set TLeveledHP to ( TEndurance / 10 )
set TLeveledHP to ( TLeveledHP * ( TLevel - 1 ) )
set TFirstLevelHPBonus to ( ( TEndurance + TStrength ) / 2 )
set TBasicLife to ( TLeveledHP + TFirstLevelHPBonus )
set TMaxHP to ( TBasicLife + Tal_ExtraHP )
set TCurrentHP to ( TMaxHP * TDamageRatio )
set TDamage to ( TCurrentHP - TMaxHP )
set Test to ( TMaxHP )
Player->SetHealth, TMaxHP
Player->ModCurrentHealth, TDamage
elseif ( Player->GetStrength != TStrength )
set TDamageRatio to ( Player->GetHealthGetRatio )
set TEndurance to ( Player->GetEndurance )
set TStrength to ( Player->GetStrength )
set TLevel to ( Player->GetLevel )
set TLeveledHP to ( TEndurance / 10 )
set TLeveledHP to ( TLeveledHP * ( TLevel - 1 ) )
set TFirstLevelHPBonus to ( ( TEndurance + TStrength ) / 2 )
set TBasicLife to ( TLeveledHP + TFirstLevelHPBonus )
set TMaxHP to ( TBasicLife + Tal_ExtraHP )
set TCurrentHP to ( TMaxHP * TDamageRatio )
set TDamage to ( TCurrentHP - TMaxHP )
set Test to ( TMaxHP )
Player->SetHealth, TMaxHP
Player->ModCurrentHealth, TDamage
endif
if ( TDamageCounter != 0 )
set TDamageCounter to ( 0 )
endif
if ( TFortifiedHP != 0 )
set TFortifiedHP to ( 0 )
endif
if ( TAllClear == 0 )
set TCurrentHP to ( Player->GetHealth )
set TMaxHP to ( TCurrentHP / Player->GetHealthGetRatio )
set TAllClear to ( 1 )
set Test to ( TMaxHP )
endif
endif
end