Here is a simple way to stop the aliens from moving/attacking once the player dies. The solution is based on “Event Dispatchers.” They weren’t covered in the course so far, but they aren’t that hard to use/understand.
They have two components.
A sender or Dispatcher - someone who “tells/broadcasts” an event
A receiver or Listener - someone who “subscribes/binds” to a dispatcher/event
With that in mind, here is how I made my setup.
In BP_Marine, I’ve created an Event Dispatcher called “PlayerIsDead” and added the node after we set the “Dead” boolean like this
In BP_Alien on “Event BeginPlay,” I subscribe/bind to that event to know when it triggers on the Marine. I made a Cast to BP_Marine and got the “Bind Event to Player is dead” node. I’ve dragged from the red square and selected “Create Custom Event” and named it “StopAttacking.” From there, I just set my Boolean Win condition that stops the Alien from moving and plays a new animation.
In myIn BP_Alien “Event Tick,” I have a branch that checks for “Is Marine Dead” boolean, and if it’s true - we Deactive the AI movement and set the “Win” boolean to true
In AnimBP_Alien, on “Event Update Animation,” we add a simple link between our Win Boolean and the transition rule to the win state (similar to how we set up the walk/idle states). The win state is just one animation (not looped) named " Spider_Cast_Roar."
When the player dies, It’s Event Dispatcher “broadcasts” that it was triggered. Anyone who is bound or listens for that event will execute its own code based on it. The system works similarly to the “Any Damage” system. where you can call it, and it will update other components based on it.
Hopefully, I didn’t miss anything, and now you have an alien that will “Roar” once he kills the player, and any other aliens that were en route to the player will stop in their tracks.