A credits button
#1
This is a locked, single-post thread from Creation Asylum.  Archived here to prevent its loss.
No support is given.  If you are the owner of the thread, please contact administration.


This is very simple. I don't no realy how to script but i figered out how to add a credits button to your title screen. I will put the script last.

First you will need to add a music file in your BGM adio folder and name it 002-System02. You need this or it will not work. Now make a folder in your game folder and call it Text. Open up your note pad and type your credits and save it as Credits.rxdata and put it in your Text folder. Now for the script. Replace your scene_title with this:

Code:
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
#  タイトル画面の処理を行うクラスです。
#==============================================================================

class Scene_Title
 #--------------------------------------------------------------------------
 # ● メイン処理
 #--------------------------------------------------------------------------
 def main
    # 戦闘テストの場合
    if $BTEST
      battle_test
      return
    end
    # データベースをロード
    $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")
    # システムオブジェクトを作成
    $game_system = Game_System.new
    # タイトルグラフィックを作成
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.title($data_system.title_name)
    # コマンドウィンドウを作成
    s1 = "New Game"
    s2 = "Continue"
    s3 = "Shutdown"
    s4 = "Credits"
    @command_window = Window_Command.new(192, [s1, s2, s3, s4])
    @command_window.back_opacity = 160
    @command_window.x = 320 - @command_window.width / 2
    @command_window.y = 288
    # コンティニュー有効判定
    # セーブファイルがひとつでも存在するかどうかを調べる
    # 有効なら @continue_enabled を true、無効なら false にする
    @continue_enabled = false
    for i in 0..3
      if FileTest.exist?("Save#{i+1}.rxdata")
        @continue_enabled = true
      end
    end
    # コンティニューが有効な場合、カーソルをコンティニューに合わせる
    # 無効な場合、コンティニューの文字をグレー表示にする
    if @continue_enabled
      @command_window.index = 1
    else
      @command_window.disable_item(1)
    end
    # タイトル BGM を演奏
    $game_system.bgm_play($data_system.title_bgm)
    # ME、BGS の演奏を停止
    Audio.me_stop
    Audio.bgs_stop
    # トランジション実行
    Graphics.transition
    # メインループ
    loop do
      # ゲーム画面を更新
      Graphics.update
      # 入力情報を更新
      Input.update
      # フレーム更新
      update
      # 画面が切り替わったらループを中断
      if $scene != self
        break
      end
    end
    # トランジション準備
    Graphics.freeze
    # コマンドウィンドウを解放
    @command_window.dispose
    # タイトルグラフィックを解放
    @sprite.bitmap.dispose
    @sprite.dispose
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新
 #--------------------------------------------------------------------------
 def update
    # コマンドウィンドウを更新
    @command_window.update
    # C ボタンが押された場合
    if Input.trigger?(Input::C)
      # コマンドウィンドウのカーソル位置で分岐
      case @command_window.index
      when 0  # ニューゲーム
        command_new_game
      when 1  # コンティニュー
        command_continue
      when 2  # シャットダウン
        command_shutdown
      when 3  # シャットダウン
        command_credit
      end
    end
 end
 #--------------------------------------------------------------------------
 # ● コマンド : ニューゲーム
 #--------------------------------------------------------------------------
 def command_new_game
    # 決定 SE を演奏
    $game_system.se_play($data_system.decision_se)
    # BGM を停止
    Audio.bgm_stop
    # プレイ時間計測用のフレームカウントをリセット
    Graphics.frame_count = 0
    # 各種ゲームオブジェクトを作成
    $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
    # 初期パーティをセットアップ
    $game_party.setup_starting_members
    # 初期位置のマップをセットアップ
    $game_map.setup($data_system.start_map_id)
    # プレイヤーを初期位置に移動
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    # プレイヤーをリフレッシュ
    $game_player.refresh
    # マップに設定されている BGM と BGS の自動切り替えを実行
    $game_map.autoplay
    # マップを更新 (並列イベント実行)
    $game_map.update
    # マップ画面に切り替え
    $scene = Scene_Map.new
 end
 #--------------------------------------------------------------------------
 # ● コマンド : コンティニュー
 #--------------------------------------------------------------------------
 def command_continue
    # コンティニューが無効の場合
    unless @continue_enabled
      # ブザー SE を演奏
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    # 決定 SE を演奏
    $game_system.se_play($data_system.decision_se)
    # ロード画面に切り替え
    $scene = Scene_Load.new
 end
 #--------------------------------------------------------------------------
 # ● コマンド : シャットダウン
 #--------------------------------------------------------------------------
 def command_shutdown
    # 決定 SE を演奏
    $game_system.se_play($data_system.decision_se)
    # BGM、BGS、ME をフェードアウト
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    # シャットダウン
    $scene = nil
 end
 #--------------------------------------------------------------------------
 # ● コマンド : コンティニュー
 #--------------------------------------------------------------------------
 def command_credit
    # 決定 SE を演奏
    $game_system.se_play($data_system.decision_se)
    # BGM、BGS、ME をフェードアウト
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    # シャットダウン
    $game_system.bgm_play($data_system.decision_se)
    Text_Scroller.new("Credits.rxdata", 0,0, 1, 0)
    $game_system.bgm_play($data_system.decision_se)
    # 決定 BGM を演奏
    $game_system.bgm_play($data_system.decision_se)
 end
 #--------------------------------------------------------------------------
 # ● 戦闘テスト
 #--------------------------------------------------------------------------
 def 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")
    # プレイ時間計測用のフレームカウントをリセット
    Graphics.frame_count = 0
    # 各種ゲームオブジェクトを作成
    $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
    # 戦闘テスト用のパーティをセットアップ
    $game_party.setup_battle_test_members
    # トループ ID、逃走可能フラグ、バトルバックを設定
    $game_temp.battle_troop_id = $data_system.test_troop_id
    $game_temp.battle_can_escape = true
    $game_map.battleback_name = $data_system.battleback_name
    # バトル開始 SE を演奏
    $game_system.se_play($data_system.battle_start_se)
    # バトル BGM を演奏
    $game_system.bgm_play($game_system.battle_bgm)
    # バトル画面に切り替え
    $scene = Scene_Battle.new
 end
