Unable to detect Delay node on Event Tick

I’m trying to make an AI bot to strafe randomly left and right when in certain range from the main player:

If I remove the Select node and directly connect the GetActorRightVector to the Add Movement Input, it works as it should (strafing to the right for 1 second).

But when I add the Select to randomize left or right, this happens:


It’s like hes not detecting the delay event when the Select node is applied. I’ve tried with the Switch on Int node but it reproduces the same as the Select.

Any ideas?

A delay stops all code. Try using a timer

in the line of “Function Name” you can specify the function name or the name of the event

Hey the delay is there just for reference that it doesn’t activate it. It reproduces the same result with or without the delay node.

I’ve tried adding a second Add Movement Input with the negative value (so the character goes left instead of right) but for some reason it only detects the first Add Movement Input node:

I think you misunderstand Delay. It’s gonna rapid fire the code before the delay, hit the delay the first time, which will put it into basically a closed gate for 1 second and then the code will move right on…which in this case will just spam the tick, rapid firing the randomizer every frame.

Simply put the delay first…then it will gate out what’s directly after it for 1s.

I see a lot of people put delays on Sequences…Then 1) Do something Then 2) Delay Then 3) Do Something…gets ran like this:

123 13 13 13…for 1s… 123 13 13 13 13 13 13

Another option is using a separate timer to control the separate left/right boolean and use a SELECTOR by that in tick with no delays at all.

You are using an asynchron action in tick - that will not work. put your logic in a custom event, in your begin play create a timer with ticked “looping” and execute that event. if you ever have the feeling to put a DELAY in TICK (which fires as fast as your hardware can) - you should get the feeling to do something wrong :wink:

If you need/want howewer use the tick, you can also set the tick interval in the actor settings to a fixed value like 1 sec, this will also get rid of the delay and you can leave your logic as it is - but, just avoid tick and go for the custom event