I want to travel between different rooms like in Resident Evil 1. But for that I need a function for the location in the new level. How can I add the location to my blueprint?
Here’s a first attempt. But it doesn’t work because I don’t know what I’m doing
You can also override the “Choose player start” in the game mode.
PS: note that I used “TargetPoint” as an example to get a location and it works because I’m opening the same map I’m already in. In your case, you will probably get the location using some other mean. For example, passing a tag or name of some actor present in the next level (or a hard coded location).
Hello and thanks, that looks very promising to me. But I don’t fully understand it.
Are the two images two different solutions? I inserted a TriggerVolume into my first map and then created the same as your first image into the LevelBlueprint of the firt Level/Map. Then I tried to understand what you said about the TargetPoint. I don’t understand what to use instead of the TargetPoint. I tried using different meshes and blueprint actors but nothing works. My character starts at the player start or in another location (when deleting the player start).
The 2nd picture I also tried to build in my gamemode. I connected it to EventBeginPlay. But I don’t know how to create the node between SetActorLoc and ParseOption. Maybe 2nd picture is for the tag-system?
AND: In my gamemmode there is no “Spawn Default Pawn at Transform”
You can not do anything after you execute open level. Because new level loads and this blueprint is no longer there.
If you want to set your characters location in a new level, you have to do that it in the level you opened.
Make game instance
2.make that game instance your projects game instance(in project settings - project - maps and modes).
3.in that game instance make variable “character_location”(vector type).
In portal blueprint before you open new level - set character_location variable (you will need to refrence the game instance with “get game instance” and cast to your created game instance), then execute 0.3 delay and than execute open level.
in the level blueprints (that you are teleporting) on event beginplay - refrence to your character_location variable (from game instance) and set your characters location in that level.
There are other ways as mentioned, but this is the simplest.
The 2 images are for the same solution. Never mind the trigger. What’s important is the options that you add to your “open level”. The options consist of string made of keys and values: “key=value”.
So, you can pass whatever you want: a location, a tag, a name, …
In the example above, I simple passed a location of an actor in my current level, but you can hard code a location directly.
As for the node between parse options and set actor loc, you just need to take a wire from parse options and chose “convert string to vector” (i didn’t use the output boolean but you should, since it indicates that the conversion was sucesseful).
As for the “Choose player start”, is better to forget that for now.
Note that the easiest way is to use game instance (or whatever system you’re using to keep data between levels, like score and health) instead of the options. Game instance is a global object that is acessible everywhere.
But it’s not working. Character is not even changing level but teleporting to an unspicific location in the start level. Don’t know what I am doing wrong.
It should teleport you to location 0,0,0 in the destination level.
If the new level (destination level)doesn’t open, try removing the delay.
Also you have demonstration level and destination level. Which is it?
You are opening demonstration level instead of destination level.
Okay, it was 0,0,0 where I teleported to. Didn’t realize I can change the value there because details were grayed out. This is working now, but not not the level-switching.
I tried it with deleting the delay. Also I placed the loc_variable behind open level. Both make no difference.
(I changed the name of the level. I added a sentence below the screenshot after you already read it. )
Ok, make sure the level name is exactly as the level you want to open. Never execute anything after open level(as mentioned before).
Try opening the level without anything between. Just overlap and open level.
Yes, each room is a level. The rooms are not very big.
Yes, exactly. The portals are doors. Like in Resident Evil 1. If player walks through one door in level X then he must come out in front of the correct door in level Y.
I assume the game will have approximately 20 main rooms. You go from room to room. Every room has at least 2 doors. Entry and Exit. Player can go forward or backwards in the game every time. From time to time there are up to 4 doors per room, because here and there you have some tasks and you must find a way. But all in all it’s a straight row.
One reason I want to have a portal system with different levels (besides a Resi1 style game) is performance, since I primarily work with brush boxes. The alternative would be a large map with level streaming and classic teleporters within the map for the doors.
However, my knowledge is so limited that I don’t know which system I should use. I thought it would be extremely easy to connect two doors in two levels.
Either pass the next location through the options (exemple above) or through the game instance.
PS: it would be better for the game mode to spawn the player directly where you want, instead of spawn and then move the character. But for now, this way works.