I have been searching everywhere for a tut on restarting level on death, but none of them work good now.
I am not looking to save game, just force player to replay level if they die in it.
Longer way to do it is make several enemies by level. (Too much).
Should be a way to get current level the player is on, right?
Wanted to add, my main point is to use a you died widget and have the button restart which ever current level the player is on. Not sure how to do the vars for that. Try several methods, but a lot of them crash the game or just donât function.
Also, Is this to be used on death? I have a death function in my playerBP. But I made enemies for the game, used the same enemies throughout the game as well. Canât say if enemy kills me, go to level ??. It would take me back to Level 1 automatically.
This is the problem in the first place, this would require me to have multi widgets to say âRestart Levelâ Wont work that way. That requires each enemy to be individual on itâs ability to cause action after death. Hence way I am looking for a variable set up to figure out what level the player is on and restart that one.
Really up to you (same behaviour no matter where itâs called). If youâre using the âRestart levelâ UMG button/widget executing it there makes sense.
Got the image below from the following link:
[Unreal Engine 4 Tutorial: How to reload the current level][1]
On a different note, for all intent and purpose this is going to do the same thing as putting âRestartLevelâ in an âExecute Console Commandâ node like suggested by O.
EDIT: Iâm using UE5.1
So I was working on the save-load system in my game and somehow this only worked when;
I hit the little triangle under the âGet Current Level Nameâ (to expand the node) and,
Unmarked the âRemove Prefix Stringâ
Before un-marking the remove prefix string when I tried to use this from âRestart the Levelâ in the pause menu, it was sending me back to the main menu level. I know the original question is not looking for the save load system but when I searched google this is the first post that come up so I think it may help others
And @Arceyo just to be a little geek I tried both of them to check whether or not one of them works, âExecute Console Commandâ was working fine whereas âGet Current Level Nameâ didnât. So I assume that using âExecute Console Commandâ does not remove the prefix