Code:
image_index = ((global.hp / global.max_hp) * 100) - 1; //Subtract 1 because image indexes start at 0 and image index 99 is actually 100th image
Anyways, do you really have to use a 100-images sprite? You could easily do a healthbar by using a frame sprite and another sprite to fill the frame with. Draw the frame first, then the fill sprite using
draw_sprite_part() and defining the part of the sprite to be drawn.