I want to display a background image on my script for my menu

Ayanamiku

Villager
Member
Joined
Mar 1, 2021
Messages
6
Reaction score
8
First Language
Français
Primarily Uses
RMXP
Hello, after several hours of trying to modify the script myself, I can't find the solution to just display a background image on my menu. So either a base image for each of the sub-menus, or a specific image for each sub-menu. The photos will better explain what I want. When I select a submenu I have the choice of my characters before entering the submenu and it is here that I would like a background image. Thanks in advance

#============================================================================== #---------------------------------------------------------------------------- # ○ OSD - 腳本討論社 # Originality RGSS Discuss # └http://guild.gamer.com.tw/guild.php?sn=4707 #---------------------------------------------------------------------------- #============================================================================== #-------------------------------------------------------------------------- # ● 腳本名稱:Scene_Menu #-------------------------------------------------------------------------- # ● 腳本效果: # 套用成新的主選單畫面, # 人物立繪顯示要以資料庫人物名稱為命名, # 位置要在 Graphics\Pictures 之下。 # 人物圖示顯示要以資料庫人物行走圖名稱為命名, # 位置要在 Graphics\Pictures 之下。 #-------------------------------------------------------------------------- # ● 腳本版本:1.00 版 #-------------------------------------------------------------------------- # ● 腳本更新區塊: # 目前並無更新 #-------------------------------------------------------------------------- #============================================================================== #---------------------------------------------------------------------------- # ○ OSD - 腳本討論社 # Originality RGSS Discuss # └http://guild.gamer.com.tw/guild.php?sn=4707 #---------------------------------------------------------------------------- #============================================================================== #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ # 處理角色的類別。 # 使用在 Game_Actors ($game_actors)、Game_Party ($game_party) 類別的內部。 #============================================================================== class Game_Actor < Game_Battler def now_exp return @exp - @exp_list[@level] end def next_exp return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0 end end #============================================================================== # ■ Scene_Menu #------------------------------------------------------------------------------ # 處理選單畫面的類別。 #============================================================================== class Scene_Menu #-------------------------------------------------------------------------- # ● 初始化目標 # menu_index : 命令游標的初期位置 #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index # 獲取角色資料 @actor = [$game_party.actors[0], $game_party.actors[1], $game_party.actors[2], $game_party.actors[3]] @direction = 0 @actor_index = 0 @command = false end #-------------------------------------------------------------------------- # ● 主處理 #-------------------------------------------------------------------------- def main # 描繪背景 @sprite = Spriteset_Map.new # 繪製背景 @menu_back = RPG::Sprite.new @menu_back.bitmap = Bitmap.new(640, 480) (0...50).each {|i| @menu_back.bitmap.fill_rect(0, i, 640, 1, Color.new(0, 0, 0, 255 - i * 5)) @menu_back.bitmap.fill_rect(0, 480 - i, 640, 1, Color.new(0, 0, 0, 255 - i * 5)) } @menu_mask = RPG::Sprite.new @menu_mask.bitmap = Bitmap.new(640, 480) @menu_mask.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 160)) @menu_mask.visible = false @menu_mask.z = 999 # 描繪主選項 @main_command = Sprite.new @main_command.bitmap = Bitmap.new(640, 480) @main_command.bitmap.font.size = 17 @main_command.bitmap.font.bold = true @main_command.bitmap.draw_text(170, 0, 160, 74, "Sac") @main_command.bitmap.draw_text(210, 0, 160, 74, "Compétence") @main_command.bitmap.draw_text(310, 0, 160, 74, "Equipement") @main_command.bitmap.draw_text(408, 0, 160, 74, "statut") @main_command.bitmap.draw_text(460, 0, 160, 74, "sauvegarder") @main_command.bitmap.draw_text(560, 0, 160, 74, "Quitter") @main_command.opacity = 200 @main_command.z = 100 # 描繪主選項背景 @main_command_back = Sprite.new @main_command_back.bitmap = Bitmap.new(640, 480) (0...16).each {|b| (0...500).each {|i| # 中間黑色底層 @main_command_back.bitmap.fill_rect(640 - i * 2, b * 2 + 20, 2, 2, Color.new(0, 0, 0, 255 - i)) # 上下白色邊框 @main_command_back.bitmap.fill_rect(640 - i * 2, 18, 2, 2, Color.new(255, 255, 255, 255 - i)) @main_command_back.bitmap.fill_rect(640 - i * 2, 52, 2, 2, Color.new(255, 255, 255, 255 - i)) } } # 建立人物立繪 @actor_graphic = RPG::Sprite.new # 建立人物資訊 @actor_data = RPG::Sprite.new @actor_data.bitmap = Bitmap.new(640, 480) # 描繪角色資料 actor_data_refresh # 描繪隊伍資料 @party_data = RPG::Sprite.new @party_data.bitmap = Bitmap.new(640, 480) party_data_refresh # 描繪選項框 @arrow = RPG::Sprite.new @arrow.bitmap = Bitmap.new(640, 480) @arrow.bitmap.font.size = 30 (0...36).each {|i| @arrow.bitmap.draw_text(i, 0, 74, 74, "●") } @arrow.opacity = 150 @arrow.x = @menu_index * 74 + 180#180 @arrow.y = -1 @arrow.z = 90 # 描繪選擇人物資料 @choose_actor_data = RPG::Sprite.new @choose_actor_data.bitmap = Bitmap.new(640, 480) @choose_actor_data.z = 1000 # 執行過渡 Graphics.transition # 主循環 loop do # 更新遊戲畫面 Graphics.update # 更新輸入訊息 Input.update # 更新畫面 update # 如果切換畫面就中斷循環 if $scene != self break end end # 準備過渡 Graphics.freeze @main_command.dispose @main_command_back.dispose @actor_graphic.dispose @actor_data.dispose @party_data.dispose @arrow.dispose @choose_actor_data.dispose @menu_mask.dispose @menu_back.dispose end #-------------------------------------------------------------------------- # ● 更新畫面 #-------------------------------------------------------------------------- def update if !@command update_back update_input update_enter_input update_arrow update_actor_change else update_actor_choose update_actor_choose_enter end end #-------------------------------------------------------------------------- # ● 返回地圖畫面 #-------------------------------------------------------------------------- def update_back # 按下 B 鍵的情況下 if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 切換的地圖畫面 $scene = Scene_Map.new return end end #-------------------------------------------------------------------------- # ● 偵測按鍵 #-------------------------------------------------------------------------- def update_input # 按下 → 鍵的情況下 if Input.trigger?(Input::RIGHT) # 播放游標移動音效 $game_system.se_play($data_system.cursor_se) @menu_index += 1 if @menu_index < 6 @menu_index = 0 if @menu_index > 5 @direction = 1 return end # 按下 ← 鍵的情況下 if Input.trigger?(Input::LEFT) # 播放游標移動音效 $game_system.se_play($data_system.cursor_se) @menu_index -= 1 if @menu_index > -1 @menu_index = 5 if @menu_index < 0 @direction = 2 return end end #-------------------------------------------------------------------------- # ● 更新選項滑動 #-------------------------------------------------------------------------- def update_arrow case @menu_index when 0 if @direction == 2 @arrow.x -= 10 if @arrow.x > 180 @arrow.x = 180 if @arrow.x < 180 elsif @direction == 1 @arrow.x -= 30 if @arrow.x > 180 @arrow.x = 180 if @arrow.x < 180 end when 1 if @direction == 2 @arrow.x -= 10 if @arrow.x > 254 @arrow.x = 254 if @arrow.x < 254 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 254 @arrow.x = 254 if @arrow.x > 254 end when 2 if @direction == 2 @arrow.x -= 10 if @arrow.x > 328 @arrow.x = 328 if @arrow.x < 328 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 328 @arrow.x = 328 if @arrow.x > 328 end when 3 if @direction == 2 @arrow.x -= 10 if @arrow.x > 402 @arrow.x = 402 if @arrow.x < 402 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 402 @arrow.x = 402 if @arrow.x > 402 end when 4 if @direction == 2 @arrow.x -= 10 if @arrow.x > 476 @arrow.x = 476 if @arrow.x < 476 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 476 @arrow.x = 476 if @arrow.x > 476 end when 5 if @direction == 2 @arrow.x += 30 if @arrow.x < 550 @arrow.x = 550 if @arrow.x > 550 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 550 @arrow.x = 550 if @arrow.x > 550 end end end #-------------------------------------------------------------------------- # ● 偵測按鍵 #-------------------------------------------------------------------------- def update_enter_input # 按下 C 鍵的情況下 if Input.trigger?(Input::C) # 同伴人數為 0、存檔、遊戲結束以外的場合 if $game_party.actors.size == 0 and @command_window.index < 4 # 演奏凍結 SE $game_system.se_play($data_system.buzzer_se) return end # 獲取目前的位置 case @menu_index when 0 # 物品 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到物品畫面 $scene = Scene_Item.new when 1 # 特技 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 啟動狀態視窗 @command = true @menu_mask.visible = true actor_choose_refresh(actor = @actor[0]) when 2 # 裝備 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 啟動狀態視窗 @command = true @menu_mask.visible = true actor_choose_refresh(actor = @actor[0]) when 3 # 狀態 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 啟動狀態視窗 @command = true @menu_mask.visible = true actor_choose_refresh(actor = @actor[0]) when 4 # 存檔 # 禁止存檔的情況下 if $game_system.save_disabled # 演奏凍結 SE $game_system.se_play($data_system.buzzer_se) return end # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到存檔畫面 $scene = Scene_Save.new when 5 # 遊戲結束 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到遊戲結束畫面 $scene = Scene_End.new end return end end #-------------------------------------------------------------------------- # ● 選擇人物 #-------------------------------------------------------------------------- def update_actor_choose # 按下 B 鍵的情況下 if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 切換到主選項 @command = false @menu_mask.visible = false set_data @choose_actor_data.bitmap.clear return end # 按下 右 鍵的情況下 if Input.trigger?(Input::RIGHT) # 播放游標移動音效 $game_system.se_play($data_system.cursor_se) @actor_index += 1 if @actor_index < 4 @actor_index = 0 if @actor_index > 3 actor_choose_refresh(@actor[@actor_index]) return end # 按下 左 鍵的情況下 if Input.trigger?(Input::LEFT) # 播放游標移動音效 $game_system.se_play($data_system.cursor_se) @actor_index -= 1 if @actor_index > -1 @actor_index = 3 if @actor_index < 0 actor_choose_refresh(@actor[@actor_index]) return end end #-------------------------------------------------------------------------- # ● 選擇人物 #-------------------------------------------------------------------------- def update_actor_choose_enter # 按下 C 鍵的情況下 if Input.trigger?(Input::C) # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 獲取目前選項 case @menu_index when 1 # 特技 # 本角色的行動限制在 2 以上的情況下 if $game_party.actors[@actor_index].restriction >= 2 # 演奏凍結 SE $game_system.se_play($data_system.buzzer_se) return end # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到特技畫面 $scene = Scene_Skill.new(@actor_index) when 2 # 裝備 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換的裝備畫面 $scene = Scene_Equip.new(@actor_index) when 3 # 狀態 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到狀態畫面 $scene = Scene_Status.new(@actor_index) end return end end #-------------------------------------------------------------------------- # ● 偵測按鍵 #-------------------------------------------------------------------------- def update_actor_change # 按下 Ctrl 鍵的情況下 if Input.trigger?(Input::CTRL) # 獲取以前的隊伍角色 old_party = @actor # 移除所有角色 $data_actors.each_index {|i| $game_party.remove_actor($data_actors[i+1].id) } # 讀取舊有的角色 old_party.each_index {|a| # 如果倒數 1 人不存在 if old_party[a-1].nil? # 推向下一個人加入角色 $game_party.add_actor(old_party[a-2].id) # 如果倒數 2 人不存在 if old_party[a-2].nil? # 推向下一個人加入角色 $game_party.add_actor(old_party[a-3].id) end else # 直接加入角色 $game_party.add_actor(old_party[a-1].id) end } # 重新獲取角色列表 @actor = [$game_party.actors[0], $game_party.actors[1], $game_party.actors[2], $game_party.actors[3]] # 清除資料 delete_data # 重新描繪資料 actor_data_refresh(actor = @actor[0]) party_data_refresh return end end #------------------------------------------------------------------------- # ● 清除畫面資料 #-------------------------------------------------------------------------- def delete_data @actor_data.bitmap.clear @party_data.bitmap.clear end #------------------------------------------------------------------------- # ● 清除畫面資料 #-------------------------------------------------------------------------- def set_data actor_data_refresh party_data_refresh end #-------------------------------------------------------------------------- # ● 更新角色資料 #-------------------------------------------------------------------------- def actor_data_refresh(actor = @actor[0]) # 描會角色立繪 @actor_graphic.bitmap = RPG::Cache.picture(actor.name) @actor_graphic.ox = @actor_graphic.bitmap.width / 2 @actor_graphic.oy = @actor_graphic.bitmap.height / 2 @actor_graphic.x = 150 @actor_graphic.y = 300 @actor_graphic.z = 0 @actor_data.bitmap.font.size = 30 @actor_data.bitmap.font.bold = true # 描繪底框 (0...135).each {|i| @actor_data.bitmap.fill_rect(i / 4 - 60, 320 + i, 250, 1, Color.new(0, 0, 0, 255 - i)) } # 描繪名字 @actor_data.bitmap.draw_text(20, 300, 192, 96, actor.name) (0...180).each {|i| @actor_data.bitmap.fill_rect(i, 370, 1, 1, Color.new(255, 255, 255, 255)) } # 獲取角色目前 HP line_hp = actor.hp * 96 / actor.maxhp @actor_data.bitmap.font.size = 8 # 描繪底框 (0...96).each {|i| @actor_data.bitmap.font.color = Color.new(100, 0, 0) @actor_data.bitmap.draw_text(46 + i, 370, 32, 32, "●") } @actor_data.bitmap.font.size = 20 # 描繪內槽 (0...line_hp).each {|i| @actor_data.bitmap.font.color = Color.new(255 - i, 75 + i * 2, i * 1.5) @actor_data.bitmap.draw_text(40 + i, 370, 32, 32, "‧") } @actor_data.bitmap.font.color = Color.new(255, 255, 255) @actor_data.bitmap.font.size = 12 # 描繪比值 @actor_data.bitmap.draw_text(80, 380, 160, 32, actor.hp.to_s + " / " + actor.maxhp.to_s) # 獲取角色目前 SP line_sp = actor.sp * 96 / actor.maxsp @actor_data.bitmap.font.size = 8 # 描繪底框 (0...96).each {|i| @actor_data.bitmap.font.color = Color.new(0, 0, 100) @actor_data.bitmap.draw_text(46 + i, 390, 32, 32, "●") } @actor_data.bitmap.font.size = 20 # 描繪內槽 (0...line_sp).each {|i| @actor_data.bitmap.font.color = Color.new(i * 1.5, 75 + i * 2, 255 - i) @actor_data.bitmap.draw_text(40 + i, 390, 32, 32, "‧") } @actor_data.bitmap.font.color = Color.new(255, 255, 255) @actor_data.bitmap.font.size = 12 # 描繪比值 @actor_data.bitmap.draw_text(80, 400, 160, 32, actor.sp.to_s + " / " + actor.maxsp.to_s) # 獲取角色目前 EXP line_exp = actor.now_exp * 120 / actor.next_exp @actor_data.bitmap.font.size = 8 # 描繪底框 (0...120).each {|i| @actor_data.bitmap.font.color = Color.new(0, 100, 0) @actor_data.bitmap.draw_text(46 + i, 410, 32, 32, "●") } @actor_data.bitmap.font.size = 20 # 描繪內槽 (0...line_exp).each {|i| @actor_data.bitmap.font.color = Color.new(50 + i, 175 + i * 0.5, i) @actor_data.bitmap.draw_text(40 + i, 410, 32, 32, "‧") } @actor_data.bitmap.font.color = Color.new(255, 255, 255) @actor_data.bitmap.font.size = 12 # 描繪比值 @actor_data.bitmap.draw_text(80, 420, 160, 32, actor.exp_s + " / " + actor.next_exp_s) @actor_data.bitmap.font.bold = false end #-------------------------------------------------------------------------- # ● 更新角色資料 #-------------------------------------------------------------------------- def party_data_refresh (0...50).each {|i| @party_data.bitmap.fill_rect(260 + i / 4, 411 + i, 345, 1, Color.new(0, 0, 0, 255 - i * 2)) } (1...4).each {|a| if !@actor[a].nil? bitmap = RPG::Cache.picture(@actor[a].character_name) rect = Rect.new(0, 0, 32, 32) @party_data.bitmap.blt(278 + (a - 1) * 105, 411, bitmap, rect) @party_data.bitmap.font.size = 12 @party_data.bitmap.font.bold = true # 描繪名字 @party_data.bitmap.draw_text(310 + (a - 1) * 105, 370, 192, 96, @actor[a].name) (0...60).each {|i| @party_data.bitmap.fill_rect(310 + (a - 1) * 105 + i, 428, 1, 1, Color.new(255, 255, 255, 255)) } # 獲取角色目前 HP line_hp = @actor[a].hp * 60 / @actor[a].maxhp @party_data.bitmap.font.size = 20 # 描繪底框 (0..60).each {|i| @party_data.bitmap.font.color = Color.new(100, 0, 0) @party_data.bitmap.draw_text(304 + (a - 1) * 105 + i, 420, 32, 32, "‧") } @party_data.bitmap.font.size = 10 # 描繪內槽 (0...line_hp).each {|i| @party_data.bitmap.font.color = Color.new(255 - i, 75 + i * 2, i * 1.5) @party_data.bitmap.draw_text(309 + (a - 1) * 105 + i, 420, 32, 32, "‧") } # 獲取角色目前 SP line_sp = @actor[a].sp * 60 / @actor[a].maxsp @party_data.bitmap.font.size = 20 # 描繪底框 (0...60).each {|i| @party_data.bitmap.font.color = Color.new(0, 0, 100) @party_data.bitmap.draw_text(309 + (a - 1) * 105 + i, 430, 32, 32, "‧") } @party_data.bitmap.font.size = 10 # 描繪內槽 (0...line_sp).each {|i| @party_data.bitmap.font.color = Color.new(i * 1.5, 75 + i * 2, 255 - i) @party_data.bitmap.draw_text(314 + (a - 1) * 105 + i, 430, 32, 32, "‧") } @party_data.bitmap.font.color = Color.new(255, 255, 255) @party_data.bitmap.font.bold = false else bitmap = RPG::Cache.picture("nobody") rect = Rect.new(0, 0, 32, 32) @party_data.bitmap.blt(278 + (a - 1) * 105, 411, bitmap, rect) # 描繪名稱線條 (0...60).each {|i| @party_data.bitmap.fill_rect(310 + (a - 1) * 105 + i, 428, 1, 1, Color.new(255, 255, 255, 255)) } # 描繪 HP 底框 (0..60).each {|i| @party_data.bitmap.font.color = Color.new(100, 0, 0) @party_data.bitmap.draw_text(304 + (a - 1) * 105 + i, 420, 32, 32, "‧") } # 描繪 SP 底框 (0...60).each {|i| @party_data.bitmap.font.color = Color.new(0, 0, 100) @party_data.bitmap.draw_text(309 + (a - 1) * 105 + i, 430, 32, 32, "‧") } end } @party_data.bitmap.font.color = Color.new(255, 255, 255) @party_data.bitmap.font.bold = false end #-------------------------------------------------------------------------- # ● 更新角色資料 #-------------------------------------------------------------------------- def actor_choose_refresh(actor = @actor[0]) delete_data # 更改圖像位置 @actor_graphic.bitmap = RPG::Cache.picture(actor.name) @actor_graphic.x = 320 @actor_graphic.y = 300 @actor_graphic.ox = @actor_graphic.bitmap.width / 2 @actor_graphic.oy = @actor_graphic.bitmap.height / 2 @actor_graphic.z = 1000 # 描繪名字底框 (0...101).each {|i| @choose_actor_data.bitmap.fill_rect(220 + i, 320, 1, 32, Color.new(255, 255, 255, i * 5)) @choose_actor_data.bitmap.fill_rect(420 - i, 320, 1, 32, Color.new(255, 255, 255, i * 5)) } @choose_actor_data.bitmap.font.size = 22 @choose_actor_data.bitmap.font.bold = true @choose_actor_data.bitmap.font.color = Color.new(0, 0, 0) size = @choose_actor_data.bitmap.text_size(actor.name).width # 描繪名字 @choose_actor_data.bitmap.draw_text(320 - size / 2, 320, 240, 32, actor.name) end end [/ ICODE][/SPOILER]

