xyz555 said:[size=8pt]Is there a script of this can make the
Attack props only just chase an enemy with a specific name to attack ?
(But it will not attack at all, enemies of other names .)
Thank your guidance[/size]![]()
![]()
![]()
@script
void self = getlocalvar("self");
float x = getentityproperty(self, "x");
float z = getentityproperty(self, "z");
void vEntity; //Target entity placeholder.
int iEntity; //Entity enumeration holder.
int iName; //Entity name.
int iMax = openborvariant("ent_max"); //Entity count.
float Tx;
float Tz;
float Disx;
float Disz;
if(frame == 0){
//Enumerate and loop through entity collection.
for(iEntity=0; iEntity<iMax; iEntity++){
vEntity = getentity(iEntity); //Get target entity from current loop.
iName = getentityproperty(vEntity, "name"); //Get target name
//Sign?
if(iName == "Sign" && vEntity!=self){
Tx = getentityproperty(vEntity, "x");
Tz = getentityproperty(vEntity, "z");
Disx = Tx - x;
Disz = Tz - z;
if(Disx >= -12 && Disx <= 12 && Disz >= -25 && Disz <= -15)
{
performattack(self, openborconstant("ANI_FOLLOW1"));
}
}
}
}
@end_script
bWWd said:I would just make player with this name his parent and enemy wiould chase parent
Bloodbane said:I still wonder why you'd need such enemy xyz555. The answer could give better understanding on how to code this enemy
But anyways, I've coded AI for that enemy. It works great but might need some codes to stabilize it 8)
bWWd said:I would just make player with this name his parent and enemy wiould chase parent
That might work, though the enemy won't attack player unless he/she is using script to attack