There's a lot things that you can do to solve that. I will go with a simple to implement one:
-
Make a variable on your GameMode that holds the last door visited. (Actor LastDoorVisited)
-
On your door blueprint, add a BoxCollision component and add a OnComponentBeginOverlap event to it.
-
Following that event: get the GameMode reference, cast it to your GameMode class and set your LastDoorVisited using the reference to the current door (using Self).
-
Inside your AI, get the GameMode reference, cast it to your GameMode class and just get your LastDoorVisited reference.