void main() //Enemy HP
{
if(getplayerproperty(0, "entity") == NULL() && getplayerproperty(1, "entity") == NULL()){
void vSelf = getlocalvar("self"); //Caller
int iETime = openborvariant("elapsed_time"); //Current time.
int iMax = openborvariant("count_entities"); //Entity count.
int iEntity; //Loop counter.
void vEntity; //Target entity.
changeentityproperty(vSelf, "iconposition", 262, -121);
for(iEntity=0; iEntity<iMax; iEntity++)
{
vEntity = getentity(iEntity); //Get target entity from current loop.
if (vEntity && vSelf) //Both Self and Target?
{
changeentityproperty(vEntity, "frozen", 1); //Toggle frozen.
changeentityproperty(vEntity, "freezetime", 95000); //Toggle frozen time.
}
}
}
else
{
void self = getlocalvar("self");
// float z = getentityproperty(self, "z");
int HP = getentityproperty(self, "health");
int MaxHP = getentityproperty(self, "maxhealth");
int health = 114*HP/MaxHP;
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");
void name = getentityproperty(self, "name");
// void icon = loadsprite("data/profiles/"+ name +".png");
int map = getentityproperty(self, "map");
int palette = openborvariant("current_palette");
int hres = openborvariant("hresolution");
/*
int map = getglobalvar("map");
*/
int iETime = openborvariant("elapsed_time"); //Current time.
int iMax = openborvariant("count_entities"); //Entity count.
int iEntity; //Loop counter.
void vEntity; //Target entity.
for(iEntity=0; iEntity<iMax; iEntity++)
{
vEntity = getentity(iEntity); //Get target entity from current loop.
if (vEntity && self) //Both Self and Target?
{
changeentityproperty(vEntity, "frozen", 0); //Toggle frozen.
// changeentityproperty(vEntity, "freezetime", 15000); //Toggle frozen time.
}
}
if(getentityvar(self,0)==NULL()){
setentityvar(self,0, health);
}
if(findtarget(P1)){
drawbox(176,6,health,2,1800,rgbcolor(255,234,41),0);
drawbox(176,8,health,1,1800,rgbcolor(255,226,0),0);
drawbox(176,9,health,1,1800,rgbcolor(255,206,24),0);
drawbox(176,10,health,1,1800,rgbcolor(246,194,0),0);
drawbox(176,11,health,1,1800,rgbcolor(230,141,0),0);
drawbox(176,12,health,1,1800,rgbcolor(222,92,0),0);
changeentityproperty(self, "iconposition", 262, -121);
drawstring(hres-27-strwidth(name, 0), 55, 0, name);
//settextobj(findtarget(P1),hres-27-strwidth(name, 0),55,0,900000000000,name);
//changetextobjproperty(findtarget(P1),"z",900000000000);
// drawsprite(icon,262,21,1800);
}else if(findtarget(P2)){
drawbox(100+(50-health),6,health,2,1800,rgbcolor(255,234,41),0);
drawbox(100+(50-health),8,health,1,1800,rgbcolor(255,226,0),0);
drawbox(100+(50-health),9,health,1,1800,rgbcolor(255,206,24),0);
drawbox(100+(50-health),10,health,1,1800,rgbcolor(246,194,0),0);
drawbox(100+(50-health),11,health,1,1800,rgbcolor(230,141,0),0);
drawbox(100+(50-health),12,health,1,1800,rgbcolor(222,92,0),0);
changeentityproperty(self, "iconposition", -56, -121);
drawstring(33, 55, 1, name);
// drawsprite(icon,-56,21,1800);
}
/* if(icon){
int iconmap = getentityproperty(icon, "map");
int colourtable = getentityproperty(icon, "colourtable", 255);
changedrawmethod(icon, "enabled", 1);
changedrawmethod(icon, "remap", -1);
}*/
if(health<getentityvar(self,0)){
if(getentityvar(self,1)==NULL()){
setentityvar(self,1,0);
}
setentityvar(self,1,getentityvar(self,1)+1);
if(getentityvar(self,1) > 50){
setentityvar(self,0,getentityvar(self,0)-1);
setentityvar(self,1,0);
}
}
}
}