I am working on a project with a battlefield-style respawn system, but I have encountered a problem that I can’t solve. For example, when I select an allied player for my player to respawn next to, my player ends up moving towards another player whom I did not select.
Debug it.
Re-run your test and select the opposite of what you want… e.g. B
If it drops you on the A player then you know its an Identification issue between players in the UI.
Exactly that’s right, I had already noticed this before, the problem is that I haven’t been able to solve it.
What’s in the Choose Spawn Function?
If I enter a For Each Loop and click on just one player, if I have 2 players on the battlefield, both are selected, but this is also a problem, but even more so, my player was born on the wrong player. If I use a get copy I have the slot option, the copy problem is that I do not have a way to correctly identify which player I am selected to obtain a slot value.
I’ll show you
Also, Stop using Get Player Controller
. You need to use Get Controller
.
Where should I replace?
To clean this up and make it a lot easier to work with you need to create a struct of arrays to store squads.
Game State (GM will add/remove players)
Team A { Squad Alpha, Bravo, Charlie, Delta, Echo etc…}
Team B { Squad Alpha, Bravo, Charlie, Delta, Echo etc…}
As players join you need to add them to a Squad. e.g. Team A Bravo
When a player wants to respawn you get the list of squadmates from the GS Team,Squad. I’d assign an enum in the player state to tell the player which team and squad.
You then loop the array for the UI location overlay. The Icon should bind to a variable (struct) that contains a reference to the specific player. Use the player reference to obtain a world transform (capsule component).
Every instance in your project needs to use the Get Controller instead of the Get Player Controller.
OK then, I’ll test it here.
Do you know what the fps multiplayer template V4.1 project is?
I’m using it and working on implementing new codes and resources.
Yes, this project has squad and team formation for A and B and several modes.
I managed to identify the player’s ID by hovering the mouse over the Widget, but the Spawn selection still remains the same.
The widget I use to select players I placed here, I don’t know exactly if the location is correct for this type of spawn.