if(vaistate==_AIstateAttack && vpathdestdistance>600 && vpickdestanglecorr<256 && vpickdestanglecorr>-256) //if aligned and far from target start running
{
float(_set,CurrentDirection,_DIRforward);
}
if(vpickdestanglecorr>256 || vpickdestanglecorr<-256) //if not aligned with target stop walking until aligned
{
float(_set,CurrentDirection,0);
}
}
elseif(CurrentDirection==0)
{
if(vpickdestanglecorr<256 && vpickdestanglecorr>-256) //aligned with target but standing still
//The last number here is used if they have to fall on their knees when energy is low
callsub(Sub_CheckDeadOrDying,AIAbility,GENPoleDead,GENCrawlDead,GENStandDead,GENCrawlSpreadOut,0,GENFallToCrawl,GENCrouchDead,0); //0=health when entering crawling-mode