NPC Code:
//This example assumes you have a bar that is 100x25 pixels and is named hpbar.gif
if (created) {
timeout=0.05;
}
if (timeout) {
GetHP();
DrawBar();
timeout=0.05;
}
function GetHP() {
this.hp=int(playerhearts/playerfullhearts)*100;
}
function DrawBar() {
showimg 1000,hpbar.gif,screenwidth*0.9,screenheight*0.05;
changeimgpart 1000,0,0,this.hp,25;
changeimgvis 1000,4;
}
I haven't tested in Graal. Just now made it up. You should test it though. Don't forget the showstats command.