Restart Game Problem

  • #1, by irinahuw_Monday, 04. June 2018, 21:03 6 years ago
    Hello!

    I set up a Restart Button in my Game, because it will be used at sort of an exhibition. So i do not need Savegames but an easy restart for anyone who wants to try out the game. hence the button, which is set up as a permanently shown interface.

    when the button is clicked, the autosave is loaded. the autosave is created in scene 1 when the game starts, see screenshots for the actionpart set up. i had a look in the forum and oriented my actions among the "new game button" threads.
    i had to add the "play video" action in this button, because otherwise the video which is in "action at start" too wouldn't play via the restart button. only when the game is started the very first time, the video from the start action plays.

    however, i am not sure if this solution i chose is a good idea, or will lead to many bugs.
    because i already have a bug XD. after the 2nd, 2rd restart, the text which the character is supposed to say upon start does not disappear and starts to overlap. (see screenshot)

    what can i do differently to make it work fine?

    thank you and kind regards

    irina

    Newbie

    49 Posts


  • #2, by afrlmeMonday, 04. June 2018, 22:05 6 years ago
    You could try using the Lua replaceGame() function which acts like the restart on a console/handheld, but it restarts the game from the very beginning like you have just launched it.

    replaceGame("data.vis")

    Replace "data" with whatever you called the vis file when you export/compile the game. For testing via Visionaire Studio editor just link to the current ved file instead seeing as vis files are only available when you export the game for others to play.

    Also quick question: the autosave you are creating at the beginning of scene 1, are you creating every time the scene is shown or have you wrapped it inside of an if autosave exists if query? like so...

    if autosave #1 exists
    else
     execute autosave #1
    end if

    There also needs to be a pause before you can execute the autosave. You can't save instantly. Create a pause of let's say 1000ms to give the scene enough time to load.

    Final note: old save files cause conflict issues when you have added new content/data to your game since it was created. Seeing as it's an exhibition, you should add an if query into the at begin start following action actions section of the main game settings to check if autosave exists & if it does then delete it.

    if autosave #1 exists
     delete autosave #1
    end if

    This will generate a fresh autosave each time you launch the game. It's a good idea to do this while you are working on your game for the reason I specified above.

    Imperator

    7278 Posts

  • #3, by irinahuw_Tuesday, 05. June 2018, 07:11 6 years ago
    hello AFRLme,

    what would i do without you... thank you so much!

    i tried the "replaceGame", because this seems a much easier and cleaner way for my purpose than the autosave query. seems to work, no more text issues so far!

    however, when i click the restart button the game starts again, which is fine, but the sound of the first scene does not play. for now i created an action in the scene "at beginning of scene" which plays the sound. but actually i assigned the sound file in the scene properties as background sound. i would like to avoid self invented work arounds, because i learned that they usually lead to other problems, so do you know what the matter is?

    thanks a lot!

    Newbie

    49 Posts

  • #4, by afrlmeTuesday, 05. June 2018, 11:47 6 years ago
    Simon actually recommends to set bgm & lightmaps inside of at begin of scene action as it seems to be a valid workaround for when they aren't loaded randomly after loading from a save file - even Daedalic Entertainment apparently use the same method.

    Imperator

    7278 Posts