Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Golden sun intro script
#1
=============================================================
Golden sun intro script v1.2 By AZZY9
=============================================================
Jul 22 2006

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.


If you would like to use any of my scripts please give credit

Since there have been requests, i have made a Golden Sun
Intro.
Note : the menu only appears if there is a save game, if
there isnt then straight after the intro it would begin a
new game automatically as it does in the real game.

New features
I have created a erase save game script which is working in this
edited window skin to make it more golden sun like
better icon

Problems
When you copy a save game, the duration of you selecting it will be added onto the time of the saved
game that you will create by copying

If you would like yo import this script into your game this is how you do it.
WARNING! MAY INTERFEAR WITH OTHER SCRIPTS
  1. Replace scripts "Main" and "Scene_Load" in your game with the one in the script
  2. Delete the script called "Scene_title"
  3. copy the script "Golden Sun Intro" into your game above main.
  4. copy the script "Scene_Copy" and "Scene_Erase" into your game above main.
  5. copy the contents of "\Golden sun intro\Graphics\Pictures\" into your game's directory
  6. copy the contents of "\Golden sun intro\Audio\BGM" into your game's directory
  7. copy the contents of "\Golden sun intro\Audio\SE" into your game's directory

Code:
#==============================================================================
# Main
#==============================================================================

begin
# to have full screen true, to not false
  Full_Screen = true
  
case Full_Screen
when true
  $showm = Win32API.new 'user32', 'keybd_event', %w(l l l l), ''
$showm.call(18,0,0,0)
$showm.call(13,0,0,0)
$showm.call(13,0,2,0)
$showm.call(18,0,2,0)
end
# Font used in windows
$defaultfonttype = $fontface = $fontname = Font.default_name = "Tahoma"
# Font size used
$defaultfontsize = $fontsize = Font.default_size =  22
# トランジション準備
Graphics.freeze
# シーンオブジェクト (タイトル画面) を作成
$scene = Scene_Title.new
# $scene が有効な限り main メソッドを呼び出す
while $scene != nil
$scene.main
  end
# フェードアウト
Graphics.transition(20)
rescue Errno::ENOENT
# 例外 Errno::ENOENT を補足
# ファイルがオープンできなかった場合、メッセージを表示�
�て終了する
  filename = $!.message.sub("No such file or directory - ", "")
  print("File #{filename} not found.")
end


=begin
=============================================================
Golden sun intro script v1.2 By AZZY9
=============================================================
if you would like to use any of my scripts please give credit
  
Since there have been requests, i have made a Golden Sun
Intro.
Note : the menu only appears if there is a save game, if
there isnt then straight after the intro it would begin a
new game automatically as it does in the real game.

New features
  I have created a erase save game script which is working in this
  edited window skin to make it more golden sun like
  better icon
  
Problems
  When you copy a save game, the duration of you selecting it will be added onto the time of the saved
  game that you will create by copying


If you would like yo import this script into your game this is how you do it.
                         WARNING! MAY INTERFEAR WITH OTHER SCRIPTS
1. Replace scripts "Main" and "Scene_Load" in your game with the one in the script
2. Delete the script called "Scene_title"
3. copy the script "Golden Sun Intro" into your game above main.
4. copy the script "Scene_Copy" and "Scene_Erase" into your game above main.
5. copy the contents of "\Golden sun intro\Graphics\Pictures\" into your game's directory
6. copy the contents of "\Golden sun intro\Audio\BGM" into your game's directory
7. copy the contents of "\Golden sun intro\Audio\SE" into your game's directory
=end

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

    
    @Background = Sprite.new
     @Background.bitmap = RPG::Cache.picture("Nintendo")
     Audio.se_play("Audio/SE/" + "Start", 100, 100)
    @Background.opacity = 255
    @Background_c = 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @Background.dispose
      Audio.bgm_stop
  end
end
  def update
    @Background.update
    @Background_c = (@Background_c + 1)
  case @Background_c  
when 50
@Background.bitmap = RPG::Cache.picture("Blank")
@Background.opacity = 255
when 60
@Background.bitmap = RPG::Cache.picture("CSP")
@Background.opacity = 255
when 110
@Background.bitmap = RPG::Cache.picture("Blank")
@Background.opacity = 255
Audio.bgm_play("Audio/BGM/" + "Intro", 100, 100)
when 120
@Background.bitmap = RPG::Cache.picture("Main")
@Background.opacity = 255
when 150
@Background.bitmap = RPG::Cache.picture("Mains")
@Background.opacity = 255
when 180
@Background_c = 119
end
    if Input.trigger?(Input::C)
   for i in 0..3
    if FileTest.exist?("Save#{i+1}.sav")
    @continue_enabled = true
    end
end
if @continue_enabled
    $scene = Menubgm.new
    else
$scene = Menunew.new
    end
  end
end

#============================================================
class Menubgm
  def main
Audio.bgm_play("Audio/BGM/" + "Menu", 100, 100)
    $scene = Menu.new
  end
end

