I am making an ability for the player to switch to a different character but when I do it on the client it doesn’t do anything. I tried doing a custom event as well but it still failed to do anything, so how would I get the client to switch characters
your clientSwitch needs to be set as a RPC runOnServer. but the rest of your setup doesn’t look good for multiplayer! getController(0) gives you always the server playerController…this is not what you want.
Do you know what I would use instead of the get player controller
I guess the easiest is following: make an Server RPC Event for your PawnSwitch, add it an Input of PlayerControllerReference. On your client pawn you can use getController, this gives you the controller of the pawn from the client, use this as an Input for your PawnSwitch Event. Serverside you can feed that PlayerController into the Possess. that should do the trick.
So are you adding an input to the event that has the input controller. I’ve tried using it but I get an error saying not trying to read the event
I presume the possession is part of the gameplay. You could notify the GameMode to handle the character change.
About Event Dispatchers, if you want them.
I think I seem to understand it now the client can be switched when the server dose it but my problem is that my client can’t get the server to trigger an event server side
I’m pretty sure you could save the switchHasAuthority->authority way and always go the remote, but I’m not 100% sure, this should be the cleaner solution.
Im running this inside of a pawn.
If you get errors like “not owning connection” we need to move that into the controller, but I don’t think so
Thanks, for the info, I ended up figuring out how to do it I
pretty much had to do a 2 step event for the server to switch the client and now it works.
really appreciate your reply,that issue confuse me for three day!! thank you again.