How can I move a character between one level and another?

I’m looking to create a world that consists of separate levels – for example, if I wanted to have a town and three dungeons that can be accessed by walking out of the town at their respective entries. Each dungeon is its own level, and the same would go for the town. I hope to set up schedules for some of the characters in the town, and I want them to go into the dungeons on different days and at certain times.

It would essentially look as if the character disappears off the screen as they exit the town, as can be seen in many games.

The issue is, I can’t find anything on moving an actor between one level and another; can this be done? If so, how, and if absolutely not, are there any other alternatives that could yield the same effect?

1 Like

Actually, to make it less obscure-- let’s just say I want an NPC to go into a house, which would be its own level. So they go through the door and disappear into the house’s level, and are later scheduled to leave that house back into the town, and so on. Essentially that.

You didn’t mention whether your game is multiplayer or not. If it is, what you are looking for is a way to run multiple UE4 server instances and have them be able to communicate with each other.

There are two ways that UE4 instances can communicate with each other.

  1. The UE4 server instances can be pointed to another non-UE4 server that sends messages to the UE4 server instances telling them what to do. In this case when your NPC leaves one map it would send a command to this management server to tell it that it is transferring to another map. Then the management server would send a message to the new map server and it would spawn the NPC there.

  2. UE4 server instances can also directly communicate with each other using the built in TCP/IP messaging in UE4. Implementing this will require some custom C++. It would work similar to the above method where you send messages back and forth, but in this case the message would be sent directly from one UE4 server instance to another. In this setup you may still need a third management server that sits on top of the UE4 server instances to keep track of the IP’s and ports of all of the running UE4 instances.

I have used both of these methods and they both have their pros and cons. It just depends on what exactly you are trying to do.

If this is just for a single player game, then you can fake all of it just by hiding and showing characters in different maps and storing their state in an object that doesn’t get destroyed and recreated when you open a new map. You are able to fake it because your player can only see one map at a time, so there is no need to actually have an NPC exist on a map that isn’t currently running.

Agh, sorry for the lack of specification: it’s a single player game. Yeah, I figured I could fake it somehow, just need to figure out how I’ll tell NPCs to update their schedules when you would enter one of those other levels. Thank you for your help, I appreciate you covering the multiplayer option as well, as I’ve been taking interest learning that area of the engine, anyway.