Hello, everyone, and welcome to an issue i’m sure many people doing multiplayer have or will probably soon face.
Basically I’m trying to build a menu system where you save your name to your computer via save file.
Then when you join in a multiplayer game, your player’s name will load, to everyone on the server.
It seems like a simple concept but I’m having a lot of trouble and issues with being able to do this.
This is kinda my second thread about this, because of lack of help and answers for solving this issue.
It would be really nice to have some blueprints, showing how this could be achieved. so that the explanation is easy.
If not, a pointer in the right direction on how this could be done would also be really nice.
(sorry if i’m coming off as demanding, i just think this is a basic thing that should be relatively easy, yet not a lot of info on how it’s done at least that i’ve seen.)
please and thank you , cheers!
Please wait 3-4 days before bumping a post. What have you tried so far that isn’t working, can you post a blueprint? What happens instead of the desired result? Something you can do is make a ‘Name’ variable inside of your character blueprint, and then set then have each player load their name into that variable, and then retrieve that variable to get each player’s name. One important detail might be whether or not you are using an online subsystem, this can simplify things like player names by quite a bit.
Thank you for responding, that was pretty awsome of you so thx.
Sorry, as it stands right now I have have it like so. I will do it in steps.
1: Player types in name to menu, menu saves it to a save game, on the players computer.
2: The player joins a multiplayer game
3: The player load the variable from the save game, into a their variable name version for the character bp
4: the event is launched for multicast event to set text.
I have images below
Put the save info in the player controller. Then cast and set all variables to player character, or wherever you need them, in the level BP on level load.
Many apologies i uploaded the wrong photos the correct photos are up there now. And okay I get to place them in the player controller, but! If i say i start on the level blueprint, how will i know which Character blueprint, goes to which Player controller.
Should i just get all actors of class for the character blueprints, cast to them, say get their controller, and load on their information?
Many apologies i uploaded the wrong photos the correct photos are up there now. And okay I get to place them in the player controller, but! If i say i start on the level blueprint, how will i know which Character blueprint, goes to which Player controller.
Should i just get all actors of class for the character blueprints, cast to them, say get their controller, and load on their information?
Okay heres what i’ve done in steps, and the result after
1: the character controller now loads the data from the save game file.
2: The character controller gets the “Controlled pawn” and casts to the player blueprint and sets all the variables.
3: An event is launched to “Set text” on the character blueprint
The Result:
Both players will in the end have the same name, that the client selected. which is kinda strange. Here are the blueprints.
Pic 1: Is taking place on the player controller.
This took me longer than I’d like to admit to figure out. I do it slightly different but this should work for you. May I ask why so many delays?
Anyway, earlier in the game setup I load the player name from the save and set it in game instance. But you should be able to easily pull from the save game here? Also I save the name to the player state. You could also just as easily save it to your player pawn. Also notice the event replication settings, this is very important. And the String property on the player state is replicated.
Hey thank you so much, for the What seems to look like the solution to the problem. On: Get Player Instance" On how the get game instance, I’m confuzed on what that is supposed to be connected to? Do i connect the “Get game Instance” Connect to the save game? Sorry im just not sure what that get player instance looks like.
PlayerInstance is an interface on game instance to get the players name as a string. You can get your save game here instead of what I’m doing with getting the name from the game instance. That’s all. I literally just store the player name there for easier access later on.
Hey Dj Insert, It’s been a while but I have been trying exactly what you said. This has to do with loading a save game data, onto a server.
1: saves the savegame variables
2: Loads the variables (Name) onto the player controller
3: In the level blueprint, it gets all the player controllers, then gets there “Get pawn owner”
And checks if they are locally controlled and if they are. set the variable of the name in the player blueprint
4: Then launch a multicast event setting the text component that displays the name of each player
However i haven’t been able to do it, right, only clients can see the servers name. I really could use your help, I could provide screenshots if you wanted.
But is there more to it than " Put the save info in the player controller. Then cast and set all variables to player character, or wherever you need them, in the level BP on level load."
Hi there, Thank you for the Info on the “Check Locally COntrolled” I tryed it, however the correct names only display for the server. Like clients can look at the server player and see his name, but thats it. Any more info on how to make the save game info
display the name variable? Please and thanks
I am interested in this as well. I had a similar issue getting doors to work where all clients could see it after the server was told to open said door. I feel it is the same concept but with a string… And actually saving.
I will look at some of my blueprints when I get home and see if I have anything that helps. Until then! Looking forward to more advice. Replication is always a challenge.
Just a tip, if you’re doing multiplayer you do not want the client to be setting any variables as that would lead to them being able to send the server false information.
No progress in this post why do we keep posts with no solutions up that waste time of us trying to find answers please delete posts that Google brings up that have no answers just wasting our time