The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: cozziekuns on May 21, 2010, 12:32:36 AM

Title: Cozziekuns Custom Title Screen
Post by: cozziekuns on May 21, 2010, 12:32:36 AM
Disclaimer: Just noticed that this is a (cleaner?) and more upgraded version of Woratana's Custom Title Screen Menu.
Note: My last post got killed by the time warp :( Never mind, it gave me time to work on a new version.

Cozziekuns' Custom Title Screen
Version: 1.0
Author: Cozziekuns
Date: May 20, 2010

Version History



Planned Future Versions


Description


What do you get if you combine Yanfly's Main Menu Redux and a title screen? Something pretty awesome, that's for sure. This Custom Title Screen is supposed to make creating your own title commands easily, as well as ensuring as much compatibility as possible.

Features


Screenshots

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi48.tinypic.com%2F28uk45j.png&hash=406cc161b11e595e89287eb61fb0239cb0d1ec3c)

Instructions

See header.

Script


Code: [Select]
#===============================================================================
#
# Cozziekuns' Custom Title Screen
# Last Date Updated: 5/20/2010
#
# What do you get if you combine Yanfly's Main Menu Melody and a title screen?
# Something pretty awesome, that's for sure. This Custom Title Screen is
# supposed to make creating your own title commands easily, as well as ensuring
# as much compatibility as possible.
#
#===============================================================================
# Updates
# -----------------------------------------------------------------------------
# o 05/20/10 - Started Script.
#===============================================================================
# What's to come?
# -----------------------------------------------------------------------------
# o More compatability!
#===============================================================================
# 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. You can
# edit the modules as you wish.
#===============================================================================

$imported = {} if $imported == nil
$imported["CozCustomTitleScreen"] = true

module COZZIEKUNS
  module CTS
 
#-------------------------------------------------------------------------------
# * Basic Command Window Functions
#-------------------------------------------------------------------------------
 
  OPACITY = 255 # How opaque you want your window to be. 0 is invisible.
  COMMAND_X = 186 # Where you want the command window to be.
  COMMAND_Y = 288 # Where you want the command window to be.
  MAX_ROW_NUM = 3 # The maximum amount of commands in your command window.
  COMMAND_WINDOWSKIN = "Window" # The windowskin you want your window to be in.
  ICONS = true # If you want to use icons or not.
 
  ICON_INDEX ={
# Syntax: Vocab => Icon Number
   "New Game" => 141,
   "Continue" => 133,
   "Shutdown" => 176,
   "Game Over" => 112,
   "Battle!" => 10,
   "Tutorial" => 200,
   "Prologue" => 177
  }

#-------------------------------------------------------------------------------
# * Advanced Command Window Functions
#-------------------------------------------------------------------------------

#===============================================================================
# * Title Commands Instructions
# -----------------------------------------------------------------------------
# This Array lets you determine the order of your commands. For example, if we
# order of the commands in such a fashion:
#
# 0,
# 1,
# 10,
# 2,
#
# Would show up on the title screen as:
#
# New Game
# Continue
# Common Event 1
# Exit
#
# The following commands are reserved by default:
#
#   0: New Game
#   1: Continue
#   2: Shut Down
#  10: Common Event 1 (Named "Battle!" by default)
#  51: Transfer to Map 2 (Named "Tutorial" by default)
#  101: Transfer to Map 2, play Common Event 2 (Named "Prologue" by default)
#
# Note: 0 ~ 9 is reserved by the default commands.
#       10 ~ 50 is reserved by common events.
#       51 ~ 100 is reserved by transfer to commands.
#       100 ~ 150 is reserved by transfer + common event commands.
#       151 ~ 999 is reserved by scene commands.
#===============================================================================

  TITLE_COMMANDS =[
  0, # New Game
  1, # Continue
  10, # Common Event 1
  51, # Map 2
  101, # Map 2, Common Event 2
  151, # Gameover
  2, # Shut Down
]

#===============================================================================
# * Common Event Commands Instructions
# -----------------------------------------------------------------------------
# This hash lets you determine which common events you want to use. For example
# if we wanted to create a common event that shows up as "Game Over" on the
# title screen, and has a common event ID of 2, we would use...
#
# 10 => [2, "Game Over"]
#
# This would show up on the title screen as:
#
# Game Over
#
# and would transfer you to the map you want to start in. Just make sure you
# don't have the common events triggered by a switch, or else it won't work.
#
# You can have 40 common events, numbering from 10 - 50.
#===============================================================================

  COMMON_EVENTS ={
# Syntax: Event ID, Text
  10 => [1, "Battle!"]
}

#===============================================================================
# * Transfer To Command Instructions
# -----------------------------------------------------------------------------
# This hash lets you determine which maps you want your player to transfer to.
# For example, if we wanted to transfer our player to a map with an ID of 2,
# and we wanted to transfer him 3 tiles to the right and 3 tiles down, and make
# it show up as "Prolouge" on the title screen, we would use...
#
# 51 => [2, "Game Over"]
#
# This would show up on the title screen as:
#
# Game Over
#
# and would transfer you to the map you want to start in. Just make sure you
# don't have the common events triggered by a switch, or else it won't work.
#
# You can have 49 transfer events, numbering from 51 - 100.
#===============================================================================

  TRANSFER_TO ={
# Syntax: Map ID, Map X, Map Y, Text
  51 => [2, 1, 1, "Tutorial"]
}

