Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Possess Pawn Doesn't Work - What Am I Doing Wrong?

Hi there, wanted to make a system where you can switch between different play styles. I used the TopDownCharacter Template and wanted to make it so that you can press tab and then you would possess this character because by default I want to use the DefaultPawn. Later there would be several pawns to chose from, however I can't get this possessing issue running..

alt text

Despite having it like the picture above shows, when I enter the game and hit tab which is represented by "InputAction ChangeMode" nothing happens and I don't understand why..?

Can anyone help, why can't I possess the desired pawn like that, what am I missing?

Thanks a lot for your help!

Product Version: UE 4.11
doesntwork.png (104.8 kB)
more ▼

asked Apr 15 '16 at 07:36 AM in Blueprint Scripting

avatar image

133 31 30 34

avatar image CriErr Apr 15 '16 at 10:58 AM

This code even get called, if it get called is new pawn valid?

Is game multiplayer or not?

avatar image Nick Jackson Apr 15 '16 at 02:35 PM

With this kind of question there is noway anyone can help. Try to debug it first. Add a Print String statement after Possess and see if you have set all the references correctly. It could be anything from not having Top Down Pawn reference set, to not receiving user input in the first place.

avatar image OpenStringStudio Apr 16 '16 at 09:25 PM

Thanks for your replies. To make it clearer what I did. I was following this tutorial and did a simpler version of what is described at 15min: https://www.youtube.com/watch?v=-4j_uGgUaB0

I created a new controller blueprint and a game mode in the 2d side scroller template just like he did, I do what you see in the picture above but nothing happens where in his video all works fine.. I don't understand why..?

And also, when I do it like described here: https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/PossessPawns/Blueprints/index.html all works fine.. but I want my controller blueprint to do it not the level blueprint because then I would have to do it over and over again in every single level I have.. It must be possible to have my controller blueprint do the job but why is it not working??

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Finally! Well as I was suspecting I was missing a crucial node..

alt text

Apparently it is mandatory to get your "In Pawn" with a "Get All Actors Of Class" Array Node. Doesn't make sense to me but well, it is what you have to do and then it works :)

possess.png (116.8 kB)
more ▼

answered Apr 16 '16 at 10:03 PM

avatar image

133 31 30 34

avatar image Nick Jackson Apr 17 '16 at 02:17 AM

Mark your question as resolved if you've worked it out ;)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Well, I don't really want to let this standing without adding information.

it is mandatory to get your "In Pawn" with a "Get All Actors Of Class" Array Node

It is not. Your Code didn't work, because your "TopDownPawnReference" was empty (at least I think it was). A blue Reference variable is not the same as an Integer or Boolean Variable. It's empty if you don't fill it. In C++, this is called a Pointer and you need to understand how this works. Otherwise you will run into these problems every time.

Also, "GetAllActorsOfClass" is an expensive and lazy node. You need to setup a way where you spawn your Pawns and save the Reference to them which you can later access. Since you use the PlayerController as a central point for switching Pawns, you should use it to Spawn and Save references.

What is a Reference and why are the Blue nodes Empty (Accessed None)

References or Pointers are Variables that are pointing to ONE instance of an Actor in your Game. Simple example:

You have 10 Pawns spawns in your Game, you can save a Reference to ONE of them in these Variables. If you don't save one into the Variable, it will be empty. From where should the variable know what Pawn you meant?

So you need to learn how to efficiently reference your Actors/Objects. For this, I can recommend you to watch this Stream Recap:


Watch it and rework your logic. "GetAllActorsOfClass" is not the way to go! If you have multiple Pawns in your Levels, this node will return all of them and you can't even make out which one is which, since they are not really ordered in that Array you get their.

Also if you don't have a Pawn in your Level, this Node will return an Empty Array.

more ▼

answered Apr 17 '16 at 12:18 PM

avatar image

6.9k 333 186 472

avatar image OpenStringStudio Apr 26 '16 at 07:40 AM

Well thanks a lot.. I've made some chances since then but I do understand that I'm probably not yet doing the referencing thing properly. In any case I made it working properly with the "GetAllActorsOfClass" and I'm able to switch between as many pawns as I want to with this method. But clearly I could do better than that, so thanks for the input. Also I already know the video you suggested but thanks anyway.. In time, when I really need to rework the spawning and swapping between pawns system, I will update this post with the "better" solution!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Try to connect "Get player controller" to the target input.

more ▼

answered Apr 15 '16 at 11:38 AM

avatar image

63 3 6 9

avatar image OpenStringStudio Apr 16 '16 at 09:26 PM

this doesn't work, I'm already using a controller blueprint

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question