Jump to content

Resetting Health


eleglas

Recommended Posts

I have been trying to make a script that will cause nanobots (armor) to reset my health to 100% if my health falls below 50%.

 

But, I want it to keep a track on my health and reset it if the condition above is met, however it won't reset my health unless I unequip it and then equip it again.

 

Here is my code:

 

SCN ResetHealth2

 

Ref GetHealth

 

Begin ScriptEffectStart

 

Set GetHealth to player.gethealthpercentage

 

If GetHealth <= 50

 

Player.Resethealth

 

Endif

 

END

 

Any help would be great.

 

Thanks

Link to comment
Share on other sites

Why are you using a "ref" variable to hold a regular value? These variables should be used to store FormIDs, "int" variables should be used to store integer values, and "float" variables should be used to store floating point values.

 

That said, you really don't need to use a variable to store the result of "player.GetHealthPercentage" anyway, as you can place this directly in your condition:

if player.GetHealthPercentage < 0.5

You'll want to note that GetHealthPercentage returns a value between 0 and 1, as opposed to returning a value between 0 and 100.

 

Cipscis

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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