Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Simple Title
- # Author: Nicke
- # Created: 23/12/2011
- # Edited: 23/12/2011
- # Version: 1.0
- #==============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ? Materials but above ? Main. Remember to save.
- #
- # No need for explaining, just a simple title scene with a few settings.
- #==============================================================================
- ($imported ||= {})["NICKE-SIMPLE-TITLE"] = true
- module NICKE
- module TITLE
- #--------------------------------------------------------------------------#
- # * Settings
- #--------------------------------------------------------------------------#
- # When adding a new menu item make sure you edit in title_choice method as well.
- # Right now the menu supports 5 items with the appropriated methods to it.
- # MENU_LIST ['ITEM 1', 'ITEM 2'] etc.
- MENU_LIST = ['Neu', 'Laden', 'Tutorial', 'Ende']
- # If you use MENU_LIST.size the menu items will be pushed horizontal and
- # when using that option make sure you don't add too much items or else a
- # few of them will go off the screen eventually.
- # Menu Window [ Columns, x, y, z, opacity ]
- WINDOW = [MENU_LIST.size, 0, 360, 200, 255]
- # TRANSITION [ SPEED, TRANSITION, OPACITY ]
- TRANSITION = nil
- # Title background.
- BACK = "Title" # (Default name)
- # Title window to fade in/out.
- # Set to nil to disable.
- ANIM_WINDOW_TIMER = 7
- # Player transparent on startup.
- PLAYER_TRANSPARENT = false
- # Switches enabled from start.
- # Set to nil to disable.
- # SWITCHES = [SWITCH_ID]
- SWITCHES = nil
- # Start placement for the player as in map_id, x and y coordinates.
- # Set to nil to disable.
- # START_POS = [MAP_ID, X, Y]
- START_POS = [nil,[2,10,10]]
- TUTORIAL_ACTOR = [1,2,3]
- # Run a common event on startup?
- # COMMON_EVENT = { ID => COMMON_EVENT_ID }
- COMMON_EVENT = {
- } # Do Not Remove
- # Skip title.
- SKIP = false
- end
- end
- # *** Don't edit below unless you know what you are doing. ***
- #==============================================================================#
- # ** Game_Interpreter
- #------------------------------------------------------------------------------
- # Method for running a commont event.
- #==============================================================================#
- class Game_Interpreter
- def run_event(event_list, event_id=0)
- @child_interpreter = Game_Interpreter.new(@depth + 1)
- @child_interpreter.setup(event_list, event_id)
- end
- end
- #==============================================================================#
- # ** Scene_Title
- #------------------------------------------------------------------------------
- # New Scene :: Scene_Title
- #==============================================================================#
- class Scene_Title < Scene_Base
- alias nicke_title_main main unless $@
- def main(*args, &block)
- title_skip if NICKE::TITLE::SKIP && $TEST && !$BTEST
- return if NICKE::TITLE::SKIP && $TEST && !$BTEST
- nicke_title_main(*args, &block)
- end
- alias nicke_title_start start unless $@
- def start(*args, &block)
- nicke_title_start(*args, &block)
- super
- create_title
- create_command_window
- end
- def create_command_window
- @command_title = NICKE::TITLE::MENU_LIST
- @command_title = Window_Command.new(Graphics.width, @command_title, NICKE::TITLE::WINDOW[0])
- if @continue_enabled
- @command_title.index = 1 # // Load index item.
- else
- @command_title.draw_item(1, false)
- end
- @command_title.x = NICKE::TITLE::WINDOW[1]
- @command_title.y = NICKE::TITLE::WINDOW[2]
- @command_title.z = NICKE::TITLE::WINDOW[3]
- @command_title.opacity = NICKE::TITLE::WINDOW[4]
- pre_animate_in unless NICKE::TITLE::ANIM_WINDOW_TIMER.nil?
- end
- def perform_transition
- if NICKE::TITLE::TRANSITION.nil?
- Graphics.transition(30)
- else
- Graphics.transition(NICKE::TITLE::TRANSITION[0],NICKE::TITLE::TRANSITION[1],NICKE::TITLE::TRANSITION[2])
- end
- end
- def pre_animate_in
- @command_title.opacity -= 255
- @command_title.contents_opacity -= 255
- end
- def post_start
- super
- animate_in unless NICKE::TITLE::ANIM_WINDOW_TIMER.nil?
- end
- def animate_in
- # // Method for animating the title window in.
- timer = NICKE::TITLE::ANIM_WINDOW_TIMER
- while timer > 0
- Graphics.update
- @command_title.opacity += 255 / NICKE::TITLE::ANIM_WINDOW_TIMER
- @command_title.contents_opacity += 255 / NICKE::TITLE::ANIM_WINDOW_TIMER
- @command_title.update
- timer -= 1
- end
- end
- def pre_terminate
- super
- animate_out
- end
- def animate_out
- # // Method for animating the title window out.
- timer = NICKE::TITLE::ANIM_WINDOW_TIMER
- while timer > 0
- Graphics.update
- @command_title.opacity -= 255 / NICKE::TITLE::ANIM_WINDOW_TIMER
- @command_title.contents_opacity -= 255 / NICKE::TITLE::ANIM_WINDOW_TIMER
- @command_title.update
- timer -= 1
- end
- end
- def open_command_window
- @command_title.open
- begin
- @command_title.update
- Graphics.update
- end until @command_title.openness == 255
- end
- def close_command_window
- @command_title.close
- begin
- @command_title.update
- Graphics.update
- end until @command_title.openness == 0
- end
- def update
- super
- @command_title.update
- if Input.trigger?(Input::C)
- case @command_title.index
- when 0...NICKE::TITLE::MENU_LIST.size
- Sound.play_decision unless @command_title.index == 1 # If load disabled. item.
- title_choice(@command_title.index)
- end
- end
- end
- def title_choice(index)
- # // Method for selecting the appropriated items in MENU_LIST.
- case index
- when 0 # New Game
- command_new_game
- when 1 # Load
- command_continue
- when 2 # Credits
- command_tutorial
- when 3 # Options
- command_shutdown
- end
- end
- def title_skip
- # // Method for skipping the title.
- load_database
- create_game_objects
- confirm_player_location
- $game_party.setup_starting_members
- setup_start_pos
- $game_player.refresh
- $game_player.transparent = NICKE::TITLE::PLAYER_TRANSPARENT
- if !NICKE::TITLE::SWITCHES.nil?
- for i in NICKE::TITLE::SWITCHES
- $game_switches[i] = true
- end
- end
- if !NICKE::TITLE::COMMON_EVENT.nil?
- for i in NICKE::TITLE::COMMON_EVENT.values
- next unless NICKE::TITLE::COMMON_EVENT.include?(i)
- $game_map.interpreter.run_event($data_common_events[i].list)
- end
- end
- $scene = Scene_Map.new
- Graphics.frame_count = 0
- RPG::BGM.stop
- $game_map.autoplay
- end
- def command_new_game
- # // Override new game method.
- confirm_player_location
- Sound.play_decision
- $game_party.setup_starting_members
- setup_start_pos
- $game_player.refresh
- $game_player.transparent = NICKE::TITLE::PLAYER_TRANSPARENT
- if !NICKE::TITLE::SWITCHES.nil?
- for i in NICKE::TITLE::SWITCHES
- $game_switches[i] = true
- end
- end
- if !NICKE::TITLE::COMMON_EVENT.nil?
- for i in NICKE::TITLE::COMMON_EVENT.values
- next unless NICKE::TITLE::COMMON_EVENT.include?(i)
- $game_map.interpreter.run_event($data_common_events[i].list)
- end
- end
- $scene = Scene_Map.new
- RPG::BGM.fade(1500)
- close_command_window
- Graphics.fadeout(60)
- Graphics.wait(40)
- Graphics.frame_count = 0
- RPG::BGM.stop
- $game_map.autoplay
- end
- def setup_start_pos
- # // Method to determine the player startup positions.
- if NICKE::TITLE::START_POS[0].nil?
- $game_map.setup($data_system.start_map_id)
- $game_player.moveto($data_system.start_x, $data_system.start_y)
- else
- $game_map.setup(NICKE::TITLE::START_POS[0][0])
- $game_player.moveto(NICKE::TITLE::START_POS[0][1], NICKE::TITLE::START_POS[0][2])
- end
- end
- #----------------------------------------------------------------------------#
- # // Feel free to comment this section out if you don't use it.
- # It's doesn't do anything from start as you need to customize it.
- def command_tutorial
- # // Method for options.
- # Call the scene you want as option in here.
- confirm_player_location
- Sound.play_decision
- for actor in NICKE::TITLE::TUTORIAL_ACTOR
- $game_party.add_actor(actor)
- end
- $game_map.setup(NICKE::TITLE::START_POS[1][0])
- $game_player.moveto(NICKE::TITLE::START_POS[1][1], NICKE::TITLE::START_POS[1][2])
- $game_player.refresh
- $scene = Scene_Map.new
- RPG::BGM.fade(1500)
- close_command_window
- Graphics.fadeout(60)
- Graphics.wait(40)
- Graphics.frame_count = 0
- RPG::BGM.stop
- $game_map.autoplay
- end
- #----------------------------------------------------------------------------#
- def command_shutdown
- # // Method for quit.
- Graphics.fadeout(60)
- Graphics.wait(20)
- RPG::BGM.fade(800)
- RPG::BGS.fade(800)
- RPG::ME.fade(800)
- $scene = nil
- end
- def create_title
- @sprite_title_bg = Sprite.new
- @sprite_title_bg.bitmap = Cache.system(NICKE::TITLE::BACK)
- end
- def dispose_command_window
- @sprite_title_bg.dispose unless @sprite_title_bg.nil?
- @sprite_title_bg = nil
- @command_title.dispose unless @command_title.nil?
- @command_title = nil
- end
- alias nicke_title_terminate terminate unless $@
- def terminate(*args,&block)
- nicke_title_terminate(*args,&block)
- super
- end
- end # END OF FILE
- #=*==========================================================================*=#
- # ** END OF FILE
- #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement