How can I stop my Event Tick from firing?

I currently have a system that will move an actor to the closest character to the current player and possess that character when the actor reaches it. This is activated through a key press. At the moment the actor carries on following/banging into the newly possessed character because I can’t figure out how to stop the tick until it is activated again. I assume there is going to be a way to do this with Gates but i just can’t figure out how to close it when the actor has reached it’s destination. Any help would be appreciated, thanks!

Can you put a branch on the tick and set a bool when the player reaches the destination and then check that bool for the branch?

Yeah that would work but I’m not sure how to check if the actor has reached the player to set the bool once it has?

You can use a volume that, once overlapping the actor in question, sets the bool to true. Or you can skip the bool and once the actors overlap have it immediately close the gate, thereby preventing the tick from continuing movement.

That’s how I sorted it. Cheers.

For anyone else who has this question, there’s alot of options for handling this.

(Leaving Tick Running But Skip Processing Additional Code)
If you perform a bool check you can branch it to skip processing the rest of your code.

(Destroy the Original Pawn Object During Possession Transfer)
If you are taking control over another pawn from object then you can Destroy the original pawn object which will shut off it’s tick and you can carry on using the next possessed pawn. If the object is destroyed it is no longer ticking.

(Timer Based Value Check Method)
You can use a timeline or setup a timer and then clear the timer to finish performing checks.

(Behavior Tree AI Feedback Method)
You can set up your project using Behaviour Tree’s to handle the value references for the movement calculations.

(Disable Actor or Component Tick Directly)
For an actor you can use the Set Actor Tick Enabled value to False, or in a component Set Component Tick Enabled to False, if you use this method I recommend adding a Delay Node because you might experience an overrun condition that fires the Event Tick twice one time before it is totally disabled so it doesn’t process the code a second time, you give the setting enough time to be applied.

Performance Thoughts:
As for which would give the best performance option, if you don’t run in a constant check loop and aren’t checking at all the better, such as by destroying the object would be the better approach if this is focused more heavily on game logic or has a graphical with logic impact, and if the object is checking until a temporary condition and the result is long term where the object doesn’t get destroyed and you expect multiple copies then using a timer based approach would probably be better as you could easily start up the timer again and calculate without a delay.

1 Like