I’m fairly new to Unreal and trying to control where the player starts in the level. In my level I have two PlayerStart actors: PlayerStart and PlayerStart2.
What I want is to make the game always start the player at PlayerStart2, which I tagged as “MainStart”.
What I did is create a custom GameMode Blueprint called BP_CustomGameMode. Inside that Blueprint, I overrode the ChoosePlayerStart function. I set up the logic to loop through all PlayerStart actors, check for one with the tag “MainStart”, and return it. If none matched, it returns the first PlayerStart it finds. Then compiled without issues.
I then set the World Settings to use BP_CustomGameMode under Game Mode Override.
When I run t still doesn’t work. The player doesn’t spawn at PlayerStart2 , worse it spawns somewhere random just floating or falling off the map. ( My Playerstart isnt in that location I already checked that and can confirm it.)
So to warp it guys, these are the verifications I double-checked:
The tag on PlayerStart2 is exactly “MainStart”
It’s positioned above the ground and the arrow is facing up
No compile errors in the Blueprint
I’m stuck and can’t figure out what’s wrong. If anyone knows what Im missing or what else I should check, please let me know.
I did some testing and both “Choose Player Start” and “Find Player Start” are not reliable for what you’re trying to achieve. Find Player Start always fires first, but the problem being it’s always firing twice, one when controller is spawned (game start) and shortly after it’s run again (I believe by game mode), which is what breaks it.
You can verify it by adding a print string on Find Player Start (it will always fire before Choose Player Start".
I tried a few things to force it to spawn consistently at one of the two, but it refused to do so.
I’m not sure what is your end goal here, because from what you have described you would always spawn at MainStart every time.
A work around would be using a single player start, because it will probably spawn somewhere anyway, then having a dedicated blueprint class with your actual desired spawn points. You could then do some logic to choose which one you want to use and move your player there.
Screenshots you have provided don’t make much sense, half of the things are not connected at all, plus you have a return node inside a loop body (but it’s not actually connected to anything, so it doesn’t matter).
If you want something to be executed you need to connect execution line (the white line).
I use a custom actor class for spawning. Simple Actor with a box collision.
In the GM’s Begin Play I get all actors of class (BP_SpawnVolume) which outputs an array. I store the result in a variable.
In the GM’s settings I have the Default Pawn as a simple custom pawn class. When the client has loaded the map and other assets the loader pawn RPC’s the controller which calls the GM to spawn the actual character.
GM spawn character function grabs the array and chooses which spawn point to use. Then it destroys the loader pawn, spawns the character at the spawner location, and possesses the new pawn.
The Loading Pawns spawn location uses the GM’s default functions. I don’t actually care where it spawns because I use a loading screen to block the view of the camera. What I do care about is where the main character is loaded. So I use the above.
Main reason for this process is that characters (pawns) are spawned instantly on server join. Maps do not load instantly in a packaged game once you connect. The issue here is your pawn will fall through the map if you don’t override the character classes default behavior… movement mode = walk.
If you do override you have to use conditional logic and RPC’s to revert when ready. The above process is easier with less hackiness.
BP_LobbySpawnPoint (Actor)
Place Actor in the level then set its Spawn Order int variable to correspond with which client you want to spawn there… 1, 2, 3 etc
Thank @Rev0verDrive for all the info. there’s a lot for me to unpack there so i will need some time to go through everything slowly and try to grasp it. i’m still pretty new so i don’t fully see the whole picture yet, but i’ll let it all process. thanks again man.
@DonBusso thanks a lot for your detailed reply too really and sorry if the nodes in the screenshot are messy i’m still learning how this all works when i tried to override the ChoosePlayerStart function it gave me two nodes by default one was ChoosePlayerStart and the other was ReturnNode so i thought i will try some logic where i get all actors of class PlayerStart check if they have a tag called MainStart and if they do then return that one. that’s what i was trying to show in the image maybe it doesn’t work the way i imagined it the idea was starting from ChoosePlayerStart then get all actors of class then loop through them check for the tag and if true return that actor i thought the white lines were the execution flow and the blue one was sending the return value back if i got something wrong or didn’t wire it properly thank you for pointing it out i’m just trying to understand how to make this work right and btw any advice on how to clean it up or do it better is super helpful to me.