Announcement

Collapse
No announcement yet.

Menu restart function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Menu restart function

    Hello,

    I created an ingame menu with UMG. Now I've got continue and quit working. But restart is the issue. I want restart to actually reset (reload) the level, so no respawn scripts that just put my character back at a certain point.

    Basically I want the "open level" node to recognize my "current level" name. All my levels are called "Level1/2/3/4etc."

    #2
    You could try saving the current level name to a savegame variable, then make an empty map that does nothing but load levels. Load that empty map and on begin play, make it load a level and pass the level name into it. Then it will automatically load that level.
    iTween For UE4
    Procedural pathed animation for actors, components & UMG - $0
    Runtime DataTable
    DataTables dynamically loaded from text or Google Sheets while your game is running!
    easyCSV
    Fast, cheap, and accurate CSV parsing at runtime!

    Comment


      #3
      Originally posted by Jared Therriault View Post
      You could try saving the current level name to a savegame variable, then make an empty map that does nothing but load levels. Load that empty map and on begin play, make it load a level and pass the level name into it. Then it will automatically load that level.
      And how would one go about doing that?

      Comment


        #4
        Look into the savegame class. Basically you create a new blueprint with the savegame class and put variables in there you want to save between levels. Then you can call functions that save and load variables to and from the savegame class instance you created for your game. Create a variable that holds the level name you want to load (as a string or name) and when you click "restart", you tell the savegame to save the current level's name to that savegame variable. Then you load this new map I mentioned earlier, just an empty map. Its level blueprint would, on Event Begin Play, load the string level name from the savegame blueprint and then load a level, the name of which would be that level name variable you just loaded. This would essentially restart the current level by loading another map quickly then loading the current level again.
        iTween For UE4
        Procedural pathed animation for actors, components & UMG - $0
        Runtime DataTable
        DataTables dynamically loaded from text or Google Sheets while your game is running!
        easyCSV
        Fast, cheap, and accurate CSV parsing at runtime!

        Comment

        Working...
        X