start / stop AI

In my game, I want to let the AI run for a period of time and then stop/pause. I want all movement to / attacking to stop at the call of an event. don’t mind if the current AL action is canceled. I just want to stop all AI Actions dead in its tracks and then allow the AI to act later on.

What is the best way to accomplish this?

There is no “best way”, since it all depends on your AI and game in general: are you using your AI controller or the default one? Are you using BT? …

For example, 2 of the quickest way are:

  • Stop Active Movement” followed by “Detach From Controller Pending Destruction” + “Destroy Actor” (the controller).
  • In case you don’t want to destroy the controller, “Stop Active Movement” followed by “Unpossess”.

The resume of the AI actions will depend on you choice. If, for example, you chose the first, then you will have to spawn a new controller and possess the AI pawn. If you chose the second one, you can save a reference of the pawn, before unpossessing it, and then possess it again.

Thanks. The AI I’m using has a BT. I’ve tried what you suggested, but the problem is that the AI is still attacking (firing its gun and using various melee attacks). So I also need a way to stop all animations or pause them.

I’m experimenting with setting the AI actor’s Global Time Dilation. It’s almost exactly what I’m looking for. The only problem is that I still want the hit reaction and death animations.