How to restart level when player dies

Hey guys. So when the player dies in my game so far, the level does not restart it just continues where it left off.

In udk I had it in kismet where after the player died the level would reset. I am wondering on how to do this in ue4. I am sure it has to be done in blueprints, but I have an idea on how to do it, am still 100 percent lost. Any ideas on how to do this would be great!

Thanks

Jason

1 Like

Hey,

There are multiple ways you could handle this, take a look at this post:

-W

As this is the first Google result I found for level restarting when I was searching, I feel it’s imperative to mention here what I just accidentally found out: you can now simply use an “Execute Console Command” node with the command “RestartLevel.”

hmm when I use console command RestartLevel, nothing happens… Why dosen’t it work?

1 Like

For anyone looking to do this via c++:
UGameplayStatics::OpenLevel(this, FName(*GetWorld()->GetName()), false);

3 Likes

hi~
I think you can call the RestartLevel on PlayerController in C++ or Blueprint.

See the source code at class APlayerController:
/** Restarts the current level */
UFUNCTION(exec)
virtual void RestartLevel();

1 Like

Don’t excactly can recall right now, but there is an console command to just load the level, if your game ends just excecute it.

so use the node “Excecute console command” and use one of these commands
I think it was OpenLevel (Levelname) you need to run this on a server if you are doing multiplayer
and RestartLevel or something like that this one will only work on singleplayer

There also is a node to load a level, but I haven’t tried it and I am not sure if it is from a plug in or not.

Using the console command is not the recommended way. I have provided how to do it in c++ in my answer bellow. This post http://www.unrealidiot.com/how-to-reload-current-level-in-unreal-engine-4 shows how to do it in blueprint. It is pretty much the same thing.

  • Get the current level name
  • Call OpenLevel passing the level name
1 Like

There’s a RestartGame BP node to reload the current level. You just need to pass it the current game mode: GetGameMode.

In 2020 it’s still works! ty!

just use open level command and give the level name you want to open

I did it this way:

327539-restartlevel.png

1 Like