Player Start Tag

Hey,

First off I know this thing has come up several times here but all the questions I found earlier seems to be focused on a lot more complex issues than I’m trying to solve (multiple players etc). But I might have missed something so I apologize if this has been answered before.

I have a few different levels that I jump in between fully single player, very basic. Basically one is a “hub level” that leads to multiple small levels. In the hub level I will have several doors that just teleports you to a small level for each door.
This all works except the problem that when I go back from ANY of these small maps back to the hub map I will just spawn at a random player start location - I have one player start in each door exit so you’d end up back where you went in essentially.

Now there is this “Player Start Tag” on the player start actor, is there any easy way I can use this to say which player start I want to use? I’m simply manually naming all of these spawns and all I really wish is that there was a “Player Start Tag” input in the “Open Level” function and this would all be super easy…

Thanks!

Phil

Do I understand the problem correctly?

You have a Player Start in each map - but when they have been in the map and left, you want them to return to it in the place they left it?

If that is the case -


For each level, add two variables to the character.
A Boolean to say whether or not they have been there, and a Transform(or Vector).

When they leave a map - set the Boolean saying they were there, and store their current Transform in the associated variable.
On entering a map - check the bool to see if they have been there before, and if so, Set Actor Transform, moving the player to the location saved.

Thank you for the answer, it’s not quite what I mean to do but that is useful information that might very well come in handy for me later (especially if I’m to add some kind of save functionality to spawn you after death for example I’d assume).

I don’t think my description was very clear so I made a quick image of what I currently have set up.
I know all the connections between the maps and the “puzzle maps” will only have one way out of them back to the hub.

So I just want to make sure once you exit “PuzzleMap_01” for example you’ll always end up at the PuzzleSpawn_01 Player Start actor and not random on either of the 3 (which is currently happening)

A [Player Start] is really just a public structure with a Transform, a Text value (the Tag) and a Boolean to state whether it is Enabled or not.
(a couple of other bits that aren’t really used in most cases)

When a character controller is loaded into a map, all existing [Player Start]s are thrown into an array, and a random one is selected - its location taken, and the controller/character placed at that position.


Whether you want to save a transform in the character or get it from the Starts in the map, you will be doing the same thing with the result.
Taking the transform and moving the character to that position in Construct.

(I suggested saving the values because it offers more flexibility, but you can use a [Get All Actors Of Class (Player Start)] and get the location from one of those just as easily)

1 Like

Oh I see, thanks for that reply. I will definitely try what you suggested then saving the player position instead. I believe as you say that could be used in a lot more cases than this one too so!

So I was playing around a bit more with this but I can’t quite wrap my head around how I will make this happen.

So I tried something really simple like just teleporting the player to a set location. I’m having a game instance where I save some other things that work between levels. But this will only teleport me in the first level, then load the new one and default to spawning me on my player spawn point.

I’m probably going all wrong with this but I can’t figure out how to actually override the player start entity in any way in the new level?

I mean right now I’m doing it all in the actual door trigger, I need to do the actual teleport part after the level has been loaded and there load the player transform I stored in my game instance I assume? But where would I do the actual move/teleport of the player?

EDIT:
Actually I got it working now but I put the actual telport part in the level blueprint. That doesn’t seem like the best place as I’d have to do the same thing in every level I create then…

I made a very simple set of 5 maps that save where you exited from and bring you to that point as you enter that map again.

As the character hits the “door” trigger boxes, the map # and a transform facing back into the level from that door is sent to the Game Instance to be saved.

In the Character’s “Construct” (which takes place every time a map is loaded) - it asks the Game Instance if the map has been visited, and if so uses the saved transform for that map to move the player character.

I hope it helps.
Switchstart Project (saved in D:\UE4_Vault)

Thank you so much for taking the time to do that! It is really helpful to see how you set this up. I feel I already understand this a lot better now. It’ll still take some practice to get better and remember these things but having an actual working example to go back to is great!

Again thanks a lot!

what version was this made for, Its sadly not loding up properly on 4.12

It was made in 4.13.1

I’ll install the older version and rebuild.

[Switch Start for 4.12.5][1]

Sorry it took so long - I was stuck using the remote so I just made it all over again.
It will be a little different from the other but uses the same process - saving a location (near the door used) when you exit a map and moving you there when you return to it.