Download

Switching between character pawns by button press.

Looking to switch between different character pawns when I press a face button in the third person template. My attempts let me know that I still don’t fully understand blueprint :slight_smile: Any help appreciated.

Since you haven’t explained I’m gonna assume that you’re talking about the player’s pawn, and not AI’s.

In essence, after the event for the button was fired, first unpossess the current pawn, then destroy it, and then spawn a new pawn from the class/blueprint that you want, and then move it to the same place and possess it. Almost all the nodes has names exactly the same as what I said you should do, just make sure you’re doing all this in your player controller BP and not another class. (Level Blueprint could also work but is not as straight forward I suppose)

Thx for the help…I got it to work with this set up.
switch_pawn.png

I copied that chain and put another player pawn on the copied version thinking you can switch back and forth this way, but it’s only letting me execute the commands once. I couldn’t find anywhere to set the on press to 0 for infinite like back in kismet. Where can I set that?

All events should behave like ‘infinite’ events in Kismet. I’m not sure why it would not fire in this case, did you put a break point in it?

You probably want to use the transform of your old pawn to spawn the new one, rather than the PlayerController transform, which is rather undefined. PC’s don’t really have a ‘location’ as such. Also the rotation of the PC and Pawn will be different if eg you are looking up.

James is right. Also which class are you doing all that work in? Because I remember suggesting using the PC BP for that, but apparently you’re using another class (considering the use of GetPlayerController nodes). Also it seems you’re destroying the wrong actor at the beginning, again, depepnding of the class that blueprint represents.

Sorry guys it was complete user error. I was switching pawns but putting all the pawn switching logic in the first pawn…big derp on my part. It’s not really an ideal way to handle what I am going for, so Im gonna see if there is some way to do it in the game blueprint instead of the characters. Here is what I came up with at the end…though after switching back and forth a **** load of times sometimes leaves the character at an odd orientation. Thx for the help :slight_smile:

switch_pawn_2.png

i have a couple questions about your pawn switching.
1: are you getting the wrong orientation for the character because your only seeking transform info and not rotation of the soon to be destroyed pawn?
2: can you not skip the teleport node in favor of grabbing world position?
3: can these character function be collapsed into a new blueprint function because i need to swap 4 characters

thanks for your help

1: transform has location, rotation and scale.
2: not sure what the teleport is supposed to do. the spawn should be happening at the actor’s location anyway.
3: why shouldn’t they?

Thank you very mutch you are the best.

Hey all, Wondering if this is still being watched. I’m having some issues with this type of setup. Can someone walk through how they have it setup in their project if they have it working correctly? (i.e. unpossessing, destroying, and then spawning in the exact same place another actor and possessing it?) I can’t get the newly spawned actor to spawn in the same spot as the old actor.