How do I make the AI choose another attack if it picks an attack already on Cooldown

Hello

I am having an issue with my AI’s behaviours. When he gets to a mid range of the player, he will choose between 6 different behaviours at random as seen below. From left to right its: DodgeLeft, DodgeRight, DodgeForward (Forgot to fix that), StrafeRight, StrafeLeft, and LaunchAttack.

I want to use cooldowns on the 6 different behaviours so that I can make it that the AI doesn’t spam certain behaviours too quickly or make him use other behaviours more frequently.

I’ve tried using the premade Cooldown Decorator but if a behaviour that is on cooldown gets chosen again, the character just freezes in place.

What I would like, is making it so that once a behaviour goes on cooldown, it will instead immediatly pick another midrange behaviour that is not on cooldown. Does anyone know how to achieve this?

This is my service node for randomizing the attacks.

Thank you.
Feel free to ask for anymore clarification.

How would you go about setting timers? Would you use “Set Timer by Function/Event” or using delays with int variables?

You’ll need to create a custom decorator on each task that should go into cooldown. It should internally save its state and reset values using timers. You might have all moves go to cooldown with your enemy doing nothing.

Set Timer by Function/Event is the only choice since decorator is called every frame and delay won’t work.

I think I have something working. I used a blackboard boolean that gets changed within the service node by using Set Timer by Function so that I can create cooldown timers. It seems to work for now. Though not sure of the implications for later on. Thank you though!!

Hello. It seems like you can add a bool check “isReady” key or make a list of available attack indexes that it checks against in the receive activation BP. You also dont need the switch as you can just plug the generated int into the Set Blackboard int input. Cleaning everything up helps me to visualize the next steps.