In some case I want to restart a player at a specific player start. So I use the node “Restart Player at PlayerStart”.
But if the player is a client it did not work. If the player is a listen server it works. I don’t get it, because I do it in GameMode and the node is a GameMode function, so I don’t know what I am doing wrong.
The “New Player” connection from the restart function is a controller from a controller array. I store all controllers in that array through the EventOnPostLogin Event.
IT LOOKS LIKE YOU HAVE TO FEED IT A PLAYER START THAT YOU CAN CREATE BY RIGHT CLICKING IN THE CONTENT BROWSER , SCROLLING TO THE PLACE WHERE YOU TYPE
AND THEN SEARCHING FOR IT
AND ALSO, IF YOU DO THE REALLY COMMON WAY OF ASKING YOUR PLAYER CONTROLLER TO ASK THE GAME MODE TO SPAWN THE PLAYER , GRAB “SELF” OR “THIS” IN PC AND PASS IT INTO GAME MODE, THAT WILL BE USEFUL TO TELL THE GM WHICH PLAYER TO SPAWN
player start is not the problem. like i said. everything works in singleplayer/if i play as listen server. the problem is when i play as client.
thx for understanding.
I don’t typically use these functions, but I was curious and did a bit of poking around to see what I could find; hopefully this helps, for what it’s worth.
If this is being initiated from outside of the game mode, this will need to occur on the server as it won’t fire directly from the client as the game mode is null.
Event from client -> Event that runs on server -> Get Game Mode -> Restart Player at PlayerStart
Though you mentioned calling it from the game mode itself, so that bit of info may be irrelevant as it will be running on the server already.
When the Restart Player at PlayerStart is called, the Event Init Start Spot in the Game Mode needed to be hooked up to set the controlled pawn’s location to the location of the Start Spot provided; else it basically did nothing with the information. Though you probably already have code for setting up a new pawn and all that, since you said it worked when done on the server.
Updated the Init Start Spot in the Game Mode (this just moves the existing controlled pawn).
If you want the exact spot ( Player Start ), then you need to create an array of spawn points. Then store which array index was used on the owning controller.
You’ll need to create your own Game Mode spawning system. Then simply pass the Index to the spawning system.