[TABLE]
[TR]
[TD]PS: Or just the complete lines of code to insert an image because I know the part where to implement the lines of code but I do not know how to formulate them for it to work[/TD]
[/TR]
[/TABLE]
 

Attachments

  • 2021-03-01 04_13_17-Project1.png
    2021-03-01 04_13_17-Project1.png
    154.1 KB · Views: 7
  • 2021-03-01 15_49_45-Window.png
    2021-03-01 15_49_45-Window.png
    127.4 KB · Views: 6
Last edited:

orochi2k

The Mad King of Neolithic
Veteran
Joined
Jan 2, 2021
Messages
79
Reaction score
81
First Language
Chinese
Primarily Uses
RMXP
A menu script that brings back some old memories.
I have their original version for safekeeping just in case they may disappear one day.


Anyway, it's done.
You will need to have 3 background images
Graphics/Pictures/background1.jpg
Graphics/Pictures/background2.jpg
Graphics/Pictures/background3.jpg
I marked the changes I made in the script.
I also attached a project file which seems work.

And...here is my weird term of use: :kaojoy:
Just credit me as "orochi2k" in your game or sell your soul to me by wishlist my game or bring a victim to sacrifice their soul to me by forcing them to wishlist my game or just buy my game when it's released.
Do any one of the deeds above that you feel is the least evil, and that is enough. :kaojoy:
But, I really wish you will do all of them.:kaojoy:

