這只是用來記錄修改心得的筆記,非我本人請勿私自轉貼,但在非商業性質下請隨便用在您的游戲中,商業性質我也拿您沒辦法(笑)。
1. 菜單選項字體置中:
打開 Window_Command 修改:
def alignment
return 0 #<- 0為靠左,1 為置中,2 為靠右
end
修改後,所有包括標題頁菜單的選項文字都是置中的,因為選項是使用 drew_text() 描繪。
2. 菜單選項設為兩列橫排的方式:
開啟 Window_MenuCommand 加入一段:
#--------------------------------------------------------------------------
# ● 欄數取得
#--------------------------------------------------------------------------
def col_max
return 4
end
這設定橫向一行顯示多少個選項,接著再修改視窗寬度和顯示行數:
#--------------------------------------------------------------------------
# ● 取得視窗的寬度
#--------------------------------------------------------------------------
def window_width
return Graphics.width #160
end
#--------------------------------------------------------------------------
# ● 取得顯示行數
#--------------------------------------------------------------------------
def visible_line_number
2 #item_max
end
這樣即可。
3. 設置菜單背景不透明度:
打開 Window_Base,在 def initialize 中加入一行:
@self.opacity = 100 #0~255,0 為完全透明,255 為完全不透明
也可以使用窗口不透明度腳本,好處是只會窗口顏色背景透明,窗口框邊不受影響,腳本內容:
#===========================================================================
# Window Color Opacity - v1.0
# Author: Melkino
#===========================================================================
$imported = {} if $imported.nil?
$imported["MK-WindowOpacity"] = true
#-------------------------------------------------------------------------
# ▼ About
#-------------------------------------------------------------------------
# 該腳本可以讓你改變遊戲窗口顏色部份的不透明度,
# 但對窗口的邊框是沒有影響的。
#
#-------------------------------------------------------------------------
# ▼ Installation
#-------------------------------------------------------------------------
# 貼上腳本到 Main 之上方.
#
#-------------------------------------------------------------------------
# ▼ Updates 更新於
#-------------------------------------------------------------------------
# May 9, 2012 - Started & finished script
#
#-------------------------------------------------------------------------
class Window_Base < Window
module MK_WIN_OPA
# Input a value between 0-255.
# 0 makes windows fully transparent, while 255 makes them opaque.
OPACITY = 120
end #module
#===========================================================================
# 設定到此為止。
#===========================================================================
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias mk_initialize initialize
def initialize(x, y, width, height)
super
self.windowskin = Cache.system("Window")
self.back_opacity = MK_WIN_OPA::OPACITY
update_padding
update_tone
create_contents
@opening = @closing = false
end
end # class
4. 同時顯示技能 MP 和 TP 消耗值:
這是國外的腳本,因為作者公開表明允許無信貸(隨便用,不必徵詢同意),所以放到筆記中,這個腳本會直接在技能選取列表中顯示 MP 和 TP 的清耗值,相較原本要看畫面上方的 Help 列說明文的方式,比較直觀。
#==============================================================================
# ■ [SNOW] Display MP and TP
#------------------------------------------------------------------------------
# 如果有需要,此腳本將會在技能列表中同時顯示 MP 和 TP 的消耗值
# (當技能設定消耗值 MP 和 TP 都有,就兩個都顯示,否則只顯示有設定的那一個)
# 放在 RPG Ace. 默認腳本以下的自選位置,此腳本無信貸限制,只是一個片段。
#==============================================================================
class Window_SkillList < Window_Selectable
def draw_skill_cost(rect, skill)
if @actor.skill_tp_cost(skill) > 0
change_color(tp_cost_color, enable?(skill))
draw_text(rect, @actor.skill_tp_cost(skill), 2)
end
if @actor.skill_mp_cost(skill) > 0
change_color(mp_cost_color, enable?(skill))
rect.width -= 35 # 如果你要 MP 和 TP 之間無空格,可以設為 30
draw_text(rect, @actor.skill_mp_cost(skill), 2)
end
end
end
5. 菜單背景圖
在相應菜單的默認腳本中,如 Scene_Menu 或 Scene_Status 等,加入以下程式碼:
#--------------------------------------------------------------------------
# ● 生成背景
#--------------------------------------------------------------------------
def create_background
@background_sprite = Sprite.new
@background_sprite.bitmap = Cache.load_bitmap("Graphics/Titles1/","DATA20_0852")
@background_sprite.color.set(0, 0, 0, 0)
end
#--------------------------------------------------------------------------
# ● 結束處理
#--------------------------------------------------------------------------
def terminate
super
dispose_background
end
#--------------------------------------------------------------------------
# ● 結束背景
#--------------------------------------------------------------------------
def dispose_background
@background_sprite.dispose
end
end
在 Cache.load_bitmap() 中,第一個參數是背景圖的相對路徑,第二個是背景圖的檔名,建議放在 Pictures 或 Titles1 中。