class Menunew
def main

      $game_system.se_play($data_system.decision_se)
    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
    $game_map.autoplay
    $game_map.update
    $scene = Scene_Map.new
  end
end
#============================================================

  class Menu

  def main

    @Background = Sprite.new
     @Background.bitmap = RPG::Cache.picture("Newgames")
    @Background.opacity = 255
    @Background_c = 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @Background.dispose
  end
  def update
    @Background.update
    @Background_c = (@Background_c + 1)
  case @Background_c  
when 20
@Background.bitmap = RPG::Cache.picture("Newgame")
@Background.opacity = 255
when 40
@Background.bitmap = RPG::Cache.picture("Newgames")
@Background.opacity = 255
when 60
@Background_c = 19
end
    if Input.trigger?(Input::C)
$scene = Menunew.new
Audio.bgm_stop
end
if Input.trigger?(Input::RIGHT)
$scene = Continue.new
    end
  end
  end

#============================================================

  class Continue

  def main

    @Background = Sprite.new
    @Background.bitmap = RPG::Cache.picture("Continues")
    @Background.opacity = 255
    @Background_c = 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @Background.dispose
  end
  def update
    @Background.update
    @Background_c = (@Background_c + 1)
  case @Background_c  
when 20
@Background.bitmap = RPG::Cache.picture("Continue")
@Background.opacity = 255
when 40
@Background.bitmap = RPG::Cache.picture("Continues")
@Background.opacity = 255
when 60
@Background_c = 19
end
    if Input.trigger?(Input::C)
    $game_system.se_play($data_system.decision_se)
    $scene = Scene_Load.new
end
if Input.trigger?(Input::LEFT)
$scene = Menu.new
end
if Input.trigger?(Input::RIGHT)
$scene = Copy.new
    end
  end
  end


#============================================================

  class Copy

  def main

    @Background = Sprite.new
     @Background.bitmap = RPG::Cache.picture("Copys")
    @Background.opacity = 255
    @Background_c = 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @Background.dispose
  end
  def update
    @Background.update
    @Background_c = (@Background_c + 1)
  case @Background_c  
when 20
@Background.bitmap = RPG::Cache.picture("Copy")
@Background.opacity = 255
when 40
@Background.bitmap = RPG::Cache.picture("Copys")
@Background.opacity = 255
when 60
@Background_c = 19
end
    if Input.trigger?(Input::C)
$scene = Scene_Copy.new
end
if Input.trigger?(Input::LEFT)
$scene = Continue.new
end
if Input.trigger?(Input::RIGHT)
$scene = Erase.new
    end
  end
      end

#============================================================

  class Erase

  def main

    @Background = Sprite.new
     @Background.bitmap = RPG::Cache.picture("Erases")
    @Background.opacity = 255
    @Background_c = 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @Background.dispose
  end
  def update
    @Background.update
    @Background_c = (@Background_c + 1)
  case @Background_c  
when 20
@Background.bitmap = RPG::Cache.picture("Erase")
@Background.opacity = 255
when 40
@Background.bitmap = RPG::Cache.picture("Erases")
@Background.opacity = 255
when 60
@Background_c = 19
end
if Input.trigger?(Input::C)
    $scene = Scene_Erase.new
end
if Input.trigger?(Input::LEFT)
$scene = Copy.new
end
end
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
    $game_temp.battle_troop_id = $data_system.test_troop_id
    $game_temp.battle_can_escape = true
    $game_map.battleback_name = $data_system.battleback_name
    $game_system.se_play($data_system.battle_start_se)
    $game_system.bgm_play($game_system.battle_bgm)
    $scene = Scene_Battle.new
  end


#==============================================================================
#  Copy save Files By AZZY9 V1.0
#==============================================================================

class Scene_Copy < Scene_File
  def initialize
    $game_temp = Game_Temp.new
    $game_temp.last_file_index = 0
    latest_time = Time.at(0)
    for i in 0..3
      filename = make_filename(i)
      if FileTest.exist?(filename)
        file = File.open(filename, "r")
        if file.mtime > latest_time
          latest_time = file.mtime
          $game_temp.last_file_index = i
        end
        file.close
      end
    end
    super("Copy from which file")
  end
  def on_decision(filename)
    unless FileTest.exist?(filename)
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    $game_system.se_play($data_system.load_se)
    file = File.open(filename, "rb")
    read_save_data(file)
    file.close
    $scene = Scene_Copy2.new
  end
  def on_cancel
    $scene = Copy.new
  end
  def read_save_data(file)
    characters = Marshal.load(file)
    Graphics.frame_count = Marshal.load(file)
    $game_system        = Marshal.load(file)
    $game_switches      = Marshal.load(file)
    $game_variables     = Marshal.load(file)
    $game_self_switches = Marshal.load(file)
    $game_screen        = Marshal.load(file)
    $game_actors        = Marshal.load(file)
    $game_party         = Marshal.load(file)
    $game_troop         = Marshal.load(file)
    $game_map           = Marshal.load(file)
    $game_player        = Marshal.load(file)
  end
