Is there anyway to possess an actor through a widget, or will i have do something else. I’m guessing it isn’t possible, cause from what i see the possess node is server only.
Side note : The spawning of actor does work, and is it replicated on the other clients and the server, and i did see on some other forum posts while searching for an answer to this problem, that some of the posts showing their blueprint had a posses node that wasn’t server only, i’m guessing that’s because the possess node isn’t in a widget.
If for some reason it isn’t possible to directly put on the Wdiget’s graph then just make an even on your controller and call it there. But, I’m not aware of any reason it’s not available to call on the Widget unless it is a bug.
The reason is, because it’s not the Widget that is possessing, it is the controller.
You need to make event in your player controller (because it owns umg hud and its easy to access it from umg).
In widget you get owning player controller reference, call that event.
In player controller do Remote Procedure Call (RPC event) or “run on server event”, call that event from client side of player controller to server side of it.
Now server side COPY of your player controller should know you want posses something.
With that working send that request over to some blueprint that is your “gameplay logic engine”, i picked gameInstance for all that logic in my game.
And posses pawn from server side of that blueprint.
References to actors will not work while passed from client to server or from client to client, because client is actually on different computer than server, its confusing but parts of code that look like they are in same graph and same blueprint in fact are on different computers. So you must identify pawns in some other way than references. I keep integer index for them when i spawn them, integer is long enough to not worry with old unused anymore indexes, when i spawn i always do ++1 to last index.
There is built in index for players etc, but for some reason this never worked for me in multiplayer.
So i did the Run On Server event on my customPlayerController, but the thing is the possess node is still server only. Did i forget something or? Could you try to explain with screenshots of it in blueprints
I’ve searched and read each forum post on how to possess a pawn, but either it’s dated back to 2014 or not the solution i’m looknig for. I swear to the love of i don’t know what, that i will sacrifice my first born if someone helps me find a solution on how to possess a pawn as a client. I’m pretty much stuck developing my game as far as this problem exists.
Maybe it’s terminology That’s mixed up causing the confusion in answers… What are you trying to do over all. Example… I want a player to join a match as spectator and then spawn, or I want to swap control with a AI and move him around then swap out etc…
Well from what I gathered on my own research of trying to make basically a team select by using spectator. Spectator can’t call server commands. Least not through bp. And clients always spawn as thier own pawn they can’t share one though you can call events to influence one, but you are still your own pawn when doing this even if it’s just a camera.
You may want to create a pawn class that acts like a spectator that is default then use widgets to change it.
You’d be basically changing pawn class and respawn as it. But don’t use an actual spectator because you can’t call to server to replicate it.
Does anyone have a forum post, guide or any sort of help on how to possess a pawn as a client? As stated earlier in one of my comments, i’m pretty much stuck developing my game as far as this problem exists. Any help guiding me towards a solution is appreciated!