Archived

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

X5-Programmer

Enemy AI Help @ Models

Recommended Posts

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 ^^

Share this post


Link to post
Share on other sites