how to get Location of "SpawnLocation" Actor in Blueprint Door(Interact Object)

Hey Guys, hope someone can help me.

I’ve startet with unreal view days ago, now I want to teleport my actor to a specific location in my map (Sublevel House01 -> Entry).

I have a House, after I press A Button standing for his door it load the sublevel (inner House). but I want to place the sublevel in other Location of Persistent world. I dont know if my idea are best practise. For understanding: I work on an a oldschool RPG style game (Secret of Mana, Secret of Evermore for example). I want to load the inner of House if a Player want to go in.

My actual plan is to save the “Spawner” actors location in Gameinstance as Variable, but that would be many Variables (ActorLocator at House Entrance (inner) and before the House(outsite). If I want to implement around 100 Houses I have to save 200 Variables. I think there must be a better solution.

I also want to implement a Multiplayer, with my actual tests and Informations that will be difficult, can someone give me an idea what problems I have to solve?

Here is an Sketch of the System (Levels)

Thanks for Help

Hi,

You can set your Actor’s location with the “SetActorLocation” node. You could place triggers in your level and when the Player overlaps it you teleport it to your desired location.

Are you familiar with using Arrays? You don’t have to create a unique variable for each location, you can add them to an array that can hold many elements of a single variable type.

For the multiplayer part, well, if you are figuring out how to teleport your Player, implementing networking could pose a serious challenge, but who am I to judge your capabilities, here is a tutorial series about netwowking by Epic:
https://www.youtube.com/watch?v=abmzWUWxy1U&list=PLZlv_N0_O1gYqSlbGQVKsRg6fpxWndZqZ

Hey Kontur,

thanks for your reply! Yeah I think with Arrays I can handle this. I did not think about that :).

I have ported my Player, but I can’t access the Actors Location from the Blueprint I used (the interaction) Blueprint.
Are you or someone here familar with Level Building? I don’t know how I should Build the level (best practise). You can compare my Game Concept (Game World) with games like Pokemon, Harvest Moon, Secret of Mana. So for my imagination the Instances for Houses, Dungeons and this things should be own maps. Otherwise I read that Level Streaming are the better Solution. But I’am not sure where in the persistent World should I place the Houses(Inner), Dungeons or such things.

Thanks for help

If you want to access your Player from another class, you need a reference to it. How do you check if the Player has interacted your trigger volume? If you are using “OnOverlap” event, you get a reference to the overlapping actor. You just need to cast that to your Player. If you are not familiar with how casting works in Blueprints, take a look at this:
https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/CastNodes/

You can use Level Streaming, sure! You could load in your interior level (somewhere else, or in place maybe with the roof removed?), then teleport the Player there. You could reverse the process when the Player leaves the area.

OK, I will explain how it does actually work.

Actualy I can’t create Content / Assets by myself. So I have to solve some Problems to get a acceptable solution. Actually I have a Envirement that only have closed houses (a bit to small to place it in place). So I decited to place the RoomLevels somewhere else.

Now I create an Actor “Door” which have a Name Variable for the “Level” thats Linked(for Example Door01 -> “VillageStart_House01”) If Player stand before and Press Action input the Player shot a LineTrace and the the Door Trigger an Interact Event that will Load an FadeInOut Sequence, The Linked Level was Loading. Now I want to Port the Player to the Entrance. My Plan is to Place an “SpawnActor” that is somewhere in the World I wish to Place the House01 “Level” but with my knewledge I cant Cast to the SpawnActor(in the House) from the Door01 Actor, I don’t know how I can access the SpawnActor from the Door01 Actor.

Because of this I have the Idea to collect all SpawnActor Locations at the begin of Game in GameInstance (now as Array) to get Access of the Location. This Work well but I didn’t want to make it more complex as it should be.

Hope you understand my construction :). Maybe I can send a Screenshoot or Sketch.

Thanks for your Help!

Okay, now I am a little bit confused. Are you using persistent levels for your world and your rooms, or you have the world as a persistent one with the rooms as sublevels?
If each of your levels are persistent, use the GameInsance class to pass data between levels, as all other classes get reinitialized after a new level is loaded. On your Player, mark your variables ‘Editable’ and ‘ExposeOnSpawn’ that you want to set when a new Player is spawned. With this, when you spawn your player, you will see your exposed variables on the node, use the data stored in the GameInstance to pass it to your newly spawned Player.I hope this helps.