end


Now make a new script above main and call it text_scroll and add this:

#=================================================  ==
# ■ Text Scroll Script  R3-Fixed - Created by David
#=================================================  ==
# For more infos and update, visit:
#
#http://digitalgamer.myfreebb.com
#Or
#http://members.cox.net/davidbevans
#
#=================================================  ==

#=================================================  ==
# ▼ CLASS Text_Scroller Begins
#=================================================  ==
class Text_Scroller

def initialize (file, opacity_scroll, opacity_bg, speed, live_scroll)
 
  text=IO.readlines("Text/#{file}")
  $tss_speed = speed
  $tss_iteration = 480.0/speed
  $tss_sy= (text.size*32) + 64
 
  $tss_scroll_window = Window_Scroll.new(file, 640, $tss_sy)
  $tss_scroll_window.opacity = opacity_scroll
  $tss_scroll_window.z=500
  $tss_scroll_window.x = 0
  $tss_scroll_window.y = 480
 
  $tss_bg_window = Window_bg.new
  $tss_bg_window.opacity = opacity_bg
  $tss_bg_window.z=400
 
  case live_scroll
  when 0  
     update
     when 1  
       $live_scroll=true
  end
end  

def update
       for i in 0...(($tss_sy/480.0) * $tss_iteration) + $tss_iteration
          $tss_scroll_window.y -= $tss_speed
          Graphics.update
        end
        $tss_scroll_window.dispose
        $tss_bg_window.dispose
 end
end
#=================================================  ==
# ▲ CLASS Text_Scroller Ends
#=================================================  ==


#=================================================  ==
# ▼ CLASS Window_Scroll Begins
#=================================================  ==
class Window_Scroll < Window_Base

def initialize (file, sx, sy)
  @sx=sx
  @sy=sy
 
  super(0, 0, sx, sy)
  self.contents = Bitmap.new(width - 32, height - 32)
  self.contents.font.name = "Tahoma"
  self.contents.font.size = 24
  @text=IO.readlines("Text/#{file}")
  @text_color=0
  refresh
