Need help with Player Controller

So. I just got started with Unreal Engine, and I want to set up a PlayerController for a Pawn to figure out controls.

I couldn’t figure it out on my own, so I googled it. All I found was “yes, you should use a PlayerController” and “download a multiplayer sample and you’ll understand”.

I downloaded a multiplayer sample, and it only confused me more because I couldn’t even FIND the PlayerController blueprint.

Then I started trying to mess with events and casting, except I couldn’t get a reference to the actor I needed.

So tell me.

What am I doing wrong exactly? What do I do to get a PlayerController to communicate with a pawn?

there is a function inside the controller called “get pawn” or “get controlled pawn”. this is your possessed pawn. IF you have a pawn possessed :slight_smile: just cast from there to your char bp and you can use him

Try watching the UE4 tutorial series on Youtube.

If you are new to the Engine i strongly suggest you watch those series, follow along and then attempt your own projects.

One way to think of this is that the PlayerController is almost as an input manager, it is where the communication between the player at the PC/Console and the game happens.
The PlayerCharacter is the thing in game that the PlayerController is controlling.

The reason we want to handle input in the PlayerController and not the Character is because what if you want to have more than one character, if the input is in the character you have repeat a bunch of blueprint. Using a PlayerController you can posses another character and the controller will now control that.

However this does require some understanding of how UE4 and OO works so as DevilsD said, if your starting out follow some tutorials on youtube and just get into creating fun gameplay prototypes.
Don’t worry about getting things exactly down and optimised until you have some more experience in using the engine. UE4 is pretty good at doing stuff for you so just make fun stuff for now, so long as it works.

So for future reference, I found a technique to get input from the input manager.

From the level BP (or some other blueprint of which the “event beginPlay” starts immediately), have something spawn your PlayerController (my choice is the “Create Player” option because it feels like, when I will deal with multiplayer options, this will be simpler to manipulate).

Then in your PlayerController BP, have an event (I use a keyboard input for that) cast “unpossess” and “destroy actor”, with as a target a value that will come later. After these two are in the timeline, add a “Spawn Actor from Class” node with the class of actor/pawn you want to manipulate (don’t forget to add a spawn transform or the compiler will error out). Once run, this will spawn your pawn and output exactly what actor it is. Next up, you’re going to promote that actor reference to a variable - name it whatever you want, I personally call it Possessed. Place the “set” that appears next in the timeline with that output, and run it (I acknowledge that in all likelihood this is highly redundant but for now it works - I haven’t tried it without, I might report the results later). Spawn a (again, according to my example where Possessed is my variable name) “Get Possessed” node, and wire it to the input of both your earlier Unpossess and Destroy Actor nodes (so that whenever the pawn creation event occurs, you will first lose control of that actor before it gets destroyed). Back to the timeline - spawn a “Possess” node with the “Possessed” variable as a target. From there on, the playercontroller will be associated with the pawn.

This is where I choke though. While it does technically work, it only works because my pawn fetches the playercontroller at the 0th player position and then uses Cast To Actor with the returned value to FETCH the values from the playercontroller. And that is far from ideal, especially if I want to implement multiplayer. Problem is, when I try casting values from the playercontroller to the pawn, it A) never even changes the value and B) if I have a “cast” node, tells me that the actortype is already that and so I don’t need that cast node. I’m going to try some other things, but if I could be enlightened as to how to do it otherwise, it would be fantastic.

As a side note, that’s only for values - never have I ever managed to cast events between BPs.

EDIT: Tried the “Get Pawn” thing that Majek suggested and the PCBP to CHRBP casting works impeccably. Thanks!