Jump to content

[LE] how get player max health with buff in oldrim


Recommended Posts

You have no idea how sad this answer makes me:

No.

 

For all the haters:

I know all about GetActorValuePercentage and GetAVPercentage, but the sad truth is - they don't work the way they're supposed to.

I'll explain:

When GetAVPercentage is called, it returns a Float value. Now, unlike what the wiki states, it is NOT a value between 0 and 1.

The sad part is that the "Percentage" is calculated compared to the BaseValue, i.e. buffs make you go over that BaseValue so you'll numbers that are actually bigger than 1.

Example:

BaseValue of HP =100; buffs = 50 => Total HP = 150 => (when you are not hurt of course...) GetAVPercentage("Health")= 1.5.

 

Final notes: I really REALLY wish Bethesda had implemented something like GetAVMax in Oldrim - hack, even in SKSE - but nothing like that exists so we are left with the small void of what could have been...

 

And on a much less grimmy note:

I do have an idea for a workaround - it's not too good, but maybe it can help you: keep a global variable for each of the 3 attributes' MaxValue.

Again, this isn't a good implementation because of many reasons, but you might figure something out for yourself/

 

Good luck!

Edited by DMan1629
Link to comment
Share on other sites

NOOOOOOOOOOO,

NOOOOOOOOOOOOOOOO,

i like to try make new Equilibrium spell =>

if CurrentHp > 0.5

float HealthToDamage = CurrentHp-(maxHp*0.5)),

DamageAV("Health", HealthToDamage)
RestoreAV("magicka", HealthToDamage)

endif

 

but based your Example: (when you are not hurt of course...),

this mod is likely impossible to implemented,

 

anyway thanks for explanation, example, and reply, i really appreciate it

Link to comment
Share on other sites

OK scratch everything I said - I have a solution!

 

I just remembered I solved this when working on another mod!

It's not a set command - you'll need to use scripts and it works only via SKSE:

 

ActorValueInfo.GetActorValueInfoByName(Attribute).GetMaximumValue(TargetRef)


I really hope this helps, and sorry about before...

Hope it helped.

Link to comment
Share on other sites

GetAVPercent will return an increase or a decrease in percentage in the case of buffs, but i think people only expect

the decrease portion. What im saying is, a little math can pull this off.

thanks friend, but as long i know there no "GetAVPercent" command,

if you talking about "GetAVPercentage" see reference about it of first reply,

anyway thanks for your concern

Link to comment
Share on other sites

For all the haters:

I know all about GetActorValuePercentage and GetAVPercentage, but the sad truth is - they don't work the way they're supposed to.

I'll explain:

When GetAVPercentage is called, it returns a Float value. Now, unlike what the wiki states, it is NOT a value between 0 and 1.

That is a float value. There are infinite amount of numbers between 0 and 1. 0.5 = 50%, 0.125 = 12.5%, 0.99 = 99%. Not sure what you're getting at.

Link to comment
Share on other sites

 

For all the haters:

I know all about GetActorValuePercentage and GetAVPercentage, but the sad truth is - they don't work the way they're supposed to.

I'll explain:

When GetAVPercentage is called, it returns a Float value. Now, unlike what the wiki states, it is NOT a value between 0 and 1.

That is a float value. There are infinite amount of numbers between 0 and 1. 0.5 = 50%, 0.125 = 12.5%, 0.99 = 99%. Not sure what you're getting at.

 

 

What I'm getting at is that it doesn't work correctly.

If you have base 100 HP and total of +50 bonus HP you'll have 150 HP total, but then GetAVPercentage will return 1.5 when in full health, not 1.0.

I explained it pretty well in that post, which you cut off for some reason because why not...

My explanation, after a lot of trials, states just what GetAVPercentage's discussion page says - this command doesn't work as it should.

What it actually does is compare the current stat to the base stat: current / base (current HP divided by base HP).

That is the reason why Bethesda added GetActorValueMax in SSE.

 

If anything I wrote isn't clear, please read everything in my first post - the one you quoted only a part of and not fully.

Link to comment
Share on other sites

As a workaround for this without SKSE I once considered doing some madness like this, which in theory should work but it's less than ideal, didn't got to use it iirc.

Float Function GetMaximumActorValue(Actor akActor, String asValueName, Float fInfinite = 9999.9)
  Float Base = akActor.GetActorValue(asValueName)
  akActor.RestoreActorValue(asValueName, fInfinite)
  Utility.Wait(0.1); to make sure we are fully healed
  Float Max = akActor.GetActorValue(asValueName)
  akActor.DamageActorValue(asValueName, Max - Base)
  Return Max
EndFunction
Link to comment
Share on other sites

  • Recently Browsing   0 members

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