アクターのステータスである運の値を利用して、HPゲージや、TPゲージのように新規でゲージを
実装しようとしています
ひとまず、スクリプトを眺めながら、ステータスの名称、ゲージ、現在の数値を二段目に表示させる事と
運のステータス上限を100までとする事には
成功したのですが
テストにと、運のステータスを上昇させるコモンイベントで運を最大まで増やしても、ゲージが真っ黒なままで
機能してくれません
おそらく、lukのステータスの割合をうまく取得できておらず、
ゲージのグラデーション描画ができていないように思うのですが、何が足りず、何が間違っているか
判断できません
現状のスクリプトを貼り付けますので、どなたかご指導いただけませんでしょうか?
あとはゲージが運の割合に応じて動くだけで、完成なんです、なにとぞよろしくお願いいたします…
コード: 全て選択
module Vocab
def self.luk; param(7); end # TP
def self.luk_a; param(7); end # TP (短)
end
class Game_BattlerBase
#--------------------------------------------------------------------------
# ● 通常能力値の最大値取得
#--------------------------------------------------------------------------
def param_max(param_id)
return 999999 if param_id == 0 # MHP
return 9999 if param_id == 1 # MMP
return 100 if param_id == 7 # Mluk
return 999
end
#--------------------------------------------------------------------------
# ● luk の最大値を取得
#--------------------------------------------------------------------------
def max_luk
return 100
end
#--------------------------------------------------------------------------
# ● luk の割合を取得
#--------------------------------------------------------------------------
def luk_rate
@luk.to_f / 100
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 各種文字色の取得
#--------------------------------------------------------------------------
def normal_color; text_color(0); end; # 通常
def system_color; text_color(16); end; # システム
def crisis_color; text_color(17); end; # ピンチ
def knockout_color; text_color(18); end; # 戦闘不能
def gauge_back_color; text_color(19); end; # ゲージ背景
def hp_gauge_color1; text_color(20); end; # HP ゲージ 1
def hp_gauge_color2; text_color(21); end; # HP ゲージ 2
def mp_gauge_color1; text_color(22); end; # MP ゲージ 1
def mp_gauge_color2; text_color(23); end; # MP ゲージ 2
def mp_cost_color; text_color(23); end; # 消費 TP
def power_up_color; text_color(24); end; # 装備 パワーアップ
def power_down_color; text_color(25); end; # 装備 パワーダウン
def tp_gauge_color1; text_color(28); end; # TP ゲージ 1
def tp_gauge_color2; text_color(29); end; # TP ゲージ 2
def tp_cost_color; text_color(29); end; # 消費 TP
def luk_gauge_color1; text_color(28); end; # luk ゲージ 1
def luk_gauge_color2; text_color(29); end; # luk ゲージ 2
#--------------------------------------------------------------------------
# ● ゲージの描画
# rate : 割合(1.0 で満タン)
# color1 : グラデーション 左端
# color2 : グラデーション 右端
#--------------------------------------------------------------------------
def draw_gauge(x, y, width, rate, color1, color2)
fill_w = (width * rate).to_i
gauge_y = y + line_height - 8
contents.fill_rect(x, gauge_y, width, 6, gauge_back_color)
contents.gradient_fill_rect(x, gauge_y, fill_w, 6, color1, color2)
end
#--------------------------------------------------------------------------
# ● TP の文字色を取得
#--------------------------------------------------------------------------
def luk_color(actor)
return normal_color
end
#--------------------------------------------------------------------------
# ● 現在値/最大値を分数形式で描画
# current : 現在値
# max : 最大値
# color1 : 現在値の色
# color2 : 最大値の色
#--------------------------------------------------------------------------
def draw_current_and_max_values(x, y, width, current, max, color1, color2)
change_color(color1)
xr = x + width
if width < 96
draw_text(xr - 40, y, 42, line_height, current, 2)
else
draw_text(xr - 92, y, 42, line_height, current, 2)
change_color(color2)
draw_text(xr - 52, y, 12, line_height, "/", 2)
draw_text(xr - 42, y, 42, line_height, max, 2)
end
end
#--------------------------------------------------------------------------
# ● luk の描画
#--------------------------------------------------------------------------
def draw_actor_luk(actor, x, y, width = 124)
draw_gauge(x, y+30, width, actor.luk_rate, luk_gauge_color1, luk_gauge_color2)
change_color(system_color)
draw_text(x, y,30, line_height*3, Vocab::luk_a)
change_color(tp_color(actor))
draw_text(x + width - 42, y+38, 62, line_height, actor.luk.to_i, 2)
end
end
#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
# バトル画面で、パーティメンバーのステータスを表示するウィンドウです。
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● ゲージエリアの描画(TP あり)
#--------------------------------------------------------------------------
def draw_gauge_area_with_tp(rect, actor)
draw_actor_hp(actor, rect.x + 0, rect.y, 72)
draw_actor_mp(actor, rect.x + 82, rect.y, 64)
draw_actor_tp(actor, rect.x + 156, rect.y, 64)
draw_actor_luk(actor, rect.x + 0, rect.y, 64)
end
#--------------------------------------------------------------------------
# ● ゲージエリアの描画(TP なし)
#--------------------------------------------------------------------------
def draw_gauge_area_without_tp(rect, actor)
draw_actor_hp(actor, rect.x + 0, rect.y, 134)
draw_actor_mp(actor, rect.x + 144, rect.y, 76)
draw_actor_luk(actor, rect.x + 0, rect.y, 100)
end
end