Problem when starting new game

  • #1, by pakeithpsySaturday, 05. November, 20:58 A month ago
    I've been running into a weird issue regarding starting a new game after completing an old one in the same session.

    After I've finished the game (i.e. "won") and then go to start a new one, while my inventory is reset, everything else is not, and all the conditions I fulfilled in my old game are still active, and there's pretty much no way to progress since the game thinks I've done everything already despite starting over.

    Is there a way to reset everything to its initial state when starting a new game?

    Newbie

    18 Posts


  • #2, by afrlmeSunday, 06. November, 00:51 A month ago
    What's the current method you are using for new game?

    Imperator

    7211 Posts

  • #3, by pakeithpsySunday, 06. November, 05:55 A month ago
    These are the actions I have for when the "new game" button is pressed. Should probably also mention I copied the menu from the Fantasy Quest template since trying to program a menu from scratch is too confusing. I'm not sure how to fix the issue beyond setting each individual condition to its starting point which would be needless busywork.

    Newbie

    18 Posts

  • #4, by afrlmeSunday, 06. November, 13:42 A month ago
    The typical method most people use is to use the autosave quick save system.

    1. create a condition & name it "session_active" - create it in the main menu conditions tab (to be honest it doesn't really matter where you create it).

    2a. create a called by other action block in the main menu scene actions tab & insert all action parts that you want to happen when you press the new game button.

    2b. ideally before you change to the first scene what you need is to create a new scene (add a black background & add your character to it somewhere outside of the scene background). In this scene in an at begin of scene action add a small pause of lets say 500ms & then execute autosave #? (decide which autosave/quicksave slot to use for new game) also wrap it in an if query to check if autosave doesn't already exist so you don't accidentally overwrite it.

    3. in new game object left click immediate action you need to an if query...

    if condition "session_active" is true
    load autosave #?
    else
    call action new game (create new game actions inside of a called by other action)
    end if

    That's about it. I don't personally like using autosaves for this, but it's the old method that most people still use. I prefer the replaceGame() function method which requires a little bit of scripting, but that method is only really valid for when you are ready to release your game.

    Also I would just like to point out & potentially remind you that using save game files during active development is bad, as loading save games that were created from before your current development session may contain incorrect data &/or be missing data which can lead to random glitches & bugs, etc. that might not occur in a fresh playthrough of your game.

    Imperator

    7211 Posts

  • #5, by pakeithpsySunday, 06. November, 16:57 A month ago
    That all seems like overkill. Is there not some quick way to just reset everything?

    Newbie

    18 Posts

  • #6, by afrlmeSunday, 06. November, 18:31 A month ago
    Like what? & magic red button?

    That's like 5 minutes setup. It just sounds complicated when explained via text.

    & yeah the fastest solution is the replaceGame() function, which is actually meant to be used for episodic content, but just so happens to work like the reset button on a gaming console - the issue with it is that it literally relaunches the entire game from the beginning which includes all the game launch actions, videos, & whatever else you are telling it to do, which means that you need to create a method to skip all that & immediately launch into the new game actions instead.

    The setup for it is simple enough...

    1. same as the other method. add all new game actions into a call by other action block & rename appropriately.

    2. in the new game object check if condition I mentioned is true, if so execute autosave #99, then create an execute a script & add this line to it...

    replaceGame("name of current ved file.ved") -- will later need replacing with exported .vis file name.

    followed by... else call action whatever you called the called by other action you stored the new game action parts in.

    3. inside of game launch actions you need to create an if query like this...

    if autosave #99 exists delete autosave #99 call called by other action block containing new game actions else do all the regular game launch actions & show menu scene, etc.

    That's the gist of it. I'd include screenshots but it's a pain for me to create & upload them here. I recommend joining the VS Discord server if you aren't already on it as we are much more active on there than here.

    https://discord.gg/g5zFejW

    Imperator

    7211 Posts

  • #7, by pakeithpsySunday, 06. November, 18:32 A month ago
    I've been searching around the forums trying to find some help with the "replacegame" option but I cannot figure out how it's supposed to work. Apparently it only works after exporting the game, which is extremely unhelpful during the testing period, but when I export the game to test it out the game hangs on the menu and doesn't even start at all.

    This is ridiculous. Something this simple should not be so ridiculously complex. The only viable option is to just autoclose the game once its over, but that's not really fixing the problem, it's a band-aid to hide the problem.

    Newbie

    18 Posts

  • #8, by afrlmeSunday, 06. November, 18:34 A month ago
    I just provided you with a solution & as I just said we don't really use this forum much these days.

    You can use replaceGame() during development for testing by linking to your current .ved project file instead of an exported .vis file, but it's meant to be used for episodic content & after the game is exported.

    Imperator

    7211 Posts

  • #9, by afrlmeSunday, 06. November, 18:36 A month ago
    This is ridiculous. Something this simple should not be so ridiculously complex. The only viable option is to just autoclose the game once its over, but that's not really fixing the problem, it's a band-aid to hide the problem.
    Why do you think it would be simple? Games are comprised of 100's & potentially 1000's of conditions, values, positions, & lots of other data.

    You are lucky that Visionaire Studio comes with a premade save system (actually 2 different premade save systems) as some engines require you to code your own.

    Imperator

    7211 Posts

  • #10, by pakeithpsySunday, 06. November, 20:12 A month ago
    I did not notice you replied. When I last looked at the page my "overkill" post was the last one. I'm sorry if you thought I wasn't listening.

    Thank you for better explaining it to me. None of the other posts I found mentioned that I could use the .ved file. I will try again when I get home.

    Newbie

    18 Posts

  • #11, by pakeithpsySunday, 06. November, 22:13 A month ago
    It works now!
    Thank you so much for helping and putting up with me.

    Newbie

    18 Posts

Write post