end


class Scene_Copy2 < Scene_File
  def initialize
    super("Copy to which file?")
  end
  def on_decision(filename)
    $game_system.se_play($data_system.save_se)
    file = File.open(filename, "wb")
    write_save_data(file)
    file.close
    if $game_temp.save_calling
      $game_temp.save_calling = false
      $scene = Scene_Copy.new
      return
    end
    $scene = Scene_Copy.new
  end
  def on_cancel
    $game_system.se_play($data_system.cancel_se)
    if $game_temp.save_calling
      $game_temp.save_calling = false
      return
    end
    $scene = Copy.new
  end
  def write_save_data(file)
    characters = []
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      characters.push([actor.character_name, actor.character_hue])
    end
    Marshal.dump(characters, file)
    Marshal.dump(Graphics.frame_count, file)
    $game_system.save_count += 1
    $game_system.magic_number = $data_system.magic_number
    Marshal.dump($game_system, file)
    Marshal.dump($game_switches, file)
    Marshal.dump($game_variables, file)
    Marshal.dump($game_self_switches, file)
    Marshal.dump($game_screen, file)
    Marshal.dump($game_actors, file)
    Marshal.dump($game_party, file)
    Marshal.dump($game_troop, file)
    Marshal.dump($game_map, file)
    Marshal.dump($game_player, file)
  end
end

#==============================================================================
#  Erase save Files By AZZY9 V1.0
#==============================================================================

class Scene_Erase < Scene_File
  def initialize
    $game_temp = Game_Temp.new
    $game_temp.last_file_index = 0
    latest_time = Time.at(0)
    for i in 0..3
      filename = make_filename(i)
if FileTest.exist?(filename)
        file = File.open(filename, "r")
        if file.mtime > latest_time
          latest_time = file.mtime
          $game_temp.last_file_index = i
        end
        file.close
      end
    end
    super("Erase which file")
  end
  def on_decision(filename)
    unless FileTest.exist?(filename)
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    $game_system.se_play($data_system.load_se)
    File.delete(filename)
  $scene = Scene_Erase.new
  end
  def on_cancel
    $scene = Erase.new
  end
end

#==============================================================================
#  Scene_Load
#==============================================================================

class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    # テンポラリオブジェクトを再作成
    $game_temp = Game_Temp.new
    # タイムスタンプが最新のファイルを選択
    $game_temp.last_file_index = 0
    latest_time = Time.at(0)
    for i in 0..3
      filename = make_filename(i)
      if FileTest.exist?(filename)
        file = File.open(filename, "r")
        if file.mtime > latest_time
          latest_time = file.mtime
          $game_temp.last_file_index = i
        end
        file.close
      end
    end
    super("Load from which file")
  end
  #--------------------------------------------------------------------------
  # ● 決定時の処理
  #--------------------------------------------------------------------------
  def on_decision(filename)
    # ファイルが存在しない場合
    unless FileTest.exist?(filename)
      # ブザー SE を演奏
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    # ロード SE を演奏
    $game_system.se_play($data_system.load_se)
    # セーブデータの書き込み
    file = File.open(filename, "rb")
    read_save_data(file)
    file.close
    # BGM、BGS を復帰
    $game_system.bgm_play($game_system.playing_bgm)
    $game_system.bgs_play($game_system.playing_bgs)
    # マップを更新 (並列イベント実行)
    $game_map.update
    # マップ画面に切り替え
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  # ● キャンセル時の処理
  #--------------------------------------------------------------------------
  def on_cancel
    # キャンセル SE を演奏
    $game_system.se_play($data_system.cancel_se)
    # タイトル画面に切り替え
    $scene = Menubgm.new
  end
  #--------------------------------------------------------------------------
  # ● セーブデータの読み込み
  #     file : 読み込み用ファイルオブジェクト (オープン済み)
  #--------------------------------------------------------------------------
  def read_save_data(file)
    # セーブファイル描画用のキャラクターデータを読み込む
    characters = Marshal.load(file)
    # プレイ時間計測用のフレームカウントを読み込む
    Graphics.frame_count = Marshal.load(file)
    # 各種ゲームオブジェクトを読み込む
    $game_system        = Marshal.load(file)
    $game_switches      = Marshal.load(file)
    $game_variables     = Marshal.load(file)
    $game_self_switches = Marshal.load(file)
    $game_screen        = Marshal.load(file)
    $game_actors        = Marshal.load(file)
    $game_party         = Marshal.load(file)
    $game_troop         = Marshal.load(file)
    $game_map           = Marshal.load(file)
    $game_player        = Marshal.load(file)
    if $game_system.magic_number != $data_system.magic_number
      # マップをリロード
      $game_map.setup($game_map.map_id)
      $game_player.center($game_player.x, $game_player.y)
    end
    $game_party.refresh
  end
end
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  My First Script smiley_man 0 2,149 12-24-2005, 01:00 PM
Last Post: smiley_man



Users browsing this thread: