void finisher(void AniP, void Ani , int RxMin, int RxMax, int Rz, int Type, int Flag)
{// Checks closest enemy's animation & range
// If it's accepted, change animation
// AniP : Enemy's animation
// Ani : Animation to change to
// RxMin : Minimum x range
// RxMax : Maximum x range
// Rz : z range
// Type : 0 = non targetted , 1 = for targetting, 2 = for grabbing
// Flag : 0 = facing direction not necessary , 1 = facing direction must be opposite
/*Originally smartbomb by
Damon Vaughn Caskey
07152008*/
void self = getlocalvar("self"); //Caller.
float x = getentityproperty(self, "x");
float z = getentityproperty(self, "z");
int dir = getentityproperty(self, "direction");
void vEntity; //Target entity placeholder.
int iEntity; //Entity enumeration holder.
int iType; //Entity type.
int iMax = openborvariant("ent_max"); //Entity count.
//Enumerate and loop through entity collection.
for(iEntity=0; iEntity<iMax; iEntity++){
vEntity = getentity(iEntity); //Get target entity from current loop.
iType = getentityproperty(vEntity, "type"); //Get target type.
//Enemy type?
if (iType == openborconstant("TYPE_ENEMY")){
float Tx = getentityproperty(vEntity, "x");
float Tz = getentityproperty(vEntity, "z");
int Anti = getentityproperty(vEntity, "antigrab");
int Edir = getentityproperty(vEntity, "direction");
void EAnim = getentityproperty(vEntity, "animationID");
if(EAnim == openborconstant(AniP)){
float Disx = Tx - x;
float Disz = Tz - z;
if(Disz < 0){
Disz = -Disz;
}
if( Disx >= RxMin && Disx <= RxMax && Disz <= Rz && dir == 1 ) // Target within range on right facing?
{
if(Type == 2){
if(((Flag == 1 && Edir == 0) || Flag == 0) && Anti < 10){
dasher(0,0,0);
setlocalvar("Target" + self, vEntity);
performattack(self, openborconstant(Ani));
}
} else {
if((Flag == 1 && Edir == 0) || Flag == 0){
if(Type == 1){
dasher(0,0,0);
setlocalvar("Target" + self, vEntity);
}
performattack(self, openborconstant(Ani));
}
}
} else if( Disx >= -RxMax && Disx <= -RxMin && Disz <= Rz && dir == 0) // Target within range on left facing?
{
if(Type == 2){
if(((Flag == 1 && Edir == 1) || Flag == 0) && Anti < 10){
dasher(0,0,0);
setlocalvar("Target" + self, vEntity);
performattack(self, openborconstant(Ani));
}
} else {
if((Flag == 1 && Edir == 1) || Flag == 0){
if(Type == 1){
dasher(0,0,0);
setlocalvar("Target" + self, vEntity);
}
performattack(self, openborconstant(Ani));
}
}
}
}
}
}
}