end

def refresh    
  y=0
     for i in 0...@text.size
       y+=32
       if @text[i].index('/') == 0
           @text_color=@text[i].slice! (0..2)
           @text_color.slice!(0)
       end  
       if @text[i].index('*') == 0
           line_color=@text[i].slice! (0..2)
           line_color.slice!(0)
          self.contents.font.color = text_color(line_color.to_i)
        else
       self.contents.font.color = text_color(@text_color.to_i)
       end
       self.contents.draw_text(0, y, @sx, 32, @text[i])
     end
end
end
#=================================================  ==
# ▲ CLASS Window_Scroll Ends
#=================================================  ==


#=================================================  ==
# ▼ CLASS Book_Scroll Begins
#=================================================  ==
class Book_Scroll

def initialize (book_name, number_of_pages, start_page, opacity_scroll, opacity_bg)
 
  file = book_name.to_s+"/"+start_page.to_s+".rxdata"
  text=IO.readlines("Text/#{file}")
  $tss_sy= (text.size*32) + 64
 
  $tss_scroll_window = Window_Scroll.new(file, 640, $tss_sy)
  $tss_scroll_window.opacity = opacity_scroll
  $tss_scroll_window.z=500
  $tss_scroll_window.x = 0
  $tss_scroll_window.y = 0
 
  $tss_bg_window = Window_bg.new
  $tss_bg_window.opacity = opacity_bg
  $tss_bg_window.z=400
 
  book_update(book_name, start_page, number_of_pages, opacity_scroll, opacity_bg)
  $game_system.menu_disabled = true
end  

def book_update(book_name,start_page, number_of_pages, opacity_scroll, opacity_bg)
  loop do
  Graphics.update
  Input.update
  if Input.repeat?(Input::RIGHT) and number_of_pages > 1
     unless start_page == number_of_pages
       start_page+=1
     else
       start_page=1
     end  
     $tss_scroll_window.dispose
     $tss_bg_window.dispose
     Book_Scroll.new(book_name, number_of_pages,start_page, opacity_scroll, opacity_bg)
     break
  end
  if Input.repeat?(Input::LEFT) and  number_of_pages > 1
     unless start_page == 1
       start_page-=1
     else
       start_page=number_of_pages
     end  
     $tss_scroll_window.dispose
     $tss_bg_window.dispose
     Book_Scroll.new(book_name, number_of_pages,start_page, opacity_scroll, opacity_bg)
     break
  end
  if Input.repeat?(Input::UP)
     $tss_scroll_window.y+=15
  end  
  if Input.repeat?(Input::DOWN)
     $tss_scroll_window.y-=15
  end  
  if Input.trigger?(Input::B)
     $tss_scroll_window.dispose
     $tss_bg_window.dispose
     $game_system.menu_disabled = false
     break
  end
end
end  
 
end
#=================================================  ==
# ▲ CLASS Book_Scroll Ends
#=================================================  ==


#=================================================  ==
# ▼ CLASS Scene_Map Additional Code Begins
#=================================================  ==
class Scene_Map

alias alex_tss_original_update update
@@i=0

def update
alex_tss_original_update
 
  if $live_scroll==true
      $tss_scroll_window.y -= $tss_speed
       @@i+=1
       if @@i ==(($tss_sy/480.0) * $tss_iteration) + $tss_iteration
         $tss_scroll_window.dispose
         $tss_bg_window.dispose
         @@i=0
         $live_scroll=false
       end  
  end
end
end
#=================================================  ==
# ▲ CLASS Scene_Map Additional Code Ends
#=================================================  ==


#=================================================  ==
# ▼ CLASS Window_bg Begins
#=================================================  ==
class Window_bg < Window_Base

def initialize
  super(0, 0, 640, 480)
end
end
#=================================================  ==
# ▲ CLASS Window_bg Ends
#=================================================  ==


And that is all their is to it.
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Auto-credits corbaque 0 3,001 11-23-2006, 01:00 PM
Last Post: corbaque
  Final Fantasy VII opening Credits Script squall789 0 2,345 08-30-2005, 01:00 PM
Last Post: squall789



Users browsing this thread: 1 Guest(s)