Hey Kontur,

I want to give you a a impression of what I do or what I want to do :).

&feature=youtu.be

My goal is it to create a persistent world that was splittet into Sublevels (Overworld) I don’t want to go in Houses directly, If you stand before the door and Press the A Button. The Indoor Sublevel should be Loadet and the Player should be portet. Because I want to do this in a sublevel that I create in the Persistent World I need a Teleporter(You see this Actors in Screenshots) for the Location in the Sublevel(for Example Indoor House) and I need a Teleporter before the House, Entrance.

In the Video the “Indoor” Level is a Town :).

Actually I do this:

Game Instance have a Array of Vectors for Holding the Spawner Locations (in this example House01 Entrance, House 01 Indoor).
When Game launch the GameInstance get the Spawner.

The Doors you can see are also Blueprints and they of a “DoorID” (this ID was used for Porting (the ID is the Index of the Array)) if a Trace hit them the Actor will be ported to SpawnerLocation with the ID.
This works now, I don’t know if the actual solution is “legal”. In the Next step I want to add a Name Variable to Door so I can enter the DestinationID and the Name of the Sublevel that should be loadet.

Here is a Example how I want to handle Inhouse Scenes: SNES Longplay [214] Secret of Mana (2p) (part 1 of 8) - YouTube (Secret of Mana) if the player go in Houses, the House level should be load. The same things for Other areas of game or dungeons.

I want that this also works with Multiplayer, but this is the next big thing I want to research ;).

For Level Design thinking a have the problem that I don’t know where I can Place the Indoor Levels. If I place all Sublevels (Overworld and Houses, Dungeons…) in the PersistentWorld I think its a bit chaotic.

Maybe now you can see what I do / want to do.
**
EDIT**

I’ve tested a bit with Local Multiplayer, actually I do the port with the “get player pawn” function (here the standard player index is 0). I tryed many things but I didn’t find a solution that here the bluescript takes the actually player Index. The Port doesn’t work with Player 2, only with Player 1. Can someone explain this to me?

Thanks for your patience and your help :slight_smile:

Hi,
Well, you are pretty close, as you have an already decently working solution.

Now that is clear that you are using sublevels, I can suggest you that you don’t have to use the GameInstance class for this, because your presistent level never gets unloaded (only the sublevels), therefor your data in all other classes (like PlayerState, GameState) are safe as well. Of course, there is nothing wrong at all with using it, it is just you don’t need the extra functionalities for what you want to achieve.

Multiplayer is another consideration, keep in mind that only clients have a GameInstance, the server has no information about it, so it won’t be able to retrieve the stored location values when the player gets teleported. I would suggest using the GameMode, or rather the GameState class for keeping track of the locations (both are owned by server, but GameState can be replicated to clients).

For handling the teleportation itself, I would personally use an ActorComponent with a BoxCollision and the teleportation logic in it. I could then add this component to my DoorBP, or later to any other BP that I want to have teleportation functionality.
Make sure, that in case of a multiplayer game, you only execute the teleportation logic on the server (with a SwitchHasAuthority node), and that the player’s position is replicated (and as I mentioned, the location data must be accessible for the server, which is not in GameInstance).

Hey Thanks for Reply,

I’am saving the “SpawnActor” locations in GameInstance Vector Array because I was not able to get the distance “SpawnActor” location from the DoorBP (actually in this are the Teleport Logic). With the actually logic I like the use of the “Door Teleporter” because I can set the destination SubLevel and the “SpawnActor” ID and than the Player was port to this location and the Sublevel will be loadet (If it is already loadet).

For Teleport handling: So I should create a Actor with Teleport Logic (actually in Door Blueprint) and I should add this as ActorComponent with BoxCollision to my Door BP?

Ah Ok, in the next days I will take a look of your linked multiplayer tutorial (Steam). I think the LocalMultiplayer isn’t the ideal test for my Multiplayer things.

Thanks for Help :slight_smile:

Hey,

I’am done with the Multiplayer Tutorial (Blueprint Multiplayer: Project Overview | 01 | v4.11 Tutorial Series | Unreal Engine - YouTube).

I’ve learned alot from this, not only about Networking, also new functions to get solution for my problems here. So thanks to Kontur for help!

Now I expand this tutorial to for my actually Project. I think at this moment my actually Problem is solved.

Best Regards!

Hi,

I am glad that I could help! Best of luck with your game! :slight_smile: