Hi all…
I have created this blueprint for allow me to change player in the menù…
But i m using the right solution? i mean is this mode right for what i need? To change player in the menù? After all, i need to change character only in the menù(Don’t read press M ecc because i will use a bool)
And then… why when i press m the first time nothing happens apart the string hello?
The second time i get the control of the other character.
http://s16.postimg.org/5g93j16i9/Immagine.jpg
Swap the Nodes around, your attempting to possess an Character that hasnt been created yet.
The SpawnActorFromClass node should come before the Possess node.
I wronged something? Because it doesn’t works…
http://s9.postimg.org/owd3632pn/Immagine.jpg
I can see the print string so is not fault of the bad cast…
Your cast is happening After your PrintString, so your cast can still be failing.
What is the function CastToPlayerController doing? That seems really odd to do that. Place a PrintString node after the Possess node.
Blueprints execute their functions from Left to Right in the execution chain, just because you see a PrintString node execute does not mean that any nodes after it also executed correctly.
It works the same… I copied this fuction from a video of youtube.
In this video the creator shows how if i have arleady the player on map i can control them…
So i adapted the blueprint for make me spawn the actor istead to be placed arleady in the map…
Ok a couple of things. That tutorial is very old, the Cast To PlayerController node he uses SHOULD be depreciated, it is no longer needed and shouldnt be used. He is attempting to change Characters inside a Character Actor, this is dangerous, you need to keep in mind that the moment you tell your PlayerController class to Possess another Pawn, you will lose that Character class.
You should be doing this inside the PlayerController class itself, this way you will never lose scope when you possess a new Pawn.
This is the simple setup that i used in the PlayerController class. It functions exactly the same as what the Tutorial intended to show.
How can i open the Plyaer Controll Class?
You need to create one yourself.
I suggest you watch a few of the Unreal Engine 4 Tutorial videos as creating Blueprint classes is a rather fundamental process that you need to be familiar with.
Thanks :D, finally it works