Making an attack animation for AI

Hello guys! I m new here. I want to make the enemy attack once then back to idle pose for a brief moment before attacking again. But currently the enemy keep spamming attack, I dont want that. How can I achieve that?

Edit: this is my enemy’s blueprint. I appreciate any help provided. Thank You

Hello there! To achieve this behavior, you can use a state machine to manage your enemy’s actions. Here’s a possible implementation:

  1. Create an “Idle” state where the enemy does nothing for a brief moment.
  2. Create an “Attack” state where the enemy performs its attack animation and deals damage to the player.
  3. Transition from the “Idle” state to the “Attack” state when the player is in range and the enemy is not already attacking.
  4. Transition from the “Attack” state to the “Idle” state after the attack animation has finished.
  5. Add a cooldown timer to the “Attack” state to prevent the enemy from attacking again too soon.
1 Like

Hi there @user_300324773b09952d1f47f0582363200ffcaa31820cfc09f3603719, hope you’re well!

This topic has been moved from International to Programming & Scripting: AI.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Thanks and happy developing! :slight_smile:

1 Like