Skip to content

Help with Hit Point script

Trying to make a hit point check on one of my monsters. Id like to check when its down to 25% health to spawn in a bunch of his buddies. The spawn i can handle, its the hp check I dont understand do well.

Any help would be great.

Comments

  • FreshLemonBunFreshLemonBun Member Posts: 909
    Hit points are whole numbers so to avoid a fraction multiply the current hitpoints by 100 and divide it with the maximum hitpoints. You'll still lose fractions but these will be less than 1% of total hitpoints.
    percent = (100 * GetCurrentHitPoints(oCreature)) / GetMaxHitPoints(oCreature);
    if (percent <= 25)
    {
    	//do stuff
    }
    
Sign In or Register to comment.