Blending real-time cutscene with NPC AI behavior

If any of you ever played Half-Life, one thing you might remember is how all the NPCs were killable, including during cutscenes, which didn’t take control away from the player.

So, for instance, 2 people could be talking, but if one of the people gets damaged, the dialogue stops and both NPCs go back to their default behavior, whether it be running away, shooting back or anything else.

I have very little experience with Unreal AI system, so there’s probably a lot flying over my head, so far my best idea is adding a branch in the behavior tree that checks for “Is enacting a cutscene” Boolean and disable that Boolean if the NPC gets interrupted, but that still doesn’t solve the issue of synchronizing multiple NPCs.

I’d appreciate detailed responses, since I still have some trouble grasping AI-related code, but I’d also understand if the solution might just be too complicated for me.

In Half-Life 2 (and other Source games) they use a system called Choreography, which is basically a script that will tell the AI to do certain things in a certain order.

For example: You could have 1 action that tells the AI to walk to a certain position, then tells them to play their voice lines and maybe play a animation at the same time.

So basically what you need to do is make a system for directing the AI to do specific actions at specific times. You may be able to use the UE Sequencer to call functions on the AI’s blueprint to, for example, tell them to move to a specific position.

1 Like

I was more thinking Half-Life (1998). As far as I know that AI was fully behavior states based, so I hoped it’d also be easier to implement :man_shrugging:.
If I can remotely cancel a sequence and send out “Go back to your regular behavior” to all included NPCs, I guess it would work…