Is it possible to possess an Actor through a widget?

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. :confused:

bump

Does anyone know if this is possible?

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.

Ps.
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

Posses node is and will be always server only, only server can manage players.
So you need to tell server that you want posses some pawn as player.
Split whole task into separate parts:

  • tell player controller, you pressed widget to posses
  • player controller tells server side player controller that you want to posses something
  • server unposses old pawn and posseses new one.

Sounds like that works, could you please blueprint it, for some reason i can’t wrap my head around this. :confused:

I still haven’t figured out any way to possess a pawn as a client, does anyone know how to possess a pawn as a client?

You can’t. It’s server only.

How would a client possess a pawn then? There’s gotta be a way. If anyone has a idea please respond.

The client doesn’t posses a pawn, ever. The controller does.

Well i have the possess node in my customplayercontroller, so how come it doesn’t work? also it’s replicated to server.

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. :frowning:

Explain a little bit more why you are so set on the client verse controller?

I don’t quite get what you mean by “client verse controller” All i want to know is how i would be able to possess a pawn as a client.

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…

When you join the “game” everyone spawns as the same pawn, then i want the client to possess his own pawn through a widget.

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.

I have a pawn/blueprint that acts as a dummy/spectator that you spawn as when you join the game.

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!