Chicken logic in gameplay

Hello!

In Resident Evil 4 there is a chicken in the first village, behaving just like a chicken.
When you walk near to it, it walks / flies away, else it walks around arbitrarily, picking up corn, and you can kill it.

I never paid much attention to it, but now that I want to achieve the same, I do. :slight_smile:

What would be the smartest / easiest way to achieve that?

I have the animations, but I am missing the logic.

Is there something simple that I could try out (perhaps something in PlayMaker?), or do I have to program all this by myself?

Yes you could code the AI of it

  1. Just when you walk near the chicken calculate the vector3.distance between the player and chicken
    2.if the distance is less than your expected distance give the chicken an random rotation
  2. give a lerp from its present position to the new position with the proper animation.
  3. you can also call check a random number value to make it run or fly

You have to code it smartly to give it a realistic feel .

I’m not familiar with PlayMaker, but if you’re serious about making games, it’s definitely a good idea to learn to program (unless you want to be a designer or 3D modeler/animator or a 2D artist).

If you’re going to take the programming route, I would look into the OnTriggerEnter() method for making the chicken move away from the player and NavMesh and NavMeshAgent for randomly moving the chicken around to start.

Those are just starting places, but that’s how I would implement what you’re talking about.

If you plan on going that way, I’d be happy to provide further details/help.