#===============================================================================
# * Transfer + Common Event Instructions
# -----------------------------------------------------------------------------
# This hash lets you determine which maps you want your player to transfer to,
# and if you want a common event to play after the player transfers to that map.
# For example, if we wanted to transfer our player to a map with an ID of 3,
# and we wanted to transfer him 3 tiles to the right and 3 tiles down, play a
# common event with the ID of 2, and make it show up as "Epilogue" on the title
# screen, we would use...
#
# 101 => [2, 3, 3, 3, "Epilogue"]
#
# This would show up on the title screen as:
#
# Game Over
#
# and would transfer you to the map you want to start in. Just make sure you
# don't have the common events triggered by a switch, or else it won't work.
#
# You can have 49 transfer + common events, numbering from 101 - 150.
#===============================================================================

  COMMON_EVENT_TRANSFER_TO ={
# Syntax: Event ID, Map ID, Map X, Map Y, Text
  101 => [2, 2, 1, 1, "Prologue"]
}

#===============================================================================
# * Scene Command Instructions
# -----------------------------------------------------------------------------
# This hash lets you determine which scene you want to go to. This could be
# particuarly useful if you had a scene select screen or something. For example,
# if we wanted to transfer our scene to $Scene_Shop, and we wanted it to show up
# as "Shop" in the title screen, we would use...
#
# 151 => ["Scene_Shop", "Shop"]
#
# This would show up on the title screen as:
#
# Shop
#
# and would transfer you to the shop screen.
#
#===============================================================================

  SCENE_COMMANDS ={
# Syntax: Scene, Text
  151 => ["Scene_Gameover", "Game Over"]
}
end
end

#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
# The instance of this class is referenced by $game_temp.
#==============================================================================

class Game_Temp
  attr_accessor :title_command_index
 
  alias coz_initialize initialize
  def initialize
    coz_initialize
    @title_command_index = []
  end
end

#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs the title screen processing.
#==============================================================================

