I seem to have been a tad bamboozled by timers, Basically I have a trigger that will change the ai behaviour for random roaming to all AI chasing player. I want this to only last for set period of time (to be changed by individual trigger, this I can do already).
My issue is the timer doesn’t work. if i remove the timer and just call the change behaviour event all is fine, i input the timer functionality back in, I’ve set my timer to last 20 seconds, then call the random roam function. it never calls it. however if the clear timer function is put at the end of the random roam function it then calls the random roam function almost immediately, ie. pass through the trigger all the ai face me then immediately go back to random roam, but with out timer my chasing player function works fine, but i need it to last certain amount of time.
the timer is being called at the start of the chase event
Even though you didn’t show the blueprint code where you call your function, by your description, I think it might be because you don’t change the necessary blackboard key’s value which has been set as the selector condition between your roaming and chasing events
so the player crosses a trigger box which gathers all actors of the ai class and in a for each loop calls the chase event inside the ai char blueprint, inside the chase event within the ai char the first node is the start timer event from the picture in the original post.
Is that binded to the event begin overlap node? You should only trigger your timer once for it to work. Try putting a “Do Once” node before you call your event.
Gonna post this to get the obvious stuff out of the way…
First thing you should do is test your Timer. Duplicate it and put it in begin play or something and then put a breakpoint at the start of your RandomRoam function to verify that it’s actually getting called. Or print a message telling you it’s being called.
If it’s not being called, check for typos in both the Timer node and in your function name. Sometimes, I’ve had typos in function names and not realized it. Also try it without a space. Sometimes UE will display a space in function names even though the actual function doesn’t have a space.
Tried everything you outlined to no avail. I’ve started to rewrite the ai code using a behaviour tree and blackboard now, and have gotten the chase mode to work with a delay instead of timer. its strange as I tried using a delay before when i was just using custom events to run the AI and that only worked when using 2 events and stopped working when implementing a third.
yeah, it didn’t work on begin pay either. However it worked when i used delay to do what i wanted instead, so a bit strange and not entirely sure what happened.