Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Can someone tell me how to use this script?

Can anyone tell me how to use this script please.
#==============================================================================
# ** Title Map & Intro Script
#------------------------------------------------------------------------------
# Dargor
# 2007-01-21
# Version 3.0
#------------------------------------------------------------------------------
# * Instructions
#  ~ Activate the script
#      - In Main, replace $scene = Scene_Title.new for $scene = Scene_Startup.new
#  ~ Modifying the map id for the title screen
#      - Check in Module Startup class Title_Screen, change the value of the following variables:
#        - map_id
#        - pos_x
#        - pos_y
#  ~ Modifying the map id for the title screen in game
#      - Use the call script and then use one of the commands lsted below:
#        - $startup_title_screen.map_id = X
#        - $startup_title_screen.pos_x = X
#        - $startup_title_screen.pos_y = X
#  ~ Modifying the intro map id for the title screen
#      - Check in Module Startup class Intro, change the value of the following variables:
#        - map_id
#        - pos_x
#        - pos_y
#  ~ Modifying the map id for the title screen in game
#      - Use the call script and then use one of the commands lsted below:
#        - $startup_intro.map_id = X
#        - $startup_intro.pos_x = X
#        - $startup_intro.pos_y = X
#  ~ Options
#        - @skip_startup: When true, it will skip the intro and titlescreen.
#        - @startup_running: DON'T MODIFY!
#        - @debug_force_title: When true, the title screen will always be shown in debug mode.
#                                              The intro will be skipped.
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Title Map & Intro Script', 'Dargor', 2.5, '2006-10-22')

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state('Title Map & Intro Script') == true
  #--------------------------------------------------------------------------
  # * Startup Module (Manage Startup variables)
  #--------------------------------------------------------------------------
  module Startup
    class Title_Screen
      def initialize
        @map_id = 1
        @pos_x = 1
        @pos_y = 1
        @max_map =  4
        @random = true
      end
      attr_accessor :map_id
      attr_accessor :pos_x
      attr_accessor :pos_y
      attr_accessor :max_map
      attr_accessor :random
    end
    class Intro
      def initialize
        @map_id = 2
        @pos_x = 10
        @pos_y = 0
      end
      attr_accessor :map_id
      attr_accessor :pos_x
      attr_accessor :pos_y
    end
    class Options
      def initialize
        @skip_startup = false # Skip Intro and Title screen
        @startup_running = true # Is startup running?
        @debug_force_title = false # Force the title screen to show up on debug mode
      end
      attr_accessor :skip_startup
      attr_accessor :startup_running
      attr_accessor :debug_force_title
    end
  end
  #==============================================================================
  # ** Scene_Startup
  #==============================================================================

  class Scene_Startup < Scene_Title
    #--------------------------------------------------------------------------
    #  * Main Processing
    #--------------------------------------------------------------------------
    def main
      return if main_battle_test?
      main_database
      # Execute transition
      Graphics.transition
      # Main loop
      loop do
        main_loop
        break if main_scenechange?
      end
      # Prepare for transition
      Graphics.freeze
    end
    #--------------------------------------------------------------------------
    # * Main database
    #--------------------------------------------------------------------------
    alias startup_main_database main_database
    def main_database
      # Load startup module
      $startup_title_screen = Startup::Title_Screen.new
      $startup_intro = Startup::Intro.new
      $startup_options = Startup::Options.new
      # Load database
      $data_actors        = load_data("Data/Actors.rxdata")
      $data_classes      = load_data("Data/Classes.rxdata")
      $data_skills        = load_data("Data/Skills.rxdata")
      $data_items        = load_data("Data/Items.rxdata")
      $data_weapons      = load_data("Data/Weapons.rxdata")
      $data_armors        = load_data("Data/Armors.rxdata")
      $data_enemies      = load_data("Data/Enemies.rxdata")
      $data_troops        = load_data("Data/Troops.rxdata")
      $data_states        = load_data("Data/States.rxdata")
      $data_animations    = load_data("Data/Animations.rxdata")
      $data_tilesets      = load_data("Data/Tilesets.rxdata")
      $data_common_events = load_data("Data/CommonEvents.rxdata")
      $data_system        = load_data("Data/System.rxdata")
      # Make system object
      $game_system = Game_System.new
      # Skip startup if skip_startup is true
      if $startup_options.skip_startup and $BTEST == false
        make_game_object
        return
      elsif $startup_options.skip_startup and $BTEST
        battle_test
        return
      end
      startup_main_database
    end
    #--------------------------------------------------------------------------
    # * Frame Update
    #--------------------------------------------------------------------------
    def update
      # If in debug mode, go directly to the title screen
      if $DEBUG and $startup_options.debug_force_title
        setup_title_map
        $scene = Scene_Title.new
      else
        # Check if there is at least one save file
        for i in 0..3
          if FileTest.exist?("Save#{i+1}.rxdata")
            @continue_enabled = true
          end
        end
        # If there is at leats one save file, go to title screen
        if @continue_enabled
          setup_title_map
          # Open the Load Scene
          $scene = Scene_Title.new
        else
          # If there is no save file, go to the intro
          command_intro
        end
      end
    end
    #--------------------------------------------------------------------------
    # * Setup Title Map
    #--------------------------------------------------------------------------
    def setup_title_map
      # Make game objects
      make_game_object
      # Set up initial party
      $game_party.setup_starting_members
      # Set up initial map position
      if $startup_title_screen.random
        map_id = rand($startup_title_screen.max_map)
        $game_map.setup(map_id)
      else
        $game_map.setup($startup_title_screen.map_id)
      end
      # Move player to initial position
      $game_player.moveto($startup_title_screen.pos_x, $startup_title_screen.pos_y)
      # Refresh player
      $game_player.refresh
      # Run automatic change for BGM and BGS set with map
      $game_map.autoplay
      # Update map (run parallel process event)
      $game_map.update
    end
    #--------------------------------------------------------------------------
    # * Command Intro
    #--------------------------------------------------------------------------
    def command_intro
      make_game_object
      # Set up initial party
      $game_party.setup_starting_members
      # Set up initial map position
      $game_map.setup($startup_intro.map_id)
      # Move player to initial position
      $game_player.moveto($startup_intro.pos_x, $startup_intro.pos_y)
      # Refresh player
      $game_player.refresh
      # 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
    #--------------------------------------------------------------------------
    # * Make Game Object
    #--------------------------------------------------------------------------
    def make_game_object
      # Make system object
      $game_system = Game_System.new
      # Reset frame count for measuring play time
      Graphics.frame_count = 0
      # Make each type of game object
      $game_temp          = Game_Temp.new
      $game_system        = Game_System.new
      $game_switches      = Game_Switches.new
      $game_variables    = Game_Variables.new
      $game_self_switches = Game_SelfSwitches.new
      $game_screen        = Game_Screen.new
      $game_actors        = Game_Actors.new
      $game_party        = Game_Party.new
      $game_troop        = Game_Troop.new
      $game_map          = Game_Map.new
      $game_player        = Game_Player.new
      # Call command_new_game
      command_new_game
    end
    #--------------------------------------------------------------------------
    # * Command: New Game
    #--------------------------------------------------------------------------
    alias startup_command_new_game command_new_game
    def command_new_game
      if $startup_options.startup_running
        # Set decision SE and title BGM to nil
        $decision_se = $data_system.decision_se
        $title_bgm = $data_system.title_bgm
        $data_system.decision_se = nil
        $data_system.title_bgm = nil
      elsif $startup_options.startup_running == false and $scene.is_a?(Scene_Startup)
        # Set decision SE and title BGM to normal
        $data_system.decision_se = $decision_se
        $data_system.title_bgm = $title_bgm
      end
      # End startup process
      $startup_options.startup_running = false
      startup_command_new_game
    end
    #--------------------------------------------------------------------------
    # * Battle Test
    #--------------------------------------------------------------------------
    alias startup_battle_test battle_test
    def battle_test
      # Load database (for battle test)
      $data_actors        = load_data("Data/BT_Actors.rxdata")
      $data_classes      = load_data("Data/BT_Classes.rxdata")
      $data_skills        = load_data("Data/BT_Skills.rxdata")
      $data_items        = load_data("Data/BT_Items.rxdata")
      $data_weapons      = load_data("Data/BT_Weapons.rxdata")
      $data_armors        = load_data("Data/BT_Armors.rxdata")
      $data_enemies      = load_data("Data/BT_Enemies.rxdata")
      $data_troops        = load_data("Data/BT_Troops.rxdata")
      $data_states        = load_data("Data/BT_States.rxdata")
      $data_animations    = load_data("Data/BT_Animations.rxdata")
      $data_tilesets      = load_data("Data/BT_Tilesets.rxdata")
      $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
      $data_system        = load_data("Data/BT_System.rxdata")
      # Reset frame count for measuring play time
      Graphics.frame_count = 0
      # Make each game object
      $game_temp          = Game_Temp.new
      $game_system        = Game_System.new
      $game_switches      = Game_Switches.new
      $game_variables    = Game_Variables.new
      $game_self_switches = Game_SelfSwitches.new
      $game_screen        = Game_Screen.new
      $game_actors        = Game_Actors.new
      $game_party        = Game_Party.new
      $game_troop        = Game_Troop.new
      $game_map          = Game_Map.new
      $game_player        = Game_Player.new
      # Call the original battle test methode
      startup_battle_test
      # Set up party for battle test
      $game_party.setup_battle_test_members
      # Set troop ID, can escape flag, and battleback
      $game_temp.battle_troop_id = $data_system.test_troop_id
      $game_temp.battle_can_escape = true
      $game_map.battleback_name = $data_system.battleback_name
      # Play battle start SE
      $game_system.se_play($data_system.battle_start_se)
      # Play battle BGM
      $game_system.bgm_play($game_system.battle_bgm)
      # Switch to battle screen
      $scene = Scene_Battle.new
    end
  end
  #==============================================================================
  # ** Scene_Title
  #------------------------------------------------------------------------------
  #  This class performs title screen processing.
  #==============================================================================

  class Scene_Title
    #--------------------------------------------------------------------------
    # * Background Initialization
    #--------------------------------------------------------------------------
    def main_background
      # Make title graphic
      @spriteset = Spriteset_Map.new
    end
    #--------------------------------------------------------------------------
    # * Main Menu Initialization
    #--------------------------------------------------------------------------
    alias startup_main_menu main_menu
    def main_menu
      startup_main_menu
      # Hide the command window
      if $startup_options.startup_running and $scene.is_a?(Scene_Startup)
        @command_window.visible = false
      end
    end
    #--------------------------------------------------------------------------
    # * Main Audio Initialization
    #--------------------------------------------------------------------------
    def main_audio
      # Play title BGM or map BGM
      if $game_temp.map_bgm == nil
        $game_system.bgm_play($data_system.title_bgm)
      else
        $game_system.bgm_play($game_temp.map_bgm)
      end
      # Stop playing ME and BGS
      Audio.me_stop
      Audio.bgs_stop
    end
    #--------------------------------------------------------------------------
    # * Main Dispose
    #--------------------------------------------------------------------------
    alias map_main_dispose main_dispose
    def main_dispose
      @spriteset.dispose
      map_main_dispose
    end
    #--------------------------------------------------------------------------
    # * Frame Update
    #--------------------------------------------------------------------------
    alias map_title_screen_update update
    def update
      # Update map, interpreter, and player order
      # (this update order is important for when conditions are fulfilled
      # to run any event, and the player isn't provided the opportunity to
      # move in an instant)
      $game_map.update
      $game_system.map_interpreter.update
      $game_player.refresh
      # Update system (timer), screen
      $game_system.update
      $game_screen.update
      @spriteset.update
      map_title_screen_update
    end
  end
  #=============================================================================
  # ** Scene_Map
  #-----------------------------------------------------------------------------
  #  This class performs map screen processing.
  #=============================================================================
 
  class Scene_Map
    #--------------------------------------------------------------------------
    # * Update To Title
    #--------------------------------------------------------------------------
    alias title_update_to_title? update_to_title?
    def update_to_title?
      # If returning to title screen
      if $game_temp.to_title
        # Setup title map
        setup_title_map
        # Change to title screen
        $scene = Scene_Title.new
        return true
      end
      return false
    end
    #--------------------------------------------------------------------------
    # * Setup Title Map
    #--------------------------------------------------------------------------
    def setup_title_map
      make_game_object
      # Set up initial party
      $game_party.setup_starting_members
      # Set up initial map position
      $game_map.setup($startup_title_screen.map_id)
      # Move player to initial position
      $game_player.moveto($startup_title_screen.pos_x, $startup_title_screen.pos_y)
      # Refresh player
      $game_player.refresh
      # Run automatic change for BGM and BGS set with map
      $game_map.autoplay
      # Update map (run parallel process event)
      $game_map.update
    end
    #--------------------------------------------------------------------------
    # * Make Game Object
    #--------------------------------------------------------------------------
    def make_game_object
      # Make system object
      $game_system = Game_System.new
      # Reset frame count for measuring play time
      Graphics.frame_count = 0
      # Make each type of game object
      $game_temp          = Game_Temp.new
      $game_system        = Game_System.new
      $game_switches      = Game_Switches.new
      $game_variables    = Game_Variables.new
      $game_self_switches = Game_SelfSwitches.new
      $game_screen        = Game_Screen.new
      $game_actors        = Game_Actors.new
      $game_party        = Game_Party.new
      $game_troop        = Game_Troop.new
      $game_map          = Game_Map.new
      $game_player        = Game_Player.new
      # Call command_new_game
      scene_title = Scene_Title.new
      eval("scene_title.command_new_game")
    end
  end
  #==============================================================================
  # ** Scene_End
  #------------------------------------------------------------------------------
  #  This class performs game end screen processing.
  #==============================================================================
  class Scene_End
    #--------------------------------------------------------------------------
    # * Process When Choosing [To Title] Command
    #--------------------------------------------------------------------------
    def command_to_title
      # Setup title map
      setup_title_map
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Fade out BGM, BGS, and ME
      Audio.bgm_fade(800)
      Audio.bgs_fade(800)
      Audio.me_fade(800)
      # Switch to title screen
      $scene = Scene_Title.new
    end
    #--------------------------------------------------------------------------
    # * Setup Title Map
    #--------------------------------------------------------------------------
    def setup_title_map
      make_game_object
      # Set up initial party
      $game_party.setup_starting_members
      # Set up initial map position
      $game_map.setup($startup_title_screen.map_id)
      # Move player to initial position
      $game_player.moveto($startup_title_screen.pos_x, $startup_title_screen.pos_y)
      # Refresh player
      $game_player.refresh
      # Run automatic change for BGM and BGS set with map
      $game_map.autoplay
      # Update map (run parallel process event)
      $game_map.update
    end
    #--------------------------------------------------------------------------
    # * Make Game Object
    #--------------------------------------------------------------------------
    def make_game_object
      # Make system object
      $game_system = Game_System.new
      # Reset frame count for measuring play time
      Graphics.frame_count = 0
      # Make each type of game object
      $game_temp          = Game_Temp.new
      $game_system        = Game_System.new
      $game_switches      = Game_Switches.new
      $game_variables    = Game_Variables.new
      $game_self_switches = Game_SelfSwitches.new
      $game_screen        = Game_Screen.new
      $game_actors        = Game_Actors.new
      $game_party        = Game_Party.new
      $game_troop        = Game_Troop.new
      $game_map          = Game_Map.new
      $game_player        = Game_Player.new
      # Call command_new_game
      scene_title = Scene_Title.new
      eval("scene_title.command_new_game")
    end
  end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end
 
First of all, you have to know that I don't support this script anymore.
All you need to know is in the script header, under Instructions.
If you encounter an error it's probably because one of the scripts you are using is incompatible with this one.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top