Download

Trying to possess a new character when I load a new level in unreal

I have 2 levels in my game, one where the player is on a boat and they hit a rock, once the boat flips over it loads the next level, where the player is on the island but for the first level I dont want the player to run or jump whereas on the second level I do, my first solution was when the player loaded a new level it would possess a new character that can run but not sure how to do that as I couldn’t find any action like event level loaded or something alike not sure if there’s a workaround to this.

Maybe you can do that from the level blueprint?

And why don’t you disable the input from the Character? Maybe it’s better then using another chatacter.

Hi Limanima thanks for the advice with disabling input, that should work however once the other level loads how could I re-enable input as there is no event for if the player has loaded a particular level and I have tried to use a box trigger but the player must walk out and back in the trigger, but with no input they can’t do this any suggestions on how to fix this or if there’s something else I can do.

Each level as it’s own blueprint, you can do that in the begin play event.
In the first level blueprint, event BeginPlay->Disable input.
In the second level blueprint, event BeginPlay->Enable input.

I’m new to Unreal, so I’ve never did this my self, actually I’ve never used the level blueprint. But by reading the documentation this seems to be possible.

I’m going to check this out.

I have already tried this method and the event begin play node is for when the game starts not when the level starts.

Are you sure? I’ve just made a test and it works.

Are you opening the level blueprint from here?
image

This what I did:
On Map0 BP
image

On Map4 BP
image

In my character:
image

The strings showed up when the maps loaded.

If you’re using OpenLevel, then all you need is to place the required character in the level. ( It will set to possess player 0 ).

I’ve tried this however it just sets it back to the ThirdPersonBP


The character I want to use (the ThirdPersonBP is not in the level)


Loads thirdpersonBP instead of the character I want

I have a feeling it could be something to do with the third person game mode or player start that
causes it to possess the thirdpersonBP character

The game mode will dictate the player. But, if you drop another type of player into the level and set it to possess, this will override the game mode:

( I don’t think the player start has any effect ).

Thank you so much this is very usefull information for the future and this seems to have worked.

1 Like

You can set the default pawn class to the character of your choosing in the Game Mode override settings in the world settings panel on the right of the editor in the map/level you’re in. You must make a custom game mode class and select it in the game mode override before you can set that default pawn class though.

If you have a player start in the level and the default pawn class selected to your desired character it will spawn in with that character if you have it set to receive input like the post above.

Whether or not you can control it is dependent on if you have any controller functionality in the character blueprint or player controller if you are using pawn class.

The EventBeginPlay in the level blueprint will fire only once each time a level opens. Regardless of whatever is else is going on it will fire unless you delete that node all together. Only on a level change this will fire.

Disabling input is tricky to re-enable. An easy workaround could be do a branch right after your input events with a boolean variable that can stop you from pushing input beyond that branch. The only bad part is that you’d have to do that with EVERY input that you want to prohibit while your branch is false. That’s just part of it I think. If you’re gonna have a game with a lot of features it’s going to have to have branches in a lot of places.