I'm trying to make this script work for my zombie game, I need to make it so when the dieing animation stops after a time has elapsed, lets say after 2 seconds.
I'v try'ed many ways to try an get it to work. do any one here know?? here's the script.
oh and idk why the Idle one dosnt work either.
Can any one fix it???
I'v try'ed many ways to try an get it to work. do any one here know?? here's the script.
oh and idk why the Idle one dosnt work either.
Code: [Select]
Vector3 PlayerLoc, ZombieLoc;
float Distance, Health;
int cAnimation, nAnimation;
///
int Walking = 2; //Animation set for walking.
int Attacking = 4; //Animation set for attacking.
int Dying = 5; //Aniamtion set for dying
int Idle = 1;
float Range = 2.5; //The attack range in meters.
///
void Main()
{
iObjectLocation(OBJ_88,ZombieLoc);
iObjectLocation(OBJ_110,PlayerLoc);
Distance = iVectorLength(ZombieLoc-PlayerLoc);
Health = IN_154;
if (Distance <= 20.0 && Health > 0) nAnimation = Idle; ///If the distance between u and zombie is 20 meters than Idle animation plays
if (Distance > Range && Health > 0) nAnimation = Walking;
if (Distance <= Range && Health > 0) nAnimation = Attacking;
if (Health <= 0) nAnimation = Dying;
if (cAnimation != nAnimation) {cAnimation = nAnimation; OUT_24 = nAnimation;} //If the current animation is not the same as the new animation, the current animation is set to the new one.
}
Can any one fix it???