| 赞 | 0 |
| VIP | 0 |
| 好人卡 | 0 |
| 积分 | 1 |
| 经验 | 0 |
| 最后登录 | 2026-6-24 |
| 在线时间 | 4 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 60
- 在线时间
- 4 小时
- 注册时间
- 2026-6-21
- 帖子
- 4
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 31号焦糖色 于 2026-6-23 20:14 编辑
RPG解密游戏简易菜单模板(含增加菜单读档、更换领队、存档位增加、繁体改简体等)
序号 脚本名称 类型 内容
1 Scene_Menu 修改 精简菜单为 4 项:物品、读档、队形、结束游戏
2 Scene_Formation 新建 队形调整场景,用 ← → 交换角色位置,自动更新领队变量
3 Scene_File 修改 存档位从 4 个扩展到 20 个,支持上下滚动选择
4 Vocab 修改 界面用语全部从繁体转简体
Scene_Menu - #==============================================================================
- # ** Scene_Menu
- #------------------------------------------------------------------------------
- # 菜單:物品 / 读档 / 队形 / 结束游戏
- #==============================================================================
- class Scene_Menu < Scene_Base
- #--------------------------------------------------------------------------
- # * 物件初始化
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0)
- @menu_index = 0 # 光標永遠在第一項
- end
- #--------------------------------------------------------------------------
- # * 程式開始
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- create_command_window
- @status_window = Window_MenuStatus.new(160, 0)
- end
- #--------------------------------------------------------------------------
- # * 程式中止
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @command_window.dispose
- @status_window.dispose
- end
- #--------------------------------------------------------------------------
- # * 更新幀
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @command_window.update
- @status_window.update
- if @command_window.active
- update_command_selection
- elsif @status_window.active
- update_actor_selection
- end
- end
- #--------------------------------------------------------------------------
- # * 創建命令視窗(4項)
- #--------------------------------------------------------------------------
- def create_command_window
- s1 = Vocab::item # 物品
- s2 = "读档" # 读档
- s3 = "队形" # 队形 ★ 新增
- s4 = Vocab::game_end # 结束游戏
- @command_window = Window_Command.new(160, [s1, s2, s3, s4])
- @command_window.index = @menu_index
- @command_window.refresh
-
- # 隊伍為空時禁用物品和隊形
- if $game_party.members.size == 0
- @command_window.draw_item(0, false)
- @command_window.draw_item(2, false)
- end
- # 隊伍只有1人時禁用隊形
- if $game_party.members.size <= 1
- @command_window.draw_item(2, false)
- end
- end
- #--------------------------------------------------------------------------
- # * 更新指令選擇
- #--------------------------------------------------------------------------
- def update_command_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- elsif Input.trigger?(Input::C)
- if $game_party.members.size == 0 and @command_window.index == 0
- Sound.play_buzzer
- return
- elsif $game_party.members.size <= 1 and @command_window.index == 2
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- case @command_window.index
- when 0 # 物品
- $scene = Scene_Item.new
- when 1 # 读档
- $scene = Scene_File.new(false, false, false)
- when 2 # 队形 ★ 新增
- $scene = Scene_Formation.new
- when 3 # 结束游戏
- $scene = Scene_End.new
- end
- end
- end
- #--------------------------------------------------------------------------
- # * 開始接收角色選擇指令
- #--------------------------------------------------------------------------
- def start_actor_selection
- @command_window.active = false
- @status_window.active = true
- if $game_party.last_actor_index < @status_window.item_max
- @status_window.index = $game_party.last_actor_index
- else
- @status_window.index = 0
- end
- end
- #--------------------------------------------------------------------------
- # * 停止接收角色選擇指令
- #--------------------------------------------------------------------------
- def end_actor_selection
- @command_window.active = true
- @status_window.active = false
- @status_window.index = -1
- end
- #--------------------------------------------------------------------------
- # * 更新角色選擇
- #--------------------------------------------------------------------------
- def update_actor_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_actor_selection
- elsif Input.trigger?(Input::C)
- $game_party.last_actor_index = @status_window.index
- Sound.play_decision
- case @command_window.index
- when 1 # 技能(保留擴展接口)
- $scene = Scene_Skill.new(@status_window.index)
- when 2 # 整備(保留擴展接口)
- $scene = Scene_Equip.new(@status_window.index)
- when 3 # 狀態(保留擴展接口)
- $scene = Scene_Status.new(@status_window.index)
- end
- end
- end
- end
复制代码
Scene_Formation(在 Main 之前、Scene_Base 之后新建该脚本即可) - #==============================================================================
- # ** Scene_Formation
- #------------------------------------------------------------------------------
- # 隊形調整場景
- # 操作:↑↓選擇角色,←→移動位置,ESC返回
- #==============================================================================
- class Scene_Formation < Scene_Base
- #--------------------------------------------------------------------------
- # * 物件初始化
- #--------------------------------------------------------------------------
- def initialize
- @index = 0
- end
- #--------------------------------------------------------------------------
- # * 程式開始
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- create_status_window
- create_help_window
- end
- #--------------------------------------------------------------------------
- # * 程式中止
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @status_window.dispose
- @help_window.dispose
- end
- #--------------------------------------------------------------------------
- # * 更新幀
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @status_window.update
- @help_window.update
- if @status_window.active
- update_formation
- end
- end
- #--------------------------------------------------------------------------
- # * 創建角色狀態視窗
- #--------------------------------------------------------------------------
- def create_status_window
- @status_window = Window_MenuStatus.new(0, 56)
- @status_window.active = true
- @status_window.index = @index
- end
- #--------------------------------------------------------------------------
- # * 創建提示視窗
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_Base.new(0, 0, 544, 56)
- @help_window.contents.clear
- text = "← → 调整位置 ESC 返回"
- @help_window.contents.draw_text(0, 0, @help_window.contents.width, 24, text, 1)
- end
- #--------------------------------------------------------------------------
- # * 更新隊形操作
- #--------------------------------------------------------------------------
- def update_formation
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Menu.new(2) # 返回菜單,停在「隊形」選項
- elsif Input.trigger?(Input::LEFT)
- # 左鍵:角色上移(和前面一個交換)
- move_up
- elsif Input.trigger?(Input::RIGHT)
- # 右鍵:角色下移(和後面一個交換)
- move_down
- end
- end
- #--------------------------------------------------------------------------
- # * 角色上移
- #--------------------------------------------------------------------------
- def move_up
- index = @status_window.index
- # 已經是第一個,不能再上移
- if index <= 0
- Sound.play_buzzer
- return
- end
- Sound.play_cursor
- # 交換隊伍中 index 和 index-1 的位置
- actors = $game_party.instance_variable_get(:@actors)
- actors[index], actors[index - 1] = actors[index - 1], actors[index]
- # 刷新顯示
- @status_window.refresh
- @status_window.index = index - 1
- # ★ 修復:刷新地圖上的玩家角色圖形
- $game_player.refresh
- end
- #--------------------------------------------------------------------------
- # * 角色下移
- #--------------------------------------------------------------------------
- def move_down
- index = @status_window.index
- # 已經是最後一個,不能再下移
- if index >= $game_party.members.size - 1
- Sound.play_buzzer
- return
- end
- Sound.play_cursor
- # 交換隊伍中 index 和 index+1 的位置
- actors = $game_party.instance_variable_get(:@actors)
- actors[index], actors[index + 1] = actors[index + 1], actors[index]
- # 刷新顯示
- @status_window.refresh
- @status_window.index = index + 1
- # ★ 修復:刷新地圖上的玩家角色圖形
- $game_player.refresh
- end
- end
复制代码
Scene_File - #==============================================================================
- # ** Scene_File
- #------------------------------------------------------------------------------
- # 存檔 / 讀檔場景(默认增加至20個存檔位,可滾動)
- # 修復版:支持標準VX格式(15項),自動兼容舊存檔
- #==============================================================================
- class Scene_File < Scene_Base
- #--------------------------------------------------------------------------
- # ★ 配置:存檔位數量
- #--------------------------------------------------------------------------
- SAVEFILE_COUNT = 20 # 總共多少個存檔位(改這裡就行)
- VISIBLE_ROWS = 4 # 一屏顯示幾個
-
- #--------------------------------------------------------------------------
- # * 物件初始化
- #--------------------------------------------------------------------------
- def initialize(saving, from_title, from_event)
- @saving = saving
- @from_title = from_title
- @from_event = from_event
- end
- #--------------------------------------------------------------------------
- # * 開始處理
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- @help_window = Window_Help.new
- @help_window.set_text(@saving ? Vocab::SaveMessage : Vocab::LoadMessage)
- @top_index = 0
- @savefile_windows = []
- (0...VISIBLE_ROWS).each do |i|
- filename = "Save#{i + 1}.rvdata"
- @savefile_windows[i] = Window_SaveFile.new(i, filename)
- @savefile_windows[i].y = 56 + i * 90
- end
- if @saving
- @index = $game_temp.last_file_index
- else
- @index = latest_file_index
- end
- @top_index = [@index - VISIBLE_ROWS + 1, 0].max
- @top_index = [@top_index, @index].min
- refresh_savefile_windows
- @savefile_windows[@index - @top_index].selected = true
- end
- #--------------------------------------------------------------------------
- # * 結束處理
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @help_window.dispose
- @savefile_windows.each { |window| window.dispose }
- end
- #--------------------------------------------------------------------------
- # * 更新畫面
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @help_window.update
- @savefile_windows.each { |window| window.update }
- update_savefile_selection
- end
- #--------------------------------------------------------------------------
- # * 刷新存檔位窗口
- #--------------------------------------------------------------------------
- def refresh_savefile_windows
- (0...VISIBLE_ROWS).each do |i|
- file_index = @top_index + i
- window = @savefile_windows[i]
-
- if file_index < SAVEFILE_COUNT
- window.visible = true
- filename = "Save#{file_index + 1}.rvdata"
- window.instance_variable_set(:@file_index, file_index)
- window.instance_variable_set(:@filename, filename)
- begin
- window.load_gamedata
- rescue
- window.instance_variable_set(:@file_exist, false)
- end
- window.refresh
- window.selected = (file_index == @index)
- window.y = 56 + i * 90
- else
- window.visible = false
- end
- end
- end
- #--------------------------------------------------------------------------
- # * 更新存檔檔案選擇
- #--------------------------------------------------------------------------
- def update_savefile_selection
- if Input.trigger?(Input::C)
- determine_savefile
- elsif Input.trigger?(Input::B)
- Sound.play_cancel
- return_scene
- else
- last_index = @index
- if Input.repeat?(Input::DOWN)
- cursor_down(Input.trigger?(Input::DOWN))
- end
- if Input.repeat?(Input::UP)
- cursor_up(Input.trigger?(Input::UP))
- end
- if @index != last_index
- Sound.play_cursor
- old_visible = last_index - @top_index
- if old_visible >= 0 && old_visible < VISIBLE_ROWS
- @savefile_windows[old_visible].selected = false
- end
- if @index < @top_index
- @top_index = @index
- refresh_savefile_windows
- elsif @index >= @top_index + VISIBLE_ROWS
- @top_index = @index - VISIBLE_ROWS + 1
- refresh_savefile_windows
- end
- new_visible = @index - @top_index
- if new_visible >= 0 && new_visible < VISIBLE_ROWS
- @savefile_windows[new_visible].selected = true
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # * 確定存檔/讀檔
- #--------------------------------------------------------------------------
- def determine_savefile
- if @saving
- Sound.play_save
- do_save
- else
- if @savefile_windows[@index - @top_index].file_exist
- Sound.play_load
- do_load
- else
- Sound.play_buzzer
- return
- end
- end
- $game_temp.last_file_index = @index
- end
- #--------------------------------------------------------------------------
- # * 游標下移
- #--------------------------------------------------------------------------
- def cursor_down(wrap)
- if @index < SAVEFILE_COUNT - 1 or wrap
- @index = (@index + 1) % SAVEFILE_COUNT
- end
- end
- #--------------------------------------------------------------------------
- # * 游標上移
- #--------------------------------------------------------------------------
- def cursor_up(wrap)
- if @index > 0 or wrap
- @index = (@index - 1 + SAVEFILE_COUNT) % SAVEFILE_COUNT
- end
- end
- #--------------------------------------------------------------------------
- # * 獲取最新存檔的索引
- #--------------------------------------------------------------------------
- def latest_file_index
- index = 0
- latest_time = Time.at(0)
- (0...SAVEFILE_COUNT).each do |i|
- filename = "Save#{i + 1}.rvdata"
- if FileTest.exist?(filename)
- time = File.mtime(filename)
- if time > latest_time
- latest_time = time
- index = i
- end
- end
- end
- return index
- end
- #--------------------------------------------------------------------------
- # * 執行存檔(標準VX格式,15項)
- #--------------------------------------------------------------------------
- def do_save
- filename = "Save#{@index + 1}.rvdata"
- current_window = @savefile_windows[@index - @top_index]
- current_window.selected = false
-
- file = File.open(filename, "wb")
- write_save_data(file)
- file.close
-
- current_window.load_gamedata rescue nil
- current_window.refresh
- current_window.selected = true
- Sound.play_save
- return_scene
- end
- #--------------------------------------------------------------------------
- # * 執行讀檔(自動嘗試多種格式)
- #--------------------------------------------------------------------------
- def do_load
- filename = "Save#{@index + 1}.rvdata"
- unless FileTest.exist?(filename)
- Sound.play_buzzer
- return
- end
- Sound.play_load
-
- # 先嘗試格式一:標準VX格式(15項,BGM在後)
- begin
- file = File.open(filename, "rb")
- read_save_data_standard(file)
- file.close
- rescue
- file.close rescue nil
- # 失敗就嘗試格式二:BGM在前(14項)
- begin
- file = File.open(filename, "rb")
- read_save_data_bgm_first(file)
- file.close
- rescue
- file.close rescue nil
- # 都失敗就報錯
- Sound.play_buzzer
- return
- end
- end
-
- $scene = Scene_Map.new
- RPG::BGM.fade(1500)
- Graphics.fadeout(60)
- Graphics.wait(40)
- @last_bgm.play rescue nil
- @last_bgs.play rescue nil
- end
- #--------------------------------------------------------------------------
- # * 寫入存檔數據(標準VX格式,15項,BGM在後)
- #--------------------------------------------------------------------------
- def write_save_data(file)
- characters = []
- for i in 0...$game_party.members.size
- actor = $game_party.members[i]
- characters.push([actor.character_name, actor.character_index])
- end
- $game_system.save_count += 1
- $game_system.version_id = $data_system.version_id
- @last_bgm = RPG::BGM.last
- @last_bgs = RPG::BGS.last
-
- Marshal.dump(characters, file) # 1
- Marshal.dump(Graphics.frame_count, file) # 2
- Marshal.dump($game_system, file) # 3
- Marshal.dump($game_message, file) # 4
- Marshal.dump($game_switches, file) # 5
- Marshal.dump($game_variables, file) # 6
- Marshal.dump($game_self_switches, file) # 7
- Marshal.dump($game_screen, file) # 8 ★ 加上畫面數據
- Marshal.dump($game_actors, file) # 9
- Marshal.dump($game_party, file) # 10
- Marshal.dump($game_troop, file) # 11
- Marshal.dump($game_map, file) # 12
- Marshal.dump($game_player, file) # 13
- Marshal.dump(@last_bgm, file) # 14
- Marshal.dump(@last_bgs, file) # 15
- end
- #--------------------------------------------------------------------------
- # * 讀取存檔 格式一:標準VX(15項,BGM在後)
- #--------------------------------------------------------------------------
- def read_save_data_standard(file)
- characters = Marshal.load(file)
- Graphics.frame_count = Marshal.load(file)
- $game_system = Marshal.load(file)
- $game_message = 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)
- @last_bgm = Marshal.load(file)
- @last_bgs = Marshal.load(file)
-
- if $game_system.version_id != $data_system.version_id
- $game_map.setup($game_map.map_id)
- $game_player.center($game_player.x, $game_player.y)
- end
-
- $game_party.members.size.times do |i|
- $game_actors[$game_party.members[i].id].setup($game_party.members[i].id)
- end
- end
- #--------------------------------------------------------------------------
- # * 讀取存檔 格式二:BGM在前(14項,無game_screen)
- #--------------------------------------------------------------------------
- def read_save_data_bgm_first(file)
- characters = Marshal.load(file)
- Graphics.frame_count = Marshal.load(file)
- @last_bgm = Marshal.load(file)
- @last_bgs = Marshal.load(file)
- $game_system = Marshal.load(file)
- $game_message = Marshal.load(file)
- $game_switches = Marshal.load(file)
- $game_variables = Marshal.load(file)
- $game_self_switches = 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.version_id != $data_system.version_id
- $game_map.setup($game_map.map_id)
- $game_player.center($game_player.x, $game_player.y)
- end
-
- $game_party.members.size.times do |i|
- $game_actors[$game_party.members[i].id].setup($game_party.members[i].id)
- end
- end
- #--------------------------------------------------------------------------
- # * 返回原場景
- #--------------------------------------------------------------------------
- def return_scene
- if @from_title
- $scene = Scene_Title.new
- elsif @from_event
- $scene = Scene_Map.new
- else
- $scene = Scene_Menu.new(1) # 返回菜單,停在「讀檔」位置
- end
- end
- end
复制代码
Vocab Tips:还需要手动改的地方
Vocab 里的 level、hp、mp、atk、item、save 这些方法返回的是数据库里设置的用语,脚本里改不了,需要去数据库里改:
- 打开数据库(F9)
- 切换到「系统」标签
- 找到「用语」一栏
- 把里面的繁体词条逐个改成简体
改完这两处,游戏的系统界面文字就基本都是简体了。剩下的物品名、技能名、对话等需要去数据库和事件里手动改。 |
|