x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Pawn doesnt spawn to client multiplayer

Hello everybody.

I am making a multiplayer game and i have the next problem. When I execute two instances, the server instance creates the pawn and I can control it, but when is the turn of the client, the server doesnt spawn a pawn and I cant play with the client, I only can use an spectator pawn in the client.

Here a bit of screenshots:

Event OnPostLogin: alt text

Event ClientPostLogin alt text

Event SpawnPlayer alt text alt text

Anyone knows why I cant spawn and play with the client? I execute all in the editor on a new windows with two instances. I changed the Engine.ini for the multiplayer and all is on LAN.

Thanks for your time

Product Version: UE 4.19
Tags:
postloginevenet.png (123.1 kB)
clientpostlogin.png (104.4 kB)
spawnplayer1.png (244.2 kB)
spawnplayer2.png (274.7 kB)
more ▼

asked Apr 20 '18 at 02:35 PM in Blueprint Scripting

avatar image

Bahamut1892
22 2 4 10

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Using "GetGameMode" client-side won't work since GameMode only exist server-side so afaik SpawnPlayer would never be called from the Client to the Server. You need to make a "RunOnServer" event in the PlayerController where you make the switch from client-side to server-side and then call the SpawnPlayer function in GameMode.

more ▼

answered Apr 20 '18 at 05:35 PM

avatar image

GarnerP57
466 1 4 6

avatar image Bahamut1892 Apr 20 '18 at 06:19 PM

I am afraid that I dont understand you. I Understand the gamemode idea in the client side, but i dont know how can I make the switch.

avatar image GarnerP57 Apr 20 '18 at 06:31 PM

The ClientPostLogin event you have is set to "Executs on Owning Client" so from there on you know you are client-side. Make a new custom event that is "Run On Server" and call it here (client-side). Now you are server-side and can use GameMode to call your server functions.

avatar image Bahamut1892 Apr 20 '18 at 06:43 PM

With Run On Server you means in the Replicates field, dont you? And this new custom event I need to create on client-side in the player controller or in another place?

avatar image GarnerP57 Apr 20 '18 at 08:44 PM

Yes the event has to be set to Replicates "Run on Server" on the playercontroller to continue what you are doing.

avatar image Bahamut1892 Apr 20 '18 at 08:53 PM

At the end changes the ClientPostLogin to Run on server instead of Owning Cliente and it works!

Thanks for your help and I opened another thread with another problem if you want to check it ;)

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question