Download

Project World Location to Widget Position for Server Host

Hey Everybody,

I’m new here, sorry if I got the wrong category to post this. Thanks for contributing in all those other topics, their solution helped me in many cases. However on issue I could not resolve yet is with the following:
I’m making a multiplayer game with a Host and Clients that connect to it. For the aiming rectile I’m using the “Project World Location to Widget Position” to place a marker on the screen of the player:

This works perfectly for the clients, but not for the Host player who is the server. I read that the computer icon means, that this is only working on clients. However, the “create XY widget” and “add to viewport” which also have the computer icon both work on the server player, so I’m a little confused.

I already tried different things:

  • Switch has authority but using the remote node, as expected does not work since it only gets executed on clients
  • Placing the “Project World Location to Widget Position” inside the pawn or the widget itself did not work either
  • The IsLocallyControlled node but does not work either because there only seems to be one instance running on the host that is always locally controlled
  • The IsDedicatedServer node but since its a Host-Client situation it is never true

So my question: Why does this not work and how could I fix it? Is there a way to get a branch off of the server host that represents the host player as a “client”? Or how would I go about workflows that run explicitly on the server only and others that run on the servers player only in a Host-Client setup?

Thanks and have a nice evening,
Laiebi

I just got it working after lot of tries: Problem was that the “GetPlayerController” on the server did not return the player’s controller but the controller of an AI-Pawn that did not have a widget. Therefore it worked for the clients but not for the server. I changed it as follows in case anybody else has the same problem:

Instead of getplayercontroller get a reference to the pawn that the player controlls, get its control and cast it to playercontroller: