newbie question how would get the percentage of its original starting value over its current value

somthing like this?
public int HP=1000;//current//this one goes down when reciving damage
public int HP_Max=1000;//maximum health where it started of

if(current HP is divisible within within the range of 100% to 80% of its Max HP){
Something();//no danger

}

else if(current health is divisible within within the range of 80% to 60% of its Max HP){
something();//warning

}

Here’s a forum thread on the subject.

You can either use if statements to check if the health value is between two given min/max values, or you can use the Mathf.Clamp function to create a temporary value between a given range and check if it still matches your original value (in which case it is within range).

Mathf.Clamp solution:

public int HP=100;
public int HP_Max=100;
public int HP_Min=80;

// check if HP value is between 80% to 100%

if (Mathf.Clamp(HP, HP_Min, HP_Max) == HP)
{
  // HP value is between 80% to 100%
  // do something
}

And the alternative using if statements:

if (HP <= HP_Max && HP >= HP_Min)
{
   //HP value is within range
}