class Scene_Title < Scene_Base
 
  #--------------------------------------------------------------------------
  # * Command List
  #--------------------------------------------------------------------------
  def create_command_list
    commands = []
    @ex_cmds = {}
    index_list = {}
    COZZIEKUNS::CTS::TITLE_COMMANDS.each_with_index { |c, i|
      case c
      when 0 # New Game
        index_list[:new_game] = commands.size
        commands.push(Vocab::new_game)
       
      when 1 # Continue
        index_list[:continue] = commands.size
        commands.push(Vocab::continue)
       
      when 2 # Shutdown
        index_list[:shutdown] = commands.size
        commands.push(Vocab::shutdown)
     
      when 10..50 # Common Events
        next unless COZZIEKUNS::CTS::COMMON_EVENTS.include?(c)
        @common_event = COZZIEKUNS::CTS::COMMON_EVENTS[c]
        index_list[c] = commands.size
        @ex_cmds[c] = commands.size
        commands.push(@common_event[1])
      when 51..100 # Transfer to Maps
        next unless COZZIEKUNS::CTS::TRANSFER_TO.include?(c)
        @map_transfer = COZZIEKUNS::CTS::TRANSFER_TO[c]
        index_list[c] = commands.size
        @ex_cmds[c] = commands.size
        commands.push(@map_transfer[3])
      when 101..150
        next unless COZZIEKUNS::CTS::COMMON_EVENT_TRANSFER_TO.include?(c)
        @common_event_map_transfer = COZZIEKUNS::CTS::COMMON_EVENT_TRANSFER_TO[c]
        index_list[c] = commands.size
        @ex_cmds[c] = commands.size
        commands.push(@common_event_map_transfer[4])
      when 151..999
        next unless COZZIEKUNS::CTS::SCENE_COMMANDS.include?(c)
        @scene_commands = COZZIEKUNS::CTS::SCENE_COMMANDS[c]
        index_list[c] = commands.size
        @ex_cmds[c] = commands.size
        commands.push(@scene_commands[1])
      end
    }
    $game_temp.title_command_index = index_list
    return commands
  end

  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    @command_window.update
   
    if Input.trigger?(Input::C)
      index = @command_window.index
      case index
      when $game_temp.title_command_index[:new_game]
        command_new_game
      when $game_temp.title_command_index[:continue]
        command_continue
      when $game_temp.title_command_index[:shutdown]
        command_shutdown
      else
        for key in @ex_cmds
          if @ex_cmds[key[0]] == index
            return_check = false
            found_key = key[0]
            break
          end
        end
       
        if found_key >= 10 and found_key <= 50 # Plays a common event
          @common_event = COZZIEKUNS::CTS::COMMON_EVENTS[found_key]
          confirm_player_location
          Sound.play_decision
          $game_party.setup_starting_members            # Initial party
          $game_map.setup($data_system.start_map_id)    # Initial map position
          $game_player.moveto($data_system.start_x, $data_system.start_y)
          $game_player.refresh
          $game_temp.common_event_id = @common_event[0]
          $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
         
        elsif found_key >= 51 and found_key <= 100 # Plays a character transfer
          @transfer_to = COZZIEKUNS::CTS::TRANSFER_TO[found_key]
          confirm_player_location
          Sound.play_decision
          $game_party.setup_starting_members            # Initial party
          $game_map.setup(@transfer_to[0])    # Initial map position
          $game_player.moveto(@transfer_to[1], @transfer_to[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
         
        elsif found_key >= 101 and found_key <= 150
          @common_event_trans = COZZIEKUNS::CTS::COMMON_EVENT_TRANSFER_TO[found_key]
          confirm_player_location
          Sound.play_decision
          $game_party.setup_starting_members            # Initial party
          $game_map.setup(@common_event_trans[1])    # Initial map position
          $game_player.moveto(@common_event_trans[2], @common_event_trans[3])
          $game_player.refresh
          $game_temp.common_event_id = @common_event_trans[0]
          $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
       
        elsif found_key <= 151
          @scene_caption = COZZIEKUNS::CTS::SCENE_COMMANDS[found_key]
          $scene = eval(@scene_caption[0] + ".new")
          end
        end # End found_key
      end # End case check
    end
   
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    @commands = create_command_list
    if COZZIEKUNS::CTS::ICONS
    @command_window = Window_TitleCommand.new(172, @commands)
  else
    @command_window = Window_Command.new(172, @commands)
    end
    @command_window.x = COZZIEKUNS::CTS::COMMAND_X
    @command_window.y = COZZIEKUNS::CTS::COMMAND_Y
    @command_window.height = [@command_window.height, COZZIEKUNS::CTS::MAX_ROW_NUM * 24 + 32].min
  if @continue_enabled                    # If continue is enabled
      @command_window.index = 1             # Move cursor over command
    else                                    # If disabled
      @command_window.draw_item(1, false)   # Make command semi-transparent
    end
    @command_window.opacity = COZZIEKUNS::CTS::OPACITY
    @command_window.windowskin = Cache.system(COZZIEKUNS::CTS::COMMAND_WINDOWSKIN)
    @command_window.openness = 0
    @command_window.open
  end
end

#==============================================================================
# ** Window_TitleCommand
#------------------------------------------------------------------------------
#  This window displays the icons in the title screen.
#==============================================================================

class Window_TitleCommand < Window_Command

  #--------------------------------------------------------------------------
  # * Draw Item
  #     index   : item number
  #     enabled : enabled flag. When false, draw semi-transparently.
  #--------------------------------------------------------------------------
  def draw_item(index, enabled = true)
    rect = item_rect(index)
    rect.x += 4
    rect.width -= 8
    rx = rect.x
    ry = rect.y
    rw = rect.width
    rh = rect.height
    self.contents.clear_rect(rect)
    self.contents.font.color = normal_color
    if COZZIEKUNS::CTS::ICON_INDEX.include?(@commands[index])
      icon = COZZIEKUNS::CTS::ICON_INDEX[@commands[index]]
    else
      icon = 0
    end
    draw_icon(icon, rx, ry)
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(rx + 24, ry, rw - 24, rh, @commands[index])
    rect = item_rect(index)
    rect.x += 4
    rect.width -= 8
  end
end

Credit



Thanks


Support


Just post below.

Known Compatibility Issues

Probably won't work with other title screens.

Demo


See attached.

Author's Notes


----------------------------------------------------------------------------------------------------------------------------------------------

Coz
May 20, 2010 at 19:55
Say Yanfly, do you mind if I remix your Main Menu Melody script into something that’s useful for Scene_Title?

And if you allow me to do so, would I have to credit you, or can I just put you under special thanks?

Thanks in advance.

Yanfly
May 20, 2010 at 19:56
By all means. No crediting is necessary. Looking forward to seeing your script!

Coz
May 20, 2010 at 20:15
Thanks Yanfly. Sometimes, I think you’re too nice.

----------------------------------------------------------------------------------------------------------------------------------------------

Restrictions

:ccby:
Title: Re: Cozziekuns Custom Title Screen
Post by: SirJackRex on May 21, 2010, 12:35:01 AM
Nice script! Works very well, and is easy to set up.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi701.photobucket.com%2Falbums%2Fww11%2Fantlazz%2F4abaee2e.png&hash=2c537b3d333c6330767364243aa38acad5c6fe4d)
Title: Re: Cozziekuns Custom Title Screen
Post by: cozziekuns on May 21, 2010, 01:42:02 AM
Thanks. You even went to all that trouble making an image thanking me  :tpg:
Title: Re: Cozziekuns Custom Title Screen
Post by: modern algebra on May 21, 2010, 02:20:22 AM
Yeah, it looks like a good script. Nice work cozziekuns