How can I use a portal to travel to specific locations in the new level?

I work on it all day. I didn’t understand it until now.

Okay, I suspect that it makes no difference whether I work with a blueprint_actor(portal_x) or with the trigger_volume in the level_blueprint. Is this correct?

(A + B) Here are two screenshots :


(C) And here is my GameMode = same like your last picture:


What is the beginning point? “Event BeginPlay” ? Where is your wire starting?

(D) And here is my GameInstance again:


In my GameInstance the only thing is the Vector_Variable. But I don’t need this when I try the solution from your last two pictures. Is this correct?

What am I doing wrong?

I suspect that it makes no difference whether I work with a blueprint_actor(portal_x) or with the trigger_volume

No difference.

Options are passed as: key1=value1?key=value2?key3=value3 and so on.
In your case, since you just need to pass a hard coded vector you can just do it like:

So screenshoot A or B, you don’t need the Append node, Just write the the options directly in the node.

In Screenshoot C, since the first thing you want to do is to move your character to the right location, connect the BeginPlay to Set Actor Location.
The select node that I used is required since I didn’t pass any options for the first level (when you start the game) and I didn’t placed any Player Start. Without the select node, the player starts at (0,0,0).
In you case, for example, you can place a Player Start node where you want the player to start the game and then:

So, now the player starts the game (level 1) at the location you want, and for the rest of the levels, the player will start where the options in Open Level tells the game mode to.

PS: If you pass the value thought the options, then you don’t need to use Game instance for this.

PS: this method works, but like I said before, a more correct approach is where you spawn directly where you want. But that’s not required for now. The important is to have something working.

(first: I mixed up your second pictures regarding screenshot C with the cable)

I’m almost giving up. Although I understood some information and it is very helpful. But nothing works here. At first it worked (with the hard coded vector): Destination_Level worked with the correct location.

Then I copied the TriggerVolume like in this screenshot:

The TriggerVolume2 then took me to 0,0,0 in the Destination_Level instead of my coordinates.

But now the TriggerVolume1 also no longer worked with the correct location. Again it’s 0,0,0.

AND player start no longer worked in level 1 when pressing play in Editor.

Then I restarted UE5.

Changing levels works well. But the location doesn’t work.

place some print strings in the game mode:

and check where it fails.

on the 1º level should print:
X=0.000 Y=0.000 Z=0.000 (or the coordinates of the Start Player if you placed one)
NO VALID OPTIONS

on the 2º level should print (diferent numbers for you):
?location=X=1149.388 Y=2050.013 Z=350.049
X=1149.388 Y=2050.013 Z=350.049

If still fails, then we move from the options to the game instance. If that fails, then we move to override the “Chose Player Start” from the game mode. Some method should work.

Level1:
Level1

Level2 (after TriggerVolume):
Level2_Destination

The Player is starting at PlayerStart but it says X=0.000 Y=0.000 Z=0.000
When I place the PlayerStart on another place then it also says X=0.000 Y=0.000 Z=0.000

When I start without PlayerStart then the Player starts at the place in the viewport.

Is the code for this part in your game mode exactly like the one I show you?
If it’s and is not working then something must be off at some place else.


Anyway, let’s move to the game instance method and forget the options method, that like @Dejan33 said, it’s the simplest.

  1. create a game instance with a vector variable (you already did it that, right?) and set its initial value the coordinates of the character in the first level.

  2. select the game instance in the project settings:

  1. in your portal BP:

  1. in your game mode:

Now I’ve made several attempts for some time and at the moment the first solution suddenly works. I don’t know what it was. I think I changed the key “start” to “location” in “ParseOption”. But it’s not 100% sure yet.

But recently I also tried your second solution.

I’ll probably get back to you soon…

The next step, would be to spawn your character directly where you want, but that can wait. The important is to move forward.

I now also finished the second solution. There are no print string messages.

I tried both variants with three different levels and TriggerBoxes/Portals in all levels.

So far I don’t see any problems. This feels really good.

Thank you so much GoodCleric. I learned something here again during the two days from Dejan33 and you.

There was no place on the internet where I found any of the solutions understandable. This is a main element of my game. Now I’ll build on that.

And here I have an additional question: I want to rotate the character in the right direction when he enters the new level.

Here a screenshot:

Is “Set Actor Rotator” the correct way?

you can also pass the rotation either in the options or in the game instance and then use Set Actor Rotation.

if you are using game instance, create another variable, character_rotation and set the rotation you want for the next level.

portal:

game mode:

PS: things are starting to get complex. The override of the “Choose player start” method is looking more and more appealing.

I tried it almost the complete day :sweat_smile:

I don’t know what I am doing wrong. There is not much to do:


I don’t understand where the association/connection from the variable “character rotation” regarding the PlayerCharacter is (in the first image).

So I added a “Set Actor Rotation” because I can put the wire into my “cast to BP_CharacterBase”:

But it’s not working, it has no effect. Doesn’t matter what value I type in. Also tried all possible places I can type in something into the rotation.

Yes, that’s true. At the moment I must type the Coordinates into the GameInstance to start a specific level, because PlayFromHere isn’t working. But it’s managable.

1 Like

First image: the rotation you set is the one you want to character to have when the next level starts.

Second image: remove the set actor rotation node. That should go to the game mode, where you use Set Actor Location. You just need to add the Set Actor Rotation after that one.

In any case, I will show you how to use the “Choose player start” method. Just give me a sec.

1 Like
  1. set the all the Player Start you need in each level. Set their location and respective rotation. Also set their “Start Player Tag” for individual identification:

  1. In the game instance, create a variable of type NAME:

  1. in your portal BP, you set the name of tag of the Player Start you want your character to spawn at:

  1. in your game mode, override the function “Choose Player Start”:

and implement your own function:

If a respective Player Start actor is not found, then the game mode will randomly select one. If there is no Player Start actors in the level, then the player will start at the origin.

Ahh okay, I for what ever reasons thought that picture 2 regards to the other option with TriggerBox :sweat_smile:

Yes, now it’s almost working. But “z” is not working. Only x and y is working and I don’t no why.

Okay, at first I didn’t understand what you mean. It’s another method.

I completed this method minutes ago but there are no differences. Player starts at location from the location-varbiable in Game_Instance.

In my level2 I placed the PlayerStart’s in front of both doors and gave them a tag. But nothing happened.

show me the BPs for your portal, gameinstance and gameplay.

If you’re using the override method, then game instance shouldn’t even have a location variable.
And what do you mean, “nothing happened”?
Also, are you sure you use the Player Start Tag and not the Actor Tag?

Portal:


Game Instance:

Game Mode:

With “nothing happened” I mean that Player is not atsarting at the PlayerStart with the Tag. Player starts at the location-variable-coordinates. But the tag-system is not working at the moment.