How do I switch character blueprints

You’ll need to Possess each new Character so that your Controller gives you input to them.You’ll need to spawn a new Character, Possess it then Destroy the old one.

https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/PossessPawns/Blueprints/

I’m prototyping a game where the character can transform into different forms when collecting different powerups.

Each character has different collision and skills and I want to switch the character blueprints rather than just the mesh. How do I approach this???

The first character is the main while the other two are the transformations. We see here that the main character’s collision spheres stay the same even after transforming.

This is all in the main character blueprint

OnCollisionOverlap > Cast to Coin (Powerup) > Destroy Coin > Set NewAnim > Set New Mesh > Delay 5s > SetMainAnim > Set Main Mesh

Thanks in advance!

That worked great! Now my problem is to revert it back to the main character since the bp switching is only for few seconds. I tried a delay node but people said it will never work. Here’s my new code

OnCollisionOverlap > Cast to Coin (Powerup) > Destroy Coin > Destroy Main > Spawn New Char > Posses

Is switching back to the Main Character BP still possible?

You probably will need to spawn another one unless you save the old Character as a reference in your current Characters BP, like a PrevCharacter variable. This will allow you to reset its position and unhide it instead of constantly spawning a new one each time since this is the main character. You can pass this variable when you spawn the new Character and doesnt need to be destroyed but it will need to be disabled, hidden etc.

The best bet is a Timer that resets the Character back rather than a delay since it’ll run ontop of other code rather than delaying any flow that may happen in the mean time.

Thank you for the tips! I tried the timer but I can’t get it to work. I know there’s a missing piece somewhere I just don’t know what.

These are all in the main character blueprint btw

This is custom event “Morphing”

I tried adding a delay (which is redundant) after the timer but it still does nothing. I also connected the chain from beginoverlap directly to the timer, although it kindda worked, the chain skipped the 2-second delay from the timer I’m not sure why. Any thoughts?

Okay so instead of yammering on about things I decided to show you an example, lets see if you can work it out from what Ive done here :slight_smile:

This is using version 4.14.3 so hopefully thats the same as youre running. Basically I just made what I was talking about before so if you have questions just let me know.

Thanks for all the help :smiley:

I used your assets and they worked fine on a different project, then I copied all your blueprints but the timer still doesn’t work in my own project. I’ve attached my files if you’d like to take a look.

[link to my dropbox][1]

[1]:

Okay so acouple of suggestions, you should perhaps try to use some inheritance to save copying alot of code over all the time.

Instead of each Character and Coin being their own thing you do:

 -  Main Character
 |- Hero
 |- Main Morph
 |-- First Morph
 |-- Second Morph

What this means is all of your sub Characters will inherit from their parent BP, what happens then is MainHero can be defined in the main Morph and any other Morphs you decide to create will work based on existing functionality.

Similarly with Coins:

- Main Coin
|- First Coin
|- Second Coin

With your copy of my code you made a minor error:

Should be…

The reason for this is because you need to store your old Hero in the current Morph to switch back to it when the timer is up. The reason you store it there is that the coin gets destroyed so the reference might end up becoming invalid. Since its in an active Actor you dont have to worry about that happening.

Keep up the good work, youre doing really well so far :slight_smile:

Thank you MonsOlympus! Everything works now. I just realized that I was calling a different variable on the IsValid output. I’ll study this and I’ll try another transformation and see if I can get a 3rd one to work. **Thanks very much for your for your time! :smiley: :smiley: **

Hi again, I tried doing it with another character and I always get infinite loops everywhere only in the morph2 animation blueprint. I parented the sub characters to my main character as well as the coin like you suggested. I’m not sure what’s causing the infinite loops here

link text

thank you :slight_smile:

You havent provided all the files I need to run that correctly, maybe you could start a new question with some pictures of whats going on then anyone has a chance to jump in and answer.

I did load up your files but there are alot of bad cast nodes so I cant tell whats wrong but I’ll do what I can if you provide some more info.

Hi, I was able to fix the infinite loops, but another set of problems came up after. I created a new question about it.

link text for new question

Thanks!