Jump to content

playerRef.GetHealthPercentage


ozziefire

Recommended Posts

I tried using the playerRef.GetHealthPercentage but it doesn't seem to alter with the players health in NV it was just returning a continual 1.0 at any health level, anyone else used it without a problem?

 

I worked out the formula for Health as ((Endurance + Level) *10) +120

Edited by ozziefire
Link to comment
Share on other sites

As far as I know, they have a few conditions that you cannot alter, that have like fixed values hat they used during the games creation to create certain formulas. I'm pretty sure you can't change it

Yeah I realised I can't change it, I'm looking to workout the players health percentage for a mod.

Link to comment
Share on other sites

You're looking for GetActorValue. That page links to the stats list as well.

 

Basically, to get the health percentage, you're going to have to get the base actor value with GetBaseActorValue, then compare to the current actor value (GetAV), and find out what the difference is. From that you can determine the percentage that they have right now.

 

Hopefully that's what you're looking for. I'd give you the actual algorithm, but I'm tired and I suck at percentage math.

Link to comment
Share on other sites

You're looking for GetActorValue. That page links to the stats list as well.

 

Basically, to get the health percentage, you're going to have to get the base actor value with GetBaseActorValue, then compare to the current actor value (GetAV), and find out what the difference is. From that you can determine the percentage that they have right now.

 

Hopefully that's what you're looking for. I'd give you the actual algorithm, but I'm tired and I suck at percentage math.

LOL yep I been doing it the hard way, better off doing what you've suggested, makes more sense, I think my brain needs a break :)

Link to comment
Share on other sites

I tried using the playerRef.GetHealthPercentage but it doesn't seem to alter with the players health in NV it was just returning a continual 1.0 at any health level, anyone else used it without a problem?

 

I worked out the formula for Health as ((Endurance + Level) *10) +120

 

I've always used player, not playerREF

My use of player.Gethealthpercentage is working as expected at the console and in my scripts.

One thing to keep in mind is that Gethealthpercentage returns more than 1 if the player is on buffout, for example. So he could be damaged and still return 1

 

Edit: here's a snippet from what I am doing:

 

		set fPlayerHealthEffects to 0
	
	set fPlayerCurrentHealth to Player.GetAV Health
	set RHKWendySTAT.fPlayerCurrentHealthPercent to Player.GetHealthPercentage
	set fPlayerBaseHealth to fPlayerCurrentHealth / RHKWendySTAT.fPlayerCurrentHealthPercent
	set RHKWendySTAT.fPlayerCurrentHealthPercent100 to RHKWendySTAT.fPlayerCurrentHealthPercent * 100
	
	if (Player.IsSpellTarget Buffout)
		set fPlayerHealthEffects to 60
	endif
	if (Player.HasPerk LifeGiver)
		set fPlayerHealthEffects to fPlayerHealthEffects + 30
	endif			

	set RHKWendySTAT.fPlayerCurrentPerception to Player.GetAV PerceptionCondition
	set RHKWendySTAT.fPlayerCurrentEndurance to Player.GetAV EnduranceCondition
	set RHKWendySTAT.fPlayerCurrentLeftAttack to Player.GetAv LeftAttackCondition
	set RHKWendySTAT.fPlayerCurrentRightAttack to Player.GetAv RightAttackCondition
	set RHKWendySTAT.fPlayerCurrentLeftMobility to Player.GetAv LeftMobilityCondition
	set RHKWendySTAT.fPlayerCurrentRightMobility to Player.GetAv RightMobilityCondition
		
	if (RHKWendySTAT.fPlayerCurrentPerception * RHKWendySTAT.fPlayerCurrentEndurance * RHKWendySTAT.fPlayerCurrentLeftAttack * RHKWendySTAT.fPlayerCurrentRightAttack * RHKWendySTAT.fPlayerCurrentLeftMobility * RHKWendySTAT.fPlayerCurrentRightMobility <= 0)
		set iPlayerCrippled to 1
	else
		set iPlayerCrippled to 0
	endif
	
	set iPlayerLimbTotal to (RHKWendySTAT.fPlayerCurrentPerception + RHKWendySTAT.fPlayerCurrentEndurance + RHKWendySTAT.fPlayerCurrentLeftAttack + RHKWendySTAT.fPlayerCurrentRightAttack + RHKWendySTAT.fPlayerCurrentLeftMobility + RHKWendySTAT.fPlayerCurrentRightMobility)
	
	if ((fPlayerCurrentHealth < (fPlayerBaseHealth + fPlayerHealthEffects)) || (iPlayerLimbTotal < 600))	;buffout corrected
		set RHKWendySTAT.iPlayerDamageFlag to 1
	else
		set RHKWendySTAT.iPlayerDamageFlag to 0
	endif 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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