Download

Choose Player Start isn't working

Hey all, never gotten a response on here so you know I’m desperate to post again. I’m making a 1v1 duel game mode and am currently trying to get the players assigned teams and spawn points. Inside my gamemode BP I’m overriding choose player start, in there I assign the player a team and find that player an appropriate team based spawn point. The issue is that doesnt do anything despite ChoosePlayerStart returning the correct player start that I wish for that player to spawn at. Any idea as to what is going on? I can change the team numbers in single player and it works just fine. Typically that is a replication issue but all data here is handled on the gamemode, the player state has 1 integer that is replicated and set by the gamemode. If you’ve gotten this far thanks for reading. In 5 years I havent gotten a single bit of help so I really appreciate the time.

Here are screenshots of my BP:

You could use the PlayerStart->PlayerStartTag (not to be confused with Actor or Component Tags) and Tag them “Team1” “Team2” etc. and find the tagged PlayerStart for the team like this.

Thanks for your response. Unfortunately using tags was my original implementation and going with the team ID integer is not the source of the problem. Both server and client get through with valid data, then nothing happens with it. I tried the Restart Player at Player Start Node as that was new to me, still the same issue.

Tom Shannon and others had a go addressing this ages ago… There were working solutions… Can I ask a dumb question for a sec? Why not just use text / note actors or other incidental actors (hidden meshes w/o collision), and tag them as spawn points in the level. Then grab them at runtime using GetAllActorsWithTag to create an array in Gamemode. Then have the server manage the spawning manually (removing entries from a copy of the array if necessary)… Am I missing something?

So the problem is that the Pawn is never spawned? Have you tried setting the Pawn->SpawnCollisionHandlingMethod to “AlwaysSpawn” ?

I will try using a custom actor other than player start, as for the article everything mentioned is already being/been covered.

No they spawn, just always on top of each other despite receiving separate player starts.

So I’ve rewritten the logic a few times now. To clarify, I am not struggling with what the process of spawning a player is, it’s fairly trivial. The show the issue better I’ve taken some new shots of my current logic to show that the players get different spawns and simply don’t go to them.

Player 0, added to team 0, getting the team 0 spawn: Screenshot - 70db5cea3d296505d91d60d1735c3d9b - Gyazo

Player 1, added to team 1, getting the team 1 spawn: Screenshot - 3e063645d7a3253a3474f451f246b6fb - Gyazo

The player controller possessing the actor after it has been spawned at the location of the playerstart: Screenshot - 08911ad87664ff290a7e96d823b83c40 - Gyazo

Both players at the Team0 spawn: Screenshot - e81e54e9626a5ec2e524a691bd61bcb5 - Gyazo

Strange. The AssignToPlayer function doesn’t make much sense since GameMode is not replicated so trying to call an RPC on it is pointless. You also made StartRef replicated which also is pointless again because GameMode is not Replicated it is only on the server.

Tip: when you loop through an array to find something to return you can just return the item right where you are setting the “StartRef”. Then you don’t have to break the loop.

I wanted to make sure that it wasn’t my character class, so i swapped it out with the ThirdPersonCharacter: Screenshot - fae2d1e4a1ff19caa81c4deefce54e3c - Gyazo

Well when you have a program that simply doesn’t do it’s job, you grow paranoid. As stated in the OP I’m aware of where the “code” exists, there are a few redundancies, none affecting the outcome. As for the break, I like the visual explicitness of branching off of break.

Yes when you get stuck you resort to all sorts of solutions… I’ve been there. I tend to do things like they are done in C++ and there you would just return as soon as possible.

How do you assign the PlayerStarts to the Array?
Watching values in Blueprint are not as reliable as one might hope… I tend to rely on PrintString more than Watches.

I’m removing the print strings for readability before I screenshot. They truly are the best way to debug.

Here is the Playerstarts assignment: Screenshot - 7673003d8d5476098189f2693b21a500 - Gyazo

Here is the player team assignment: Screenshot - c92c1c69a4670a958d8eaa6f48ba9ec7 - Gyazo

Well it looks fine. You don’t have any characters placed in the map already that gets picked up on BeginPlay?

Have you tried using the Blueprint Debugger and follow the call-stack to see if events are triggered out of order?

I deleted the gamemode and player state and started over, works fine now so either something bugged out during the creation or there was some erroneous code somewhere that i wasn’t finding in the call stack.
Team 0 spawn, with team 0 player: Screenshot - e51aafca96e08521968ac5f5d5ec8243 - Gyazo
Team 1 spawn, with team 1 player: Screenshot - 626fe4fcd466dba7ef84a278afcadfef - Gyazo

Thanks for the input, helps with the mental state to go over things!

I’m happy you solved it… very strange indeed what the actual problem was.