Script here:
#============================================================================== #---------------------------------------------------------------------------- # ○ OSD - 腳本討論社 # Originality RGSS Discuss # └http://guild.gamer.com.tw/guild.php?sn=4707 #---------------------------------------------------------------------------- #============================================================================== #-------------------------------------------------------------------------- # ● 腳本名稱:Scene_Menu #-------------------------------------------------------------------------- # ● 腳本效果: # 套用成新的主選單畫面, # 人物立繪顯示要以資料庫人物名稱為命名, # 位置要在 Graphics\Pictures 之下。 # 人物圖示顯示要以資料庫人物行走圖名稱為命名, # 位置要在 Graphics\Pictures 之下。 #-------------------------------------------------------------------------- # ● 腳本版本:1.00 版 #-------------------------------------------------------------------------- # ● 腳本更新區塊: # 目前並無更新 #-------------------------------------------------------------------------- #============================================================================== #---------------------------------------------------------------------------- # ○ OSD - 腳本討論社 # Originality RGSS Discuss # └http://guild.gamer.com.tw/guild.php?sn=4707 #---------------------------------------------------------------------------- #============================================================================== #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ # 處理角色的類別。 # 使用在 Game_Actors ($game_actors)、Game_Party ($game_party) 類別的內部。 #============================================================================== class Game_Actor < Game_Battler def now_exp return @exp - @exp_list[@level] end def next_exp return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0 end end #============================================================================== # ■ Scene_Menu #------------------------------------------------------------------------------ # 處理選單畫面的類別。 #============================================================================== class Scene_Menu #-------------------------------------------------------------------------- # ● 初始化目標 # menu_index : 命令游標的初期位置 #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index # 獲取角色資料 @actor = [$game_party.actors[0], $game_party.actors[1], $game_party.actors[2], $game_party.actors[3]] @direction = 0 @actor_index = 0 @command = false end #-------------------------------------------------------------------------- # ● 主處理 #-------------------------------------------------------------------------- def main # 描繪背景 @sprite = Spriteset_Map.new # 繪製背景 @menu_back = RPG::Sprite.new @menu_back.bitmap = Bitmap.new(640, 480) (0...50).each {|i| @menu_back.bitmap.fill_rect(0, i, 640, 1, Color.new(0, 0, 0, 255 - i * 5)) @menu_back.bitmap.fill_rect(0, 480 - i, 640, 1, Color.new(0, 0, 0, 255 - i * 5)) } @menu_mask = RPG::Sprite.new @menu_mask.bitmap = Bitmap.new(640, 480) @menu_mask.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 160)) @menu_mask.visible = false @menu_mask.z = 999 # 描繪主選項 @main_command = Sprite.new @main_command.bitmap = Bitmap.new(640, 480) @main_command.bitmap.font.size = 25 @main_command.bitmap.font.bold = true @main_command.bitmap.draw_text(186, 0, 160, 74, "物品") @main_command.bitmap.draw_text(260, 0, 160, 74, "技能") @main_command.bitmap.draw_text(334, 0, 160, 74, "裝備") @main_command.bitmap.draw_text(408, 0, 160, 74, "狀態") @main_command.bitmap.draw_text(482, 0, 160, 74, "存檔") @main_command.bitmap.draw_text(556, 0, 160, 74, "結束") @main_command.opacity = 200 @main_command.z = 100 ##########HERE COMES OROCHI2K'S PATCH###################### @bk1 = Sprite.new @bk1.bitmap = Bitmap.new("Graphics/Pictures/background1.jpg") @bk1.visible = false @bk2 = Sprite.new @bk2.bitmap = Bitmap.new("Graphics/Pictures/background2.jpg") @bk2.visible = false @bk3 = Sprite.new @bk3.bitmap = Bitmap.new("Graphics/Pictures/background3.jpg") @bk3.visible = false ########################################################### # 描繪主選項背景 @main_command_back = Sprite.new @main_command_back.bitmap = Bitmap.new(640, 480) (0...16).each {|b| (0...500).each {|i| # 中間黑色底層 @main_command_back.bitmap.fill_rect(640 - i * 2, b * 2 + 20, 2, 2, Color.new(0, 0, 0, 255 - i)) # 上下白色邊框 @main_command_back.bitmap.fill_rect(640 - i * 2, 18, 2, 2, Color.new(255, 255, 255, 255 - i)) @main_command_back.bitmap.fill_rect(640 - i * 2, 52, 2, 2, Color.new(255, 255, 255, 255 - i)) } } # 建立人物立繪 @actor_graphic = RPG::Sprite.new # 建立人物資訊 @actor_data = RPG::Sprite.new @actor_data.bitmap = Bitmap.new(640, 480) # 描繪角色資料 actor_data_refresh # 描繪隊伍資料 @party_data = RPG::Sprite.new @party_data.bitmap = Bitmap.new(640, 480) party_data_refresh # 描繪選項框 @arrow = RPG::Sprite.new @arrow.bitmap = Bitmap.new(640, 480) @arrow.bitmap.font.size = 30 (0...36).each {|i| @arrow.bitmap.draw_text(i, 0, 74, 74, "●") } @arrow.opacity = 150 @arrow.x = @menu_index * 74 + 180#180 @arrow.y = -1 @arrow.z = 90 # 描繪選擇人物資料 @choose_actor_data = RPG::Sprite.new @choose_actor_data.bitmap = Bitmap.new(640, 480) @choose_actor_data.z = 1000 # 執行過渡 Graphics.transition # 主循環 loop do # 更新遊戲畫面 Graphics.update # 更新輸入訊息 Input.update # 更新畫面 update # 如果切換畫面就中斷循環 if $scene != self break end end # 準備過渡 Graphics.freeze @main_command.dispose @main_command_back.dispose @actor_graphic.dispose @actor_data.dispose @party_data.dispose @arrow.dispose @choose_actor_data.dispose @menu_mask.dispose @menu_back.dispose ##########HERE COMES OROCHI2K'S PATCH###################### @bk1.dispose @bk2.dispose @bk3.dispose ########################################################### end #-------------------------------------------------------------------------- # ● 更新畫面 #-------------------------------------------------------------------------- def update if !@command update_back update_input update_enter_input update_arrow update_actor_change else update_actor_choose update_actor_choose_enter end end #-------------------------------------------------------------------------- # ● 返回地圖畫面 #-------------------------------------------------------------------------- def update_back # 按下 B 鍵的情況下 if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 切換的地圖畫面 $scene = Scene_Map.new return end end #-------------------------------------------------------------------------- # ● 偵測按鍵 #-------------------------------------------------------------------------- def update_input # 按下 → 鍵的情況下 if Input.trigger?(Input::RIGHT) # 播放游標移動音效 $game_system.se_play($data_system.cursor_se) @menu_index += 1 if @menu_index < 6 @menu_index = 0 if @menu_index > 5 @direction = 1 return end # 按下 ← 鍵的情況下 if Input.trigger?(Input::LEFT) # 播放游標移動音效 $game_system.se_play($data_system.cursor_se) @menu_index -= 1 if @menu_index > -1 @menu_index = 5 if @menu_index < 0 @direction = 2 return end end #-------------------------------------------------------------------------- # ● 更新選項滑動 #-------------------------------------------------------------------------- def update_arrow case @menu_index when 0 if @direction == 2 @arrow.x -= 10 if @arrow.x > 180 @arrow.x = 180 if @arrow.x < 180 elsif @direction == 1 @arrow.x -= 30 if @arrow.x > 180 @arrow.x = 180 if @arrow.x < 180 end when 1 if @direction == 2 @arrow.x -= 10 if @arrow.x > 254 @arrow.x = 254 if @arrow.x < 254 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 254 @arrow.x = 254 if @arrow.x > 254 end when 2 if @direction == 2 @arrow.x -= 10 if @arrow.x > 328 @arrow.x = 328 if @arrow.x < 328 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 328 @arrow.x = 328 if @arrow.x > 328 end when 3 if @direction == 2 @arrow.x -= 10 if @arrow.x > 402 @arrow.x = 402 if @arrow.x < 402 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 402 @arrow.x = 402 if @arrow.x > 402 end when 4 if @direction == 2 @arrow.x -= 10 if @arrow.x > 476 @arrow.x = 476 if @arrow.x < 476 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 476 @arrow.x = 476 if @arrow.x > 476 end when 5 if @direction == 2 @arrow.x += 30 if @arrow.x < 550 @arrow.x = 550 if @arrow.x > 550 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 550 @arrow.x = 550 if @arrow.x > 550 end end end #-------------------------------------------------------------------------- # ● 偵測按鍵 #-------------------------------------------------------------------------- def update_enter_input # 按下 C 鍵的情況下 if Input.trigger?(Input::C) # 同伴人數為 0、存檔、遊戲結束以外的場合 if $game_party.actors.size == 0 and @command_window.index < 4 # 演奏凍結 SE $game_system.se_play($data_system.buzzer_se) return end # 獲取目前的位置 case @menu_index when 0 # 物品 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到物品畫面 $scene = Scene_Item.new when 1 # 特技 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 啟動狀態視窗 @command = true @menu_mask.visible = true ##########HERE COMES OROCHI2K'S PATCH###################### @bk1.visible = true ########################################################## actor_choose_refresh(actor = @actor[0]) when 2 # 裝備 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 啟動狀態視窗 @command = true @menu_mask.visible = true ##########HERE COMES OROCHI2K'S PATCH###################### @bk2.visible = true ########################################################### actor_choose_refresh(actor = @actor[0]) when 3 # 狀態 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 啟動狀態視窗 @command = true @menu_mask.visible = true ##########HERE COMES OROCHI2K'S PATCH###################### @bk3.visible = true ########################################################### actor_choose_refresh(actor = @actor[0]) when 4 # 存檔 # 禁止存檔的情況下 if $game_system.save_disabled # 演奏凍結 SE $game_system.se_play($data_system.buzzer_se) return end # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到存檔畫面 $scene = Scene_Save.new when 5 # 遊戲結束 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到遊戲結束畫面 $scene = Scene_End.new end return end end ################################ ##########HERE COMES OROCHI2K'S PATCH###################### def hide_all_background @bk1.visible = false @bk2.visible = false @bk3.visible = false end ################################# #-------------------------------------------------------------------------- # ● 選擇人物 #-------------------------------------------------------------------------- def update_actor_choose # 按下 B 鍵的情況下 if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 切換到主選項 @command = false @menu_mask.visible = false ##########HERE COMES OROCHI2K'S PATCH###################### hide_all_background ############################################################ set_data @choose_actor_data.bitmap.clear return end # 按下 右 鍵的情況下 if Input.trigger?(Input::RIGHT) # 播放游標移動音效 $game_system.se_play($data_system.cursor_se) @actor_index += 1 if @actor_index < 4 @actor_index = 0 if @actor_index > 3 actor_choose_refresh(@actor[@actor_index]) return end # 按下 左 鍵的情況下 if Input.trigger?(Input::LEFT) # 播放游標移動音效 $game_system.se_play($data_system.cursor_se) @actor_index -= 1 if @actor_index > -1 @actor_index = 3 if @actor_index < 0 actor_choose_refresh(@actor[@actor_index]) return end end #-------------------------------------------------------------------------- # ● 選擇人物 #-------------------------------------------------------------------------- def update_actor_choose_enter # 按下 C 鍵的情況下 if Input.trigger?(Input::C) # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 獲取目前選項 case @menu_index when 1 # 特技 # 本角色的行動限制在 2 以上的情況下 if $game_party.actors[@actor_index].restriction >= 2 # 演奏凍結 SE $game_system.se_play($data_system.buzzer_se) return end # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到特技畫面 $scene = Scene_Skill.new(@actor_index) when 2 # 裝備 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換的裝備畫面 $scene = Scene_Equip.new(@actor_index) when 3 # 狀態 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到狀態畫面 $scene = Scene_Status.new(@actor_index) end return end end #-------------------------------------------------------------------------- # ● 偵測按鍵 #-------------------------------------------------------------------------- def update_actor_change # 按下 Ctrl 鍵的情況下 if Input.trigger?(Input::CTRL) # 獲取以前的隊伍角色 old_party = @actor # 移除所有角色 $data_actors.each_index {|i| $game_party.remove_actor($data_actors[i+1].id) } # 讀取舊有的角色 old_party.each_index {|a| # 如果倒數 1 人不存在 if old_party[a-1].nil? # 推向下一個人加入角色 $game_party.add_actor(old_party[a-2].id) # 如果倒數 2 人不存在 if old_party[a-2].nil? # 推向下一個人加入角色 $game_party.add_actor(old_party[a-3].id) end else # 直接加入角色 $game_party.add_actor(old_party[a-1].id) end } # 重新獲取角色列表 @actor = [$game_party.actors[0], $game_party.actors[1], $game_party.actors[2], $game_party.actors[3]] # 清除資料 delete_data # 重新描繪資料 actor_data_refresh(actor = @actor[0]) party_data_refresh return end end #------------------------------------------------------------------------- # ● 清除畫面資料 #-------------------------------------------------------------------------- def delete_data @actor_data.bitmap.clear @party_data.bitmap.clear end #------------------------------------------------------------------------- # ● 清除畫面資料 #-------------------------------------------------------------------------- def set_data actor_data_refresh party_data_refresh end #-------------------------------------------------------------------------- # ● 更新角色資料 #-------------------------------------------------------------------------- def actor_data_refresh(actor = @actor[0]) # 描會角色立繪 @actor_graphic.bitmap = RPG::Cache.picture(actor.name) @actor_graphic.ox = @actor_graphic.bitmap.width / 2 @actor_graphic.oy = @actor_graphic.bitmap.height / 2 @actor_graphic.x = 150 @actor_graphic.y = 300 @actor_graphic.z = 0 @actor_data.bitmap.font.size = 30 @actor_data.bitmap.font.bold = true # 描繪底框 (0...135).each {|i| @actor_data.bitmap.fill_rect(i / 4 - 60, 320 + i, 250, 1, Color.new(0, 0, 0, 255 - i)) } # 描繪名字 @actor_data.bitmap.draw_text(20, 300, 192, 96, actor.name) (0...180).each {|i| @actor_data.bitmap.fill_rect(i, 370, 1, 1, Color.new(255, 255, 255, 255)) } # 獲取角色目前 HP line_hp = actor.hp * 96 / actor.maxhp @actor_data.bitmap.font.size = 8 # 描繪底框 (0...96).each {|i| @actor_data.bitmap.font.color = Color.new(100, 0, 0) @actor_data.bitmap.draw_text(46 + i, 370, 32, 32, "●") } @actor_data.bitmap.font.size = 20 # 描繪內槽 (0...line_hp).each {|i| @actor_data.bitmap.font.color = Color.new(255 - i, 75 + i * 2, i * 1.5) @actor_data.bitmap.draw_text(40 + i, 370, 32, 32, "‧") } @actor_data.bitmap.font.color = Color.new(255, 255, 255) @actor_data.bitmap.font.size = 12 # 描繪比值 @actor_data.bitmap.draw_text(80, 380, 160, 32, actor.hp.to_s + " / " + actor.maxhp.to_s) # 獲取角色目前 SP line_sp = actor.sp * 96 / actor.maxsp @actor_data.bitmap.font.size = 8 # 描繪底框 (0...96).each {|i| @actor_data.bitmap.font.color = Color.new(0, 0, 100) @actor_data.bitmap.draw_text(46 + i, 390, 32, 32, "●") } @actor_data.bitmap.font.size = 20 # 描繪內槽 (0...line_sp).each {|i| @actor_data.bitmap.font.color = Color.new(i * 1.5, 75 + i * 2, 255 - i) @actor_data.bitmap.draw_text(40 + i, 390, 32, 32, "‧") } @actor_data.bitmap.font.color = Color.new(255, 255, 255) @actor_data.bitmap.font.size = 12 # 描繪比值 @actor_data.bitmap.draw_text(80, 400, 160, 32, actor.sp.to_s + " / " + actor.maxsp.to_s) # 獲取角色目前 EXP line_exp = actor.now_exp * 120 / actor.next_exp @actor_data.bitmap.font.size = 8 # 描繪底框 (0...120).each {|i| @actor_data.bitmap.font.color = Color.new(0, 100, 0) @actor_data.bitmap.draw_text(46 + i, 410, 32, 32, "●") } @actor_data.bitmap.font.size = 20 # 描繪內槽 (0...line_exp).each {|i| @actor_data.bitmap.font.color = Color.new(50 + i, 175 + i * 0.5, i) @actor_data.bitmap.draw_text(40 + i, 410, 32, 32, "‧") } @actor_data.bitmap.font.color = Color.new(255, 255, 255) @actor_data.bitmap.font.size = 12 # 描繪比值 @actor_data.bitmap.draw_text(80, 420, 160, 32, actor.exp_s + " / " + actor.next_exp_s) @actor_data.bitmap.font.bold = false end #-------------------------------------------------------------------------- # ● 更新角色資料 #-------------------------------------------------------------------------- def party_data_refresh (0...50).each {|i| @party_data.bitmap.fill_rect(260 + i / 4, 411 + i, 345, 1, Color.new(0, 0, 0, 255 - i * 2)) } (1...4).each {|a| if !@actor[a].nil? bitmap = RPG::Cache.picture(@actor[a].character_name) rect = Rect.new(0, 0, 32, 32) @party_data.bitmap.blt(278 + (a - 1) * 105, 411, bitmap, rect) @party_data.bitmap.font.size = 12 @party_data.bitmap.font.bold = true # 描繪名字 @party_data.bitmap.draw_text(310 + (a - 1) * 105, 370, 192, 96, @actor[a].name) (0...60).each {|i| @party_data.bitmap.fill_rect(310 + (a - 1) * 105 + i, 428, 1, 1, Color.new(255, 255, 255, 255)) } # 獲取角色目前 HP line_hp = @actor[a].hp * 60 / @actor[a].maxhp @party_data.bitmap.font.size = 20 # 描繪底框 (0..60).each {|i| @party_data.bitmap.font.color = Color.new(100, 0, 0) @party_data.bitmap.draw_text(304 + (a - 1) * 105 + i, 420, 32, 32, "‧") } @party_data.bitmap.font.size = 10 # 描繪內槽 (0...line_hp).each {|i| @party_data.bitmap.font.color = Color.new(255 - i, 75 + i * 2, i * 1.5) @party_data.bitmap.draw_text(309 + (a - 1) * 105 + i, 420, 32, 32, "‧") } # 獲取角色目前 SP line_sp = @actor[a].sp * 60 / @actor[a].maxsp @party_data.bitmap.font.size = 20 # 描繪底框 (0...60).each {|i| @party_data.bitmap.font.color = Color.new(0, 0, 100) @party_data.bitmap.draw_text(309 + (a - 1) * 105 + i, 430, 32, 32, "‧") } @party_data.bitmap.font.size = 10 # 描繪內槽 (0...line_sp).each {|i| @party_data.bitmap.font.color = Color.new(i * 1.5, 75 + i * 2, 255 - i) @party_data.bitmap.draw_text(314 + (a - 1) * 105 + i, 430, 32, 32, "‧") } @party_data.bitmap.font.color = Color.new(255, 255, 255) @party_data.bitmap.font.bold = false else bitmap = RPG::Cache.picture("nobody") rect = Rect.new(0, 0, 32, 32) @party_data.bitmap.blt(278 + (a - 1) * 105, 411, bitmap, rect) # 描繪名稱線條 (0...60).each {|i| @party_data.bitmap.fill_rect(310 + (a - 1) * 105 + i, 428, 1, 1, Color.new(255, 255, 255, 255)) } # 描繪 HP 底框 (0..60).each {|i| @party_data.bitmap.font.color = Color.new(100, 0, 0) @party_data.bitmap.draw_text(304 + (a - 1) * 105 + i, 420, 32, 32, "‧") } # 描繪 SP 底框 (0...60).each {|i| @party_data.bitmap.font.color = Color.new(0, 0, 100) @party_data.bitmap.draw_text(309 + (a - 1) * 105 + i, 430, 32, 32, "‧") } end } @party_data.bitmap.font.color = Color.new(255, 255, 255) @party_data.bitmap.font.bold = false end #-------------------------------------------------------------------------- # ● 更新角色資料 #-------------------------------------------------------------------------- def actor_choose_refresh(actor = @actor[0]) delete_data # 更改圖像位置 @actor_graphic.bitmap = RPG::Cache.picture(actor.name) @actor_graphic.x = 320 @actor_graphic.y = 300 @actor_graphic.ox = @actor_graphic.bitmap.width / 2 @actor_graphic.oy = @actor_graphic.bitmap.height / 2 @actor_graphic.z = 1000 # 描繪名字底框 (0...101).each {|i| @choose_actor_data.bitmap.fill_rect(220 + i, 320, 1, 32, Color.new(255, 255, 255, i * 5)) @choose_actor_data.bitmap.fill_rect(420 - i, 320, 1, 32, Color.new(255, 255, 255, i * 5)) } @choose_actor_data.bitmap.font.size = 22 @choose_actor_data.bitmap.font.bold = true @choose_actor_data.bitmap.font.color = Color.new(0, 0, 0) size = @choose_actor_data.bitmap.text_size(actor.name).width # 描繪名字 @choose_actor_data.bitmap.draw_text(320 - size / 2, 320, 240, 32, actor.name) end end
 

