#include "data/scripts/trailer.h"
void main()
{
int i, j, k;
void spr;
int facing, cd;
float a, z, x;
void ent = getlocalvar("self");
int anim = getentityproperty(ent, "animationid");
void map;
int elapsed_time = openborvariant("elapsed_time");
if(anim == openborconstant("ANI_FREESPECIAL5")){ map = getentityproperty(ent, "colourtable", 0);}
if(anim == openborconstant("ANI_FOLLOW9")){ map = getentityproperty(ent, "colourtable", 0);}
if(anim == openborconstant("ANI_FREESPECIAL13")){ map = getentityproperty(ent, "colourtable", 0);}
if(anim == openborconstant("ANI_FREESPECIAL14")){ map = getentityproperty(ent, "colourtable", 0);}
if(anim == openborconstant("ANI_FREESPECIAL16")){ map = getentityproperty(ent, "colourtable", 0);}
setglobalvar("blahblah.map", map);
if(elapsed_time%trailerd==0)
{
if((anim == openborconstant("ANI_FREESPECIAL5")) || (anim == openborconstant("ANI_FOLLOW9")) || (anim == openborconstant("ANI_FREESPECIAL13")) || (anim == openborconstant("ANI_FREESPECIAL14")) || (anim == openborconstant("ANI_FREESPECIAL16")))
{
spr = getentityproperty(ent, "sprite");
x = getentityproperty(ent, "x");
z = getentityproperty(ent, "z");
a = getentityproperty(ent, "a");
facing = !getentityproperty(ent, "direction");
for(k=1; k<=trailermax; k++) //find an empty trailer slot
{
if(getglobalvar("trailer"+k+".s")==NULL())
{
setglobalvar("trailer"+k+".s", spr);
setglobalvar("trailer"+k+".x", x);
setglobalvar("trailer"+k+".z", z);
setglobalvar("trailer"+k+".a", a);
setglobalvar("trailer"+k+".f", facing);
setglobalvar("trailer"+k+".c", trailerc*trailerd);
break;
}
}
}
}
int Bi; int Bz; int Bt;int Bhealth;int Boff;
void Bpl;
if(openborvariant("in_level")==1)
{
Bz = openborconstant("FRONTPANEL_Z");
for(Bi=0; Bi<3; Bi++)
{
Bpl = getplayerproperty(Bi, "ent");
if(Bpl!=NULL())
{
void Bself = getlocalvar("self");
void Btarget = findtarget(Bself);
Bhealth = getentityproperty(Btarget, "health");
iType = getentityproperty(target, "type");
if ((Bhealth<=20) && (iType ==openborconstant ("TYPE_ENEMY"))); checks if the health is 20 or less and draws a red box
{
//drawbox(x, y, width, height, z, color, alpha)
drawbox(Bi*160+21, 37, Bhealth, 6, Bz+1000, rgbcolor(255,0,0));//health red
}
}
}
}
}