Download

How to repaet an action

I know that this is a noob question how ever how would I go a about having an action such as changing a random location loop with a delay of 3 seconds. Basically what I am trying to do is have so that every 3 seconds if that player is not in sight to have the AI walk to a random location. I have the random location part down but not the repeating of the action. How would I go about doing this?

I’m quite the noob myself but i’m gonna try to answer this:

You can either use one of Loop Blocks like the While-loop for endless looping actions or the for-loop when you want a specific amount of loops before performing other actions.

For a more simpler approach you can just connect the last pin of your last action in one “loop” to the start pin of the first action…if that explanation made any sense.

Just remember to always use a Delay Block in your loop to not hang the game.

Hope this helps

While Loops are dangerous to use.It can cause unexpected crushes.Try using “Do N” node.

But in this case,I suggest using a more complicated “A.I” with behaviour trees.There are lots of tutorials on this.Try searching “Basic A.I For UE4”.

You could just use a Delay node.

OK So I had it right but i was stupid and only did a regular delay node and not a retriggable one. Thank you guys expectualy Ross. Looking at your post made me remember that the retriggable delays exist.

This is for people who want to make a quick non-blackboard AI patrol and make them go to random locations. Not perfect but hey it works

Oh ya the print string is connected to an event tick for debuging. it is not needed to run.