Attachments

  • Project1.zip
    268.7 KB · Views: 2
Last edited:

Ayanamiku

Villager
Member
Joined
Mar 1, 2021
Messages
6
Reaction score
8
First Language
Français
Primarily Uses
RMXP
A menu script that brings back some old memories.
I have their original version for safekeeping just in case they may disappear one day.


Anyway, it's done.
You will need to have 3 background images
Graphics/Pictures/background1.jpg
Graphics/Pictures/background2.jpg
Graphics/Pictures/background3.jpg
I marked the changes I made in the script.
I also attached a project file which seems work.

And...here is my weird term of use: :kaojoy:
Just credit me as "orochi2k" in your game or sell your soul to me by wishlist my game or bring a victim to sacrifice their soul to me by forcing them to wishlist my game or just buy my game when it's released.
Do any one of the deeds above that you feel is the least evil, and that is enough. :kaojoy:
But, I really wish you will do all of them.:kaojoy:

Script here:
#============================================================================== #---------------------------------------------------------------------------- # ○ OSD - 腳本討論社 # Originality RGSS Discuss # └http://guild.gamer.com.tw/guild.php?sn=4707 #---------------------------------------------------------------------------- #============================================================================== #-------------------------------------------------------------------------- # ● 腳本名稱:Scene_Menu #-------------------------------------------------------------------------- # ● 腳本效果: # 套用成新的主選單畫面, # 人物立繪顯示要以資料庫人物名稱為命名, # 位置要在 Graphics\Pictures 之下。 # 人物圖示顯示要以資料庫人物行走圖名稱為命名, # 位置要在 Graphics\Pictures 之下。 #-------------------------------------------------------------------------- # ● 腳本版本:1.00 版 #-------------------------------------------------------------------------- # ● 腳本更新區塊: # 目前並無更新 #-------------------------------------------------------------------------- #============================================================================== #---------------------------------------------------------------------------- # ○ OSD - 腳本討論社 # Originality RGSS Discuss # └http://guild.gamer.com.tw/guild.php?sn=4707 #---------------------------------------------------------------------------- #============================================================================== #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ # 處理角色的類別。 # 使用在 Game_Actors ($game_actors)、Game_Party ($game_party) 類別的內部。 #============================================================================== class Game_Actor < Game_Battler def now_exp return @exp - @exp_list[@level] end def next_exp return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0 end end #============================================================================== # ■ Scene_Menu #------------------------------------------------------------------------------ # 處理選單畫面的類別。 #============================================================================== class Scene_Menu #-------------------------------------------------------------------------- # ● 初始化目標 # menu_index : 命令游標的初期位置 #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index # 獲取角色資料 @actor = [$game_party.actors[0], $game_party.actors[1], $game_party.actors[2], $game_party.actors[3]] @direction = 0 @actor_index = 0 @command = false end #-------------------------------------------------------------------------- # ● 主處理 #-------------------------------------------------------------------------- def main # 描繪背景 @sprite = Spriteset_Map.new # 繪製背景 @menu_back = RPG::Sprite.new @menu_back.bitmap = Bitmap.new(640, 480) (0...50).each {|i| @menu_back.bitmap.fill_rect(0, i, 640, 1, Color.new(0, 0, 0, 255 - i * 5)) @menu_back.bitmap.fill_rect(0, 480 - i, 640, 1, Color.new(0, 0, 0, 255 - i * 5)) } @menu_mask = RPG::Sprite.new @menu_mask.bitmap = Bitmap.new(640, 480) @menu_mask.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 160)) @menu_mask.visible = false @menu_mask.z = 999 # 描繪主選項 @main_command = Sprite.new @main_command.bitmap = Bitmap.new(640, 480) @main_command.bitmap.font.size = 25 @main_command.bitmap.font.bold = true @main_command.bitmap.draw_text(186, 0, 160, 74, "物品") @main_command.bitmap.draw_text(260, 0, 160, 74, "技能") @main_command.bitmap.draw_text(334, 0, 160, 74, "裝備") @main_command.bitmap.draw_text(408, 0, 160, 74, "狀態") @main_command.bitmap.draw_text(482, 0, 160, 74, "存檔") @main_command.bitmap.draw_text(556, 0, 160, 74, "結束") @main_command.opacity = 200 @main_command.z = 100 ##########HERE COMES OROCHI2K'S PATCH###################### @bk1 = Sprite.new @bk1.bitmap = Bitmap.new("Graphics/Pictures/background1.jpg") @bk1.visible = false @bk2 = Sprite.new @bk2.bitmap = Bitmap.new("Graphics/Pictures/background2.jpg") @bk2.visible = false @bk3 = Sprite.new @bk3.bitmap = Bitmap.new("Graphics/Pictures/background3.jpg") @bk3.visible = false ########################################################### # 描繪主選項背景 @main_command_back = Sprite.new @main_command_back.bitmap = Bitmap.new(640, 480) (0...16).each {|b| (0...500).each {|i| # 中間黑色底層 @main_command_back.bitmap.fill_rect(640 - i * 2, b * 2 + 20, 2, 2, Color.new(0, 0, 0, 255 - i)) # 上下白色邊框 @main_command_back.bitmap.fill_rect(640 - i * 2, 18, 2, 2, Color.new(255, 255, 255, 255 - i)) @main_command_back.bitmap.fill_rect(640 - i * 2, 52, 2, 2, Color.new(255, 255, 255, 255 - i)) } } # 建立人物立繪 @actor_graphic = RPG::Sprite.new # 建立人物資訊 @actor_data = RPG::Sprite.new @actor_data.bitmap = Bitmap.new(640, 480) # 描繪角色資料 actor_data_refresh # 描繪隊伍資料 @party_data = RPG::Sprite.new @party_data.bitmap = Bitmap.new(640, 480) party_data_refresh # 描繪選項框 @arrow = RPG::Sprite.new @arrow.bitmap = Bitmap.new(640, 480) @arrow.bitmap.font.size = 30 (0...36).each {|i| @arrow.bitmap.draw_text(i, 0, 74, 74, "●") } @arrow.opacity = 150 @arrow.x = @menu_index * 74 + 180#180 @arrow.y = -1 @arrow.z = 90 # 描繪選擇人物資料 @choose_actor_data = RPG::Sprite.new @choose_actor_data.bitmap = Bitmap.new(640, 480) @choose_actor_data.z = 1000 # 執行過渡 Graphics.transition # 主循環 loop do # 更新遊戲畫面 Graphics.update # 更新輸入訊息 Input.update # 更新畫面 update # 如果切換畫面就中斷循環 if $scene != self break end end # 準備過渡 Graphics.freeze @main_command.dispose @main_command_back.dispose @actor_graphic.dispose @actor_data.dispose @party_data.dispose @arrow.dispose @choose_actor_data.dispose @menu_mask.dispose @menu_back.dispose ##########HERE COMES OROCHI2K'S PATCH###################### @bk1.dispose @bk2.dispose @bk3.dispose ########################################################### end #-------------------------------------------------------------------------- # ● 更新畫面 #-------------------------------------------------------------------------- def update if !@command update_back update_input update_enter_input update_arrow update_actor_change else update_actor_choose update_actor_choose_enter end end #-------------------------------------------------------------------------- # ● 返回地圖畫面 #-------------------------------------------------------------------------- def update_back # 按下 B 鍵的情況下 if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 切換的地圖畫面 $scene = Scene_Map.new return end end #-------------------------------------------------------------------------- # ● 偵測按鍵 #-------------------------------------------------------------------------- def update_input # 按下 → 鍵的情況下 if Input.trigger?(Input::RIGHT) # 播放游標移動音效 $game_system.se_play($data_system.cursor_se) @menu_index += 1 if @menu_index < 6 @menu_index = 0 if @menu_index > 5 @direction = 1 return end # 按下 ← 鍵的情況下 if Input.trigger?(Input::LEFT) # 播放游標移動音效 $game_system.se_play($data_system.cursor_se) @menu_index -= 1 if @menu_index > -1 @menu_index = 5 if @menu_index < 0 @direction = 2 return end end #-------------------------------------------------------------------------- # ● 更新選項滑動 #-------------------------------------------------------------------------- def update_arrow case @menu_index when 0 if @direction == 2 @arrow.x -= 10 if @arrow.x > 180 @arrow.x = 180 if @arrow.x < 180 elsif @direction == 1 @arrow.x -= 30 if @arrow.x > 180 @arrow.x = 180 if @arrow.x < 180 end when 1 if @direction == 2 @arrow.x -= 10 if @arrow.x > 254 @arrow.x = 254 if @arrow.x < 254 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 254 @arrow.x = 254 if @arrow.x > 254 end when 2 if @direction == 2 @arrow.x -= 10 if @arrow.x > 328 @arrow.x = 328 if @arrow.x < 328 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 328 @arrow.x = 328 if @arrow.x > 328 end when 3 if @direction == 2 @arrow.x -= 10 if @arrow.x > 402 @arrow.x = 402 if @arrow.x < 402 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 402 @arrow.x = 402 if @arrow.x > 402 end when 4 if @direction == 2 @arrow.x -= 10 if @arrow.x > 476 @arrow.x = 476 if @arrow.x < 476 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 476 @arrow.x = 476 if @arrow.x > 476 end when 5 if @direction == 2 @arrow.x += 30 if @arrow.x < 550 @arrow.x = 550 if @arrow.x > 550 elsif @direction == 1 @arrow.x += 10 if @arrow.x < 550 @arrow.x = 550 if @arrow.x > 550 end end end #-------------------------------------------------------------------------- # ● 偵測按鍵 #-------------------------------------------------------------------------- def update_enter_input # 按下 C 鍵的情況下 if Input.trigger?(Input::C) # 同伴人數為 0、存檔、遊戲結束以外的場合 if $game_party.actors.size == 0 and @command_window.index < 4 # 演奏凍結 SE $game_system.se_play($data_system.buzzer_se) return end # 獲取目前的位置 case @menu_index when 0 # 物品 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到物品畫面 $scene = Scene_Item.new when 1 # 特技 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 啟動狀態視窗 @command = true @menu_mask.visible = true ##########HERE COMES OROCHI2K'S PATCH###################### @bk1.visible = true ########################################################## actor_choose_refresh(actor = @actor[0]) when 2 # 裝備 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 啟動狀態視窗 @command = true @menu_mask.visible = true ##########HERE COMES OROCHI2K'S PATCH###################### @bk2.visible = true ########################################################### actor_choose_refresh(actor = @actor[0]) when 3 # 狀態 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 啟動狀態視窗 @command = true @menu_mask.visible = true ##########HERE COMES OROCHI2K'S PATCH###################### @bk3.visible = true ########################################################### actor_choose_refresh(actor = @actor[0]) when 4 # 存檔 # 禁止存檔的情況下 if $game_system.save_disabled # 演奏凍結 SE $game_system.se_play($data_system.buzzer_se) return end # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到存檔畫面 $scene = Scene_Save.new when 5 # 遊戲結束 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到遊戲結束畫面 $scene = Scene_End.new end return end end ################################ ##########HERE COMES OROCHI2K'S PATCH###################### def hide_all_background @bk1.visible = false @bk2.visible = false @bk3.visible = false end ################################# #-------------------------------------------------------------------------- # ● 選擇人物 #-------------------------------------------------------------------------- def update_actor_choose # 按下 B 鍵的情況下 if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 切換到主選項 @command = false @menu_mask.visible = false ##########HERE COMES OROCHI2K'S PATCH###################### hide_all_background ############################################################ set_data @choose_actor_data.bitmap.clear return end # 按下 右 鍵的情況下 if Input.trigger?(Input::RIGHT) # 播放游標移動音效 $game_system.se_play($data_system.cursor_se) @actor_index += 1 if @actor_index < 4 @actor_index = 0 if @actor_index > 3 actor_choose_refresh(@actor[@actor_index]) return end # 按下 左 鍵的情況下 if Input.trigger?(Input::LEFT) # 播放游標移動音效 $game_system.se_play($data_system.cursor_se) @actor_index -= 1 if @actor_index > -1 @actor_index = 3 if @actor_index < 0 actor_choose_refresh(@actor[@actor_index]) return end end #-------------------------------------------------------------------------- # ● 選擇人物 #-------------------------------------------------------------------------- def update_actor_choose_enter # 按下 C 鍵的情況下 if Input.trigger?(Input::C) # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 獲取目前選項 case @menu_index when 1 # 特技 # 本角色的行動限制在 2 以上的情況下 if $game_party.actors[@actor_index].restriction >= 2 # 演奏凍結 SE $game_system.se_play($data_system.buzzer_se) return end # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到特技畫面 $scene = Scene_Skill.new(@actor_index) when 2 # 裝備 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換的裝備畫面 $scene = Scene_Equip.new(@actor_index) when 3 # 狀態 # 演奏確定 SE $game_system.se_play($data_system.decision_se) # 切換到狀態畫面 $scene = Scene_Status.new(@actor_index) end return end end #-------------------------------------------------------------------------- # ● 偵測按鍵 #-------------------------------------------------------------------------- def update_actor_change # 按下 Ctrl 鍵的情況下 if Input.trigger?(Input::CTRL) # 獲取以前的隊伍角色 old_party = @actor # 移除所有角色 $data_actors.each_index {|i| $game_party.remove_actor($data_actors[i+1].id) } # 讀取舊有的角色 old_party.each_index {|a| # 如果倒數 1 人不存在 if old_party[a-1].nil? # 推向下一個人加入角色 $game_party.add_actor(old_party[a-2].id) # 如果倒數 2 人不存在 if old_party[a-2].nil? # 推向下一個人加入角色 $game_party.add_actor(old_party[a-3].id) end else # 直接加入角色 $game_party.add_actor(old_party[a-1].id) end } # 重新獲取角色列表 @actor = [$game_party.actors[0], $game_party.actors[1], $game_party.actors[2], $game_party.actors[3]] # 清除資料 delete_data # 重新描繪資料 actor_data_refresh(actor = @actor[0]) party_data_refresh return end end #------------------------------------------------------------------------- # ● 清除畫面資料 #-------------------------------------------------------------------------- def delete_data @actor_data.bitmap.clear @party_data.bitmap.clear end #------------------------------------------------------------------------- # ● 清除畫面資料 #-------------------------------------------------------------------------- def set_data actor_data_refresh party_data_refresh end #-------------------------------------------------------------------------- # ● 更新角色資料 #-------------------------------------------------------------------------- def actor_data_refresh(actor = @actor[0]) # 描會角色立繪 @actor_graphic.bitmap = RPG::Cache.picture(actor.name) @actor_graphic.ox = @actor_graphic.bitmap.width / 2 @actor_graphic.oy = @actor_graphic.bitmap.height / 2 @actor_graphic.x = 150 @actor_graphic.y = 300 @actor_graphic.z = 0 @actor_data.bitmap.font.size = 30 @actor_data.bitmap.font.bold = true # 描繪底框 (0...135).each {|i| @actor_data.bitmap.fill_rect(i / 4 - 60, 320 + i, 250, 1, Color.new(0, 0, 0, 255 - i)) } # 描繪名字 @actor_data.bitmap.draw_text(20, 300, 192, 96, actor.name) (0...180).each {|i| @actor_data.bitmap.fill_rect(i, 370, 1, 1, Color.new(255, 255, 255, 255)) } # 獲取角色目前 HP line_hp = actor.hp * 96 / actor.maxhp @actor_data.bitmap.font.size = 8 # 描繪底框 (0...96).each {|i| @actor_data.bitmap.font.color = Color.new(100, 0, 0) @actor_data.bitmap.draw_text(46 + i, 370, 32, 32, "●") } @actor_data.bitmap.font.size = 20 # 描繪內槽 (0...line_hp).each {|i| @actor_data.bitmap.font.color = Color.new(255 - i, 75 + i * 2, i * 1.5) @actor_data.bitmap.draw_text(40 + i, 370, 32, 32, "‧") } @actor_data.bitmap.font.color = Color.new(255, 255, 255) @actor_data.bitmap.font.size = 12 # 描繪比值 @actor_data.bitmap.draw_text(80, 380, 160, 32, actor.hp.to_s + " / " + actor.maxhp.to_s) # 獲取角色目前 SP line_sp = actor.sp * 96 / actor.maxsp @actor_data.bitmap.font.size = 8 # 描繪底框 (0...96).each {|i| @actor_data.bitmap.font.color = Color.new(0, 0, 100) @actor_data.bitmap.draw_text(46 + i, 390, 32, 32, "●") } @actor_data.bitmap.font.size = 20 # 描繪內槽 (0...line_sp).each {|i| @actor_data.bitmap.font.color = Color.new(i * 1.5, 75 + i * 2, 255 - i) @actor_data.bitmap.draw_text(40 + i, 390, 32, 32, "‧") } @actor_data.bitmap.font.color = Color.new(255, 255, 255) @actor_data.bitmap.font.size = 12 # 描繪比值 @actor_data.bitmap.draw_text(80, 400, 160, 32, actor.sp.to_s + " / " + actor.maxsp.to_s) # 獲取角色目前 EXP line_exp = actor.now_exp * 120 / actor.next_exp @actor_data.bitmap.font.size = 8 # 描繪底框 (0...120).each {|i| @actor_data.bitmap.font.color = Color.new(0, 100, 0) @actor_data.bitmap.draw_text(46 + i, 410, 32, 32, "●") } @actor_data.bitmap.font.size = 20 # 描繪內槽 (0...line_exp).each {|i| @actor_data.bitmap.font.color = Color.new(50 + i, 175 + i * 0.5, i) @actor_data.bitmap.draw_text(40 + i, 410, 32, 32, "‧") } @actor_data.bitmap.font.color = Color.new(255, 255, 255) @actor_data.bitmap.font.size = 12 # 描繪比值 @actor_data.bitmap.draw_text(80, 420, 160, 32, actor.exp_s + " / " + actor.next_exp_s) @actor_data.bitmap.font.bold = false end #-------------------------------------------------------------------------- # ● 更新角色資料 #-------------------------------------------------------------------------- def party_data_refresh (0...50).each {|i| @party_data.bitmap.fill_rect(260 + i / 4, 411 + i, 345, 1, Color.new(0, 0, 0, 255 - i * 2)) } (1...4).each {|a| if !@actor[a].nil? bitmap = RPG::Cache.picture(@actor[a].character_name) rect = Rect.new(0, 0, 32, 32) @party_data.bitmap.blt(278 + (a - 1) * 105, 411, bitmap, rect) @party_data.bitmap.font.size = 12 @party_data.bitmap.font.bold = true # 描繪名字 @party_data.bitmap.draw_text(310 + (a - 1) * 105, 370, 192, 96, @actor[a].name) (0...60).each {|i| @party_data.bitmap.fill_rect(310 + (a - 1) * 105 + i, 428, 1, 1, Color.new(255, 255, 255, 255)) } # 獲取角色目前 HP line_hp = @actor[a].hp * 60 / @actor[a].maxhp @party_data.bitmap.font.size = 20 # 描繪底框 (0..60).each {|i| @party_data.bitmap.font.color = Color.new(100, 0, 0) @party_data.bitmap.draw_text(304 + (a - 1) * 105 + i, 420, 32, 32, "‧") } @party_data.bitmap.font.size = 10 # 描繪內槽 (0...line_hp).each {|i| @party_data.bitmap.font.color = Color.new(255 - i, 75 + i * 2, i * 1.5) @party_data.bitmap.draw_text(309 + (a - 1) * 105 + i, 420, 32, 32, "‧") } # 獲取角色目前 SP line_sp = @actor[a].sp * 60 / @actor[a].maxsp @party_data.bitmap.font.size = 20 # 描繪底框 (0...60).each {|i| @party_data.bitmap.font.color = Color.new(0, 0, 100) @party_data.bitmap.draw_text(309 + (a - 1) * 105 + i, 430, 32, 32, "‧") } @party_data.bitmap.font.size = 10 # 描繪內槽 (0...line_sp).each {|i| @party_data.bitmap.font.color = Color.new(i * 1.5, 75 + i * 2, 255 - i) @party_data.bitmap.draw_text(314 + (a - 1) * 105 + i, 430, 32, 32, "‧") } @party_data.bitmap.font.color = Color.new(255, 255, 255) @party_data.bitmap.font.bold = false else bitmap = RPG::Cache.picture("nobody") rect = Rect.new(0, 0, 32, 32) @party_data.bitmap.blt(278 + (a - 1) * 105, 411, bitmap, rect) # 描繪名稱線條 (0...60).each {|i| @party_data.bitmap.fill_rect(310 + (a - 1) * 105 + i, 428, 1, 1, Color.new(255, 255, 255, 255)) } # 描繪 HP 底框 (0..60).each {|i| @party_data.bitmap.font.color = Color.new(100, 0, 0) @party_data.bitmap.draw_text(304 + (a - 1) * 105 + i, 420, 32, 32, "‧") } # 描繪 SP 底框 (0...60).each {|i| @party_data.bitmap.font.color = Color.new(0, 0, 100) @party_data.bitmap.draw_text(309 + (a - 1) * 105 + i, 430, 32, 32, "‧") } end } @party_data.bitmap.font.color = Color.new(255, 255, 255) @party_data.bitmap.font.bold = false end #-------------------------------------------------------------------------- # ● 更新角色資料 #-------------------------------------------------------------------------- def actor_choose_refresh(actor = @actor[0]) delete_data # 更改圖像位置 @actor_graphic.bitmap = RPG::Cache.picture(actor.name) @actor_graphic.x = 320 @actor_graphic.y = 300 @actor_graphic.ox = @actor_graphic.bitmap.width / 2 @actor_graphic.oy = @actor_graphic.bitmap.height / 2 @actor_graphic.z = 1000 # 描繪名字底框 (0...101).each {|i| @choose_actor_data.bitmap.fill_rect(220 + i, 320, 1, 32, Color.new(255, 255, 255, i * 5)) @choose_actor_data.bitmap.fill_rect(420 - i, 320, 1, 32, Color.new(255, 255, 255, i * 5)) } @choose_actor_data.bitmap.font.size = 22 @choose_actor_data.bitmap.font.bold = true @choose_actor_data.bitmap.font.color = Color.new(0, 0, 0) size = @choose_actor_data.bitmap.text_size(actor.name).width # 描繪名字 @choose_actor_data.bitmap.draw_text(320 - size / 2, 320, 240, 32, actor.name) end end
Woa Thank you for this information which will greatly help me for the future. Glad to know that this old script is still known ^^ Besides, I understand better why I could not display my image in the right place. Now I can display another additional image for the basic menu before selecting a submenu.

I intend to credit in your name and why not if you come back to me after another question from me to sell you my soul ^^ and if you contributed to my understanding in the world of coding why not more;)

Thank you very much and thank you for such a quick response! It works perfectly
 

orochi2k

The Mad King of Neolithic
Veteran
Joined
Jan 2, 2021
Messages
79
Reaction score
81
First Language
Chinese
Primarily Uses
RMXP
Sure, maybe I can help more.
But, no promise. :kaojoy:
 

Latest Threads

Latest Posts

Latest Profile Posts

I really lack discipline and find myself far too often giving into or at least seriously considering the temptation to start a new project rather than following through on a WIP that's no longer a shiny and new idea.

Does anyone have any strategies or tricks for making themselves follow through with things instead of doing this? Like that actually work?
I'm starting the "Switches lesson" on Learn MV today, what would you like to learn about them?
I managed to review my previous lessons on Learn MV and fixed a lot of things. Yay! :kaopride:

Forum statistics

Threads
110,414
Messages
1,053,137
Members
143,480
Latest member
helioktt
Top