x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

alt text

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.

alt text

Thank you. Feel free to ask for anymore clarification.

Product Version: UE 4.21
Tags:
more ▼

asked Mar 25 '19 at 07:26 AM in Blueprint Scripting

avatar image

Slazy101
1 1

avatar image MrMcKvarz Mar 25 '19 at 09:39 AM

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.

avatar image Slazy101 Mar 25 '19 at 10:53 AM

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

avatar image MrMcKvarz Mar 25 '19 at 03:09 PM

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

avatar image Slazy101 Mar 26 '19 at 11:20 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question