Start the game with a Event? (Every time)

● ARCHIVED · READ-ONLY
Started by Emmabelotti 7 posts View original ↗
  1. Do you know resetti?
    he is a little,cute and kind guy that remember you to save your Animal crossing file...
    Yeah,i really want to do something like that for my game! Everytime you go to the town,a switch says that you didn't saved the game yet. When you save,the switch goes off. I need a Game-start-check event,but i don't want to activate it once / everytime you go in that map. I need that the event activates only when (And everytime) i start the game.
    I really need help!
    :95:
  2. Well, first of all you could change your switch every time you enter the game by adding a little line to your database load method, after you do that you can set that switch off when you save the game.

    This is how it is done:
    Code:
    module Config
        SAVE_SWITCH = 1 # Change this to be the correct switch ID
    end
    
    class Scene_Save
        alias hrk_on_save_success_old  on_save_success
        def on_save_success
            $game_switches[Config::SAVE_SWITCH] = true
            hrk_on_save_success_old
        end
    end
    
    class Scene_Load
        alias hrk_on_load_success_old  on_load_success
        def on_load_success
            $game_switches[Config::SAVE_SWITCH] = false
            hrk_on_load_success_old
        end
    end

    Default value for SAVE_SWITCH is 1 but you can change it to be any switch ID you want. Switch 1 is often used by other scripts so it might be wise to change it to something different. Just remember to not use that switch in your game or your check won't work.

    You have to copy/paste this in your script editor, below Materials. Create a new blank script page and past this.
  3. Thank you very much!
    So,if i start the game,it will turn the switch back on,right?
  4. It handles it the other way around: since every switch is initialized as "false" (off) it turns the switch on when you successfully saved your game. So to check if the game has been saved during that session you have to check if the switch is on. It works for every game session since it automatically sets the switch to false (off) whenever the game is loaded.
  5. Thanks!
    What if i turn it on with a event
    (I'm using this switch as a startcheck,and i'll use another switch to check that the game was saved)
    Will it stay on during the play session,then switch off after the session ends/starts?
  6. Heirukichi said:
    Code:
    class Scene_Load
        alias hrk_on_load_success_old on_load_success
        def on_load_success
            $game_switches[Config::SAVE_SWITCH] = false
            hrk_on_load_success_old
        end
    end
    This turns the switch off every time you load the game so if you turn it on using an event it will stay on only during that session. When a new session starts or the game is loaded it automatically turns it off.
  7. Thanks! I'll try it as soon as possible :D