Keeping track of story progression in a single scene

I am currently porting a game over from Unity to UE4. It has been going very smoothly for the most part, but there are some issues I am having especially regarding referencing actors that are in the level.

This game is going to take place all in one scene, with story happening over the course of ~3 or so hours. This means I need to set up the actors in various locations in the scene depending on where the game is currently at in the story. For instance, when the player first starts, in something I will call scene_1, actor A should be placed at location X and should say Y when the player speaks to him, and actor B should be placed at location Z and shouldn’t say anything when the player tries to speak to him. In Unity, what I had was a class called “PlotManager”, that would store a reference to the current “Scene” (another defined file), and the scene would have specific information to set up all of the actors. When a scene started, its code could be read and it would take its list of actors and put them where I specified. This method had the added benefit that when the game was saved, all that needed to be run to set it up was to find the current “Scene” reference and set the actors up in the right places.

The problem with this in UE is that I cannot seem to have all of these scenes on the same level. It doesn’t seem to be possible to reference actors that are in the level from anywhere except on the level blueprint. For obvious reasons I don’t want to put the entire game on the level blueprint.

What is the general solution for this in the Unreal engine? And, in general, keeping track of current actors in a scene and what they should be up to? For instance, a town in an RPG might have Y set of characters at one point and X set at another point, based on the current part of the game. Probably there are not a new level built for each version of the town with characters. So what is the standard way to know the current part of the game and have actors have the correct state because of it?

Thanks

Great tips and tricks and many many thanks for this

You could assign each actor an integer variable used as an ID, then run a loop through the actors, matching the ID, and use this as the reference to the actor.
When you create the level with the part in, when you drag an actor out, you give this a unique “ID”. Then you should be able to seperate them from one another.

You’ll be happy to know that’s not the case, you can actually reference actors in individual blueprints, they don’t have to be in the level BP. In fact, I barely use level BPs, I usually compartmentalize all my classes into more modular BPs. Funny enough I was up last night till almost 4am creating a couple dev diary videos of how I did something similar to what you’re doing. I’m currently in the process of creating a game that is used for training UE4 students online, and this week I’ve been hammering away at the mission system. The videos aren’t online yet, but should be in a day or two. If you want to catch up with the previous episodes you can catch them here: https://www.youtube.com/watch?v=DM4-R8fy274&list=PLyFu07ZGRLMRIlns7QhSkxen9Dfk1WYOv

So the way I approach this is pretty simple:

  • I created a mission manager BP class which doesn’t really do much except to communicate with “objectives” and manage those objectives

  • I created a second asset, an objective class component, this guy does most of the work. It talks to the mission manager and tells it when that objective is completed, how much progress is made, if the player has found easter eggs, bonuses, etc

  • I then added this objective component to all of my interactive objects, i.e. doors, characters, weapons, pickups, tools, keys- pretty much anything I want. The objective component takes over all the heavy lifting from there and does its thing, meanwhile LDs can focus on making cool missions, objectives, puzzles, etc.

I don’t use the level BP for any of the mission manager or objective logic; that’s all handles in custom parent classes based off UActor.