Mobius's "The Story So Far" Script

The Story So Far
by
MobiusXVI
​


Release Notes
Dec 2013 - v. 1.0 Initial Release
Mar 2023 - v. 1.1 Fixed a bug where it would ask the user if they wanted to watch the story even if it didn't exist


Introduction
The purpose of this script is to allow you to remind the player about what has happened in the story whenever they load their game. I hope you enjoy it!


Features
- Very little scripting needed to make script work, since it uses maps for cutscenes.
- Can have as many or few chapters as you want
- Allows player to skip watching the cutscene and load directly into game (especially useful when reloading a game due to death)

Screenshots
None.


How to Use
- Place this script below the defaults but above main. If you have other scripts that modify saving/loading, put this one below them.
- What this script does is check a game variable of your choosing to determine the current "chapter". Then it loads a map that you specify to let you play out a cutscene of your own design to recap the story. So you'll need to complete the configuration section below to do this.

- You can do whatever you want on the cutscene maps, including going to additional maps if need be. Whenever you finish with your cutscene, all you have to do is put the following script call in an event and the game will then load and allow the player to keep going: "Mobius_Story_So_Far.finish_cutscene" (without quotes)
- The additional configuration needed is listed in the script under "Configuration"

Demo

http://www.mediafire.com/download/alsku2kn3c2ke0d/Story So Far Demo.zip

Script

Spoiler
Code:
#===============================================================================
# The Story So Far
# Author: Mobius XVI
# Version: 1.1
# Date: 02 MAR 2023
#===============================================================================
#
# Introduction:
#
#   The purpose of this script is to allow you to remind the player about what
#   has happened in the story whenever they load their game.
#
# Instructions:
#
#  - Place this script below the defaults but above main. If you have other
#    scripts that modify saving/loading, put this one below them.
#  - What this script does is check a game variable of your choosing to
#    determine the current "chapter". Then it loads a map that you specify to
#    let you play out a cutscene of your own design to recap the story.
#    So you'll need to complete the configuration section below to do this.
#  - You can do whatever you want on the cutscene maps, including going to
#    additional maps if need be. Whenever you finish with your cutscene, all
#    you have to do is put the following script call in an event and the game
#    will then load and allow the player to keep going.
#    "Mobius_Story_So_Far.finish_cutscene" (without quotes)
#
# Features:
#
#  - Very little scripting needed to make script work, since it uses maps for
#    cutscenes.
#  - Can have as many or few chapters as you want
#  - Allows player to skip watching the cutscene and load directly into game
#    (especially useful when reloading a game due to death)
#
# Issues/Bugs/Possible Bugs:
#
#   - There may be incompatibility issues with any script that heavily modifies
#     the saving/loading of the game. Placing this script below them should
#     alleviate most problems
#
#  Credits/Thanks:
#    - Mobius XVI, author
#    - Monkeysnow55, for requesting it
#
#  License
#    - Copyright 2023 Mobius XVI
#    - This script is licensed under the MIT license.
#      The full license is availble here:
#      https://opensource.org/license/mit/
#      Further, if you decide to use this script in a commercial product,
#      I'd ask that you let me know via a forum post or a PM. Thanks.
#
#===============================================================================
#                             CONFIGURATION
#===============================================================================
module Mobius_Story_So_Far
  CHAPTER_VARIABLE = 0
  # Define the game variable that will be used to determine what chapter
  # the player is on.
 
  CUTSCENE_MAPS = [[5, 0, 0],  # Chapter 0
                   [1, 9, 21],  # Chapter 1
                   [15, 30, 0], # Chapter 2
                   # ...
                   #[MAP_ID, STARTING_X, STARTING_Y], # CHAPTER X
                   # ...
                   ] # Array end - DON'T DELETE!
  # This is an array of arrays. The inner arrays have three entries. The first
  # is the Map_ID for whatever map you want to use for the cutscene. The second
  # and third entries are for the player's x and y coordinates respectively.
  # The inner arrays are all indexed, so whichever one comes first is used
  # when the chapter variable is 0, the second array is used when the chapter
  # variable is 1, and so on. Make sure all inner arrays are separated by commas
end 
#===============================================================================
# ** Story So Far - EDIT BELOW THIS LINE AT OWN RISK
#===============================================================================
class Game_Temp
  attr_accessor :cutscene_filename  # filename to load after cutscene
end

class Scene_Load
 
  # alias old loading method
  alias mobius_ssf_on_decision on_decision
 
  # new loading method
  def on_decision(filename)
    # If file doesn't exist
    unless FileTest.exist?(filename)
      # Play buzzer SE
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    # Read save data
    file = File.open(filename, "rb")
    read_save_data(file)
    file.close
    # Get chapter info
    chapter_variable = Mobius_Story_So_Far::CHAPTER_VARIABLE
    chapter = $game_variables[chapter_variable]
    # Get cutscene info
    @cutscene_info_array = Mobius_Story_So_Far::CUTSCENE_MAPS[chapter]
    if @cutscene_info_array == nil or @cutscene_info_array.length < 3
      # If there's no info, then load the save as normal
      # Play load SE
      $game_system.se_play($data_system.load_se)
      # Load savefile as normal
      mobius_ssf_on_decision(filename)
      return
    end
    # If there is a cutscene, ask the player if they want to see it
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Set help text
    @help_text = "Do you want to watch the story so far?"
    @help_window.set_text(@help_text)
    # Create choice window
    @choice_window = Window_Command.new(120, ["Yes", "No"])
    @choice_window.active = true
    # Center choice window
    @choice_window.x = 640 / 2 - @choice_window.width / 2
    @choice_window.y = 480 / 2 - @choice_window.height / 2
    @choice_window.z = 200
    # Wait for input
  end
    
  # Load into cutscene
  def load_into_cutscene(filename)
    # Play load SE
    $game_system.se_play($data_system.load_se)
    # Remeber filename
    $game_temp.cutscene_filename = filename  
    # Set cutscene info
    cutscene_map_id = @cutscene_info_array[0]
    cutscene_x = @cutscene_info_array[1]
    cutscene_y = @cutscene_info_array[2]
    # Stop BGM
    Audio.bgm_stop
    # Load cutscene map
    # Set up new map
    $game_map.setup(cutscene_map_id)
    # Move player to initial position
    $game_player.moveto(cutscene_x, cutscene_y)
    # Refresh player
    $game_player.refresh
    # Straighten player
    $game_player.straighten
    # Run automatic change for BGM and BGS set with map
    $game_map.autoplay
    # Update map (run parallel process event)
    $game_map.update
    # Switch to map screen
    $scene = Scene_Map.new
  end
end

class Scene_File
 
  # alias old update method
  alias mobius_ssf_update update
 
  def update
    # If choice window is up don't do other updating
    if @choice_window != nil and @choice_window.active
      # Update command window
      @choice_window.update
      # If C button was pressed
      if Input.trigger?(Input::C)
        # Branch by command window cursor position
        case @choice_window.index
        when 0  # Yes
          # Load into cutscene
          load_into_cutscene(make_filename(@file_index))
        when 1  # No
          # Call old loading method
          mobius_ssf_on_decision(make_filename(@file_index))
        end
        @choice_window.dispose
      end
      return
    else # If no choice window, perform normal updating
      mobius_ssf_update
    end
  end
end

module Mobius_Story_So_Far
 
  def Mobius_Story_So_Far.finish_cutscene
    # Prevent Screen Changes
    Graphics.freeze
    # Recall old filename
    filename = $game_temp.cutscene_filename
    # Create Load screen
    $scene = Scene_Load.new
    # Load savefile using original method
    $scene.mobius_ssf_on_decision(filename)
  end
end

FAQ
None yet.

Credit and Thanks
Special thanks to Monkeysnow55 for requesting this script.

Author's Notes
Copyright 2023 Mobius XVI
This script is licensed under the MIT license

The full license is available here: https://opensource.org/license/mit/
Further, if you decide to use this script in a commercial product, I'd ask that you let me know via a post here or a PM. Thanks.
Can you make a demo for this? It's kinda confusing thanks!
Added. If it's still confusing, let me know. I'm not the best out writing out instructions, but the demo should be fairly easy to follow what I do. 
Could you make a version for MV or VX Ace?
I don't own MV, so I won't make an MV version. As for VXA, I've considered re-making my XP scripts for it a bunch of different times but have yet to actually do so 😛. Since you've specifically asked for an Ace version for this script, I'll consider it. But at the same time, I'm really busy right now so I'd say it's unlikely to happen anytime soon. Sorry 🙁. If I do though, I will make a post about it and let you know.
V1.1 Released.

This is a minor update. Previously, if the player selected a file for loading and there wasn't a defined cutscene to watch, the script would still ask the player if they wanted to watch a cutscene. This was a problem because it can be confusing to players and make them think they skipped it somehow unintentionally. Now, if there's no cutscene defined, then the script will just load the save file right away. This has the side benefit of making development easier since you can add the script to a project and it shouldn't break it immediately.

Original thread: https://forums.rpgmakerweb.com/threads/mobiuss-the-story-so-far-script.21464/