#### Archived

This topic is now archived and is closed to further replies.

# Enemy AI Help @ Models

This topic is 4988 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Hi there, i dont know so mutch about AI and i need some help with this problem take a look.  //Player posX PlayerX = (cast.pc->ai.basic.posX)+1.0f; //Player posZ PlayerZ = (cast.pc->ai.basic.posZ); for ( int loop=0; loop < cast.numenemys; loop++ ) { //Enemy posX PosX = cast.enemy[loop].ai.basic.posX; //Enemy posZ PosZ = cast.enemy[loop].ai.basic.posZ; if ( CollisionModels(PosX, PosZ, cast.enemy[loop].ai.vision->rangeSqr )) { cast.enemy[loop].animationChange=true; cast.enemy[loop].animation=RUN; //Run cast.enemy[loop].ai.basic.MoveNew(PlayerX, PlayerZ); } else if ( CollisionModels(PosX, PosZ, cast.enemy[loop].ai.fighter->attackRange )) { cast.enemy[loop].animationChange=true; cast.enemy[loop].animation=SHOT_STAND; //Attack } } all this is looped so the enemy attack the player all the time they are in the range. But the problem is that the animationChange and animation set is looped also so the model change to the first frame all the time. how can i do so the change and set only change 1 time? äh, im dizzy now but i hope you know what i meen ^^