Start new game

  • #1, by jf-mSaturday, 02. October, 10:44 2 weeks ago
    Hello!

    I juste have finished my first game! very proud! grin

    I 'm facing an issue i didn't see earlier.

    When i load a saved game, everything is fine. but if i quit this saved game to return to the main menu and start a new game, everything i made in the saved game is still there. I start with scene 1, but inventory is the saved game's one, and all i've done in the game too.

    I could change all my conditions to true when there is a click on the start button. but it's a lot of work (really!) and i was wondering if there is not a simplier option?

    Thanks! smile

    Newbie

    30 Posts


  • #2, by afrlmeSaturday, 02. October, 11:07 2 weeks ago
    How have you setup the new game option?

    Also congrats on almost finishing your first game project. wink

    Imperator

    7025 Posts

  • #3, by jf-mSaturday, 02. October, 11:54 2 weeks ago
    thanks! it is a lot of work, but it worth it! smile

    this is how i made  my new game:

    ->  I created a new menu
    -> created a button 'new game"
    -> on a left click on this button:
    - hide "Main interface"
    - hide "inventory"
    - hide "secondary interface"
    - hide "miscallenous"
    - show scene "scene0"
    - remove all items from character "agatha"
    - set command "cursor fleche"

    i saw command like 'quit game', but non 'start a new game'

    Newbie

    30 Posts

  • #4, by afrlmeSaturday, 02. October, 20:36 2 weeks ago
    You need to use autosaves or the replaceGame() function.

    What most people do is in the first scene after clicking new game (for the first time a player clicks on new game) is they check if autosave x exists & if not then they create an autosave.

    Now in your start new game actions you need to query if the autosave exists. if it does then load the autosave else do the actions you just mentioned.

    To be honest though the replaceGame() is the safest method for starting a new game, however it essentially relaunches the game like the reset button did on the playstation one, etc. which means that you need some method to tell the engine to skip the intro video(s), menu scene, etc. & just launch straight into the game itself, which requires you to create an external file & check if it exists. quick tip: autosave works great for this as you can query if it exists via action parts.

    Anyway, replaceGame() is meant to be used for exported games as they need to be linked to a .vis file. You could set it up something along the lines of this...

    start new game actions:
    execute autosave #99
    execute a script:
    replaceGame("game name.vis") -- replace with whatever you named the .vis file
    1

    game launch actions:
    if autosave #99 exists
    delete autosave #99
    call "new game actions"
    else
    do whatever actions you normally have in game launch actions
    end if


    Imperator

    7025 Posts

  • #5, by jf-mSunday, 03. October, 16:48 2 weeks ago

    thanks a lot for your help!

    I understand the process, but i don't know how to set up the lines.
    - What difference between  'start new game actions' and 'game launch actions"?

    is it in the game properties action > At begin, start the following actions?

    and the other one is for the left click on the launch game button i created?

    - and 'call new game actions' : is this a script you are calling?

    What i tried:

    - Create an action which can be called by another one
    I set it up with what you mentioned in 'start new game actions'
    - modify my left click action on my launch game button
    I set it up with what you mentioned in 'game launch actions'

    I must be wrong, because nothing happens. The launch button is not launching any more grin

    edit: i built the game, tried again, but nothing.

    Newbie

    30 Posts

  • #6, by afrlmeSunday, 03. October, 19:24 2 weeks ago
    Can you share some screenshots of what you have setup so far please?

    Imperator

    7025 Posts

  • #7, by jf-mSunday, 03. October, 19:33 2 weeks ago
    It's in french. 'bouton démarrer' means 'start button'


    Newbie

    30 Posts

  • #8, by afrlmeMonday, 04. October, 11:20 2 weeks ago
    No you need to add the replaceGame() thing in the new game button & the new game actions in the called by other action - I don't know why in your screenshot it's linked to an action called "call by other action" either as you can rename those & it should show the name of the one you linked it to.

    Imperator

    7025 Posts

  • #9, by jf-mMonday, 04. October, 18:34 2 weeks ago
    thanks again.

    I must be kind of stupid... roll

    I don't understand.

    If i left click on my new game button to launch a new game, and if the actions are:
    execute autosave #99
    execute a script:
    replaceGame("game name.vis") -- replace with whatever you named the .vis file

    when and where are the new game actions called?





    Newbie

    30 Posts

  • #10, by afrlmeMonday, 04. October, 22:19 2 weeks ago
    You call the called by other action block containing the actions inside of the game launch actions (the "at begin start following action" section of the main game settings area of the editor).

    However your called by other actions bit isn't actually correct. You should be querying inside of the "at begin start following action" section if the autosave exists & if it does then delete it & call the called by other action that setups whatever is needed for new game & changes to the first playable scene/intro scene of your game.

    Imperator

    7025 Posts

  • #11, by jf-mWednesday, 06. October, 17:44 2 weeks ago
    Ok, here what i did:

    - Game properties > "at begin start following action":
    if autosave #99 exists
    delete autosave #99
    call "call by other action" 
    else
    execute script 'scriptportrait'
    end if

    -scenes > menu > "start game button" ("bouton démarrer"):
                - Left click:
                            execute autosave #99
                            execute  script' replaceGame("mav.vis")'
                - call by other action:
                            hide "Main interface"
                            hide "inventory"
                            hide "secondary interface"
                            hide "miscallenous"
                            show scene "scene0"
                            remove all items from character "agatha"
                            set command "cursor fleche"


    I still don't understand, but it works fine!

    Thank you! Really, you are very helpful!

    Newbie

    30 Posts

Write post