Project1

标题: 针对544*460分辨率游戏状态栏添加TP与经验槽显示的脚本 [打印本页]

作者: zx903193387    时间: 2015-12-10 09:52
标题: 针对544*460分辨率游戏状态栏添加TP与经验槽显示的脚本
本帖最后由 zx903193387 于 2015-12-10 09:59 编辑

修改那一栏的“兮焉贤”是我网名,不要在意
RUBY 代码复制
  1. #针对544*460分辨率游戏状态栏添加TP与经验槽显示的脚本
  2. #原脚本作者:Taroxd
  3. #修改:兮焉贤
  4. #原功能:在人物选择栏和状态栏添加TP值显示
  5. #添加功能:在人物选择栏和状态栏添加以图形形式存在的经验条并将HP、MP与TP在状态栏
  6. #的样式修改为适应544*460分辨率的表现形式
  7. #本脚本经过游戏作者的大幅度改造,需要在配合大量特定脚本与修改系统本身脚本的情况
  8. #下使用,否则会出现一系列问题
  9. #本脚本为544*460分辨率游戏量身打造,在默认分辨率下使用游戏会出错
  10. #如需要使用,请添加Taroxd基础脚本,并把游戏分辨率设为544*460
  11. #由于游戏使用了额外的LNX11_XP战斗脚本,因而无法确定在基础的战斗系统之下是否会有
  12. #显示错误
  13. #==============================================================================
  14. #  ●設定區域
  15. #==============================================================================
  16.  
  17. module WD
  18. module Exp_Gauge
  19.   #EXP條COLOR,請修改成TEXT文字
  20.   EXP_GAUGE_COLOR1 = 6
  21.   EXP_GAUGE_COLOR2 = 14
  22.  
  23.   #EXP條文字顯示設定,true為打開,false為關閉
  24.   EXP_TEXT_DISPLAY = true
  25. end
  26. end
  27.  
  28. #==============================================================================
  29. # ■ Window_Base
  30. #------------------------------------------------------------------------------
  31. #  ゲーム中の全てのウィンドウのスーパークラスです。
  32. #==============================================================================
  33.  
  34. class Window_Base < Window
  35.   include WD::Exp_Gauge
  36.  
  37.   def exp_gauge_color1;   text_color(EXP_GAUGE_COLOR1);  end;    # EXP ゲージ 1
  38.   def exp_gauge_color2;   text_color(EXP_GAUGE_COLOR2);  end;    # EXP ゲージ 2
  39.  
  40. #--------------------------------------------------------------------------
  41. # ● HP の描画(针对544*460的视觉效果修改)
  42. #--------------------------------------------------------------------------
  43.   def draw_actor_hp(actor, x, y, width = 204)
  44.     draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  45.     change_color(system_color)
  46.     draw_text(x, y, 30, line_height, Vocab::hp_a)
  47.     draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,
  48.       hp_color(actor), normal_color)
  49.   end
  50. #--------------------------------------------------------------------------
  51. # ● MP の描画(针对544*460的视觉效果修改)
  52. #--------------------------------------------------------------------------
  53.   def draw_actor_mp(actor, x, y, width = 124)
  54.     draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  55.     change_color(system_color)
  56.     draw_text(x, y, 30, line_height, Vocab::mp_a)
  57.     draw_current_and_max_values(x, y, width, actor.mp, actor.mmp,
  58.       mp_color(actor), normal_color)
  59.   end
  60. #--------------------------------------------------------------------------
  61. # ● TP の描画(针对544*460的视觉效果修改)
  62. #--------------------------------------------------------------------------
  63.   def draw_actor_tp(actor, x, y, width = 124)
  64.     draw_gauge(x, y, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  65.     change_color(system_color)
  66.     draw_text(x, y, 30, line_height, Vocab::tp_a)
  67.     change_color(tp_color(actor))
  68.     draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i, 2)
  69.   end
  70. #-----------------------------------------------------------------------------
  71. # ● シンプルなステータスの描画(针对544*460的视觉效果修改)
  72. #-----------------------------------------------------------------------------
  73. Taroxd::MenuTP = true
  74.   def draw_actor_simple_status(actor, x, y)
  75.     draw_actor_name(actor, x, y + line_height * 0.5)
  76.     draw_actor_level(actor, x, y - line_height * 0.5)
  77.     draw_actor_icons(actor, x, y + line_height * 1.5)
  78.     draw_actor_class(actor, x + 120, y - line_height * 0.5)
  79.     draw_actor_hp(actor, x + 120, y + line_height * 0.5)
  80.     draw_actor_mp(actor, x + 120, y + line_height * 1.5, 100)
  81.     draw_actor_tp(actor, x + 224, y + line_height * 1.5, 100)
  82.     draw_actor_exp(actor, x, y + line_height * 2.5, EXP_TEXT_DISPLAY)
  83.   end
  84. end
  85. class Window_Status < Window_Selectable
  86.   def_chain :draw_basic_info do |old, x, y|
  87.     draw_actor_level(@actor, x, y)
  88.     draw_actor_icons(@actor, x, y + line_height)
  89.     draw_actor_hp(@actor, x, y + line_height * 0.9)
  90.     draw_actor_mp(@actor, x, y + line_height * 1.9, 100)
  91.     draw_actor_tp(@actor, x + 104, y + line_height * 1.9, 100)
  92.     draw_actor_exp2(@actor, x, y + line_height * 3, EXP_TEXT_DISPLAY)
  93.   end
  94. end
  95. #--------------------------------------------------------------------------
  96. # ● 経験値情報の描画(针对544*460的视觉效果修改)
  97. #--------------------------------------------------------------------------
  98.   def draw_exp_info(x, y)
  99.     s1 = @actor.max_level? ? "-------" : @actor.exp
  100.     s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp
  101.     s_next = sprintf(Vocab::ExpNext, Vocab::level)
  102.     change_color(system_color)
  103.     draw_text(x+80, y + line_height * 0, 180, line_height, Vocab::ExpTotal)
  104.     draw_text(x+80, y + line_height * 1.2, 180, line_height, s_next)
  105.     change_color(normal_color)
  106.     draw_text(x+100, y + line_height * 0.6, 180, line_height, s1, 2)
  107.     draw_text(x+100, y + line_height * 1.8, 180, line_height, s2, 2)
  108.   end
  109. #--------------------------------------------------------------------------
  110. # ● EXP の描画(针对544*460的视觉效果修改)
  111. #--------------------------------------------------------------------------
  112.   def draw_actor_exp(actor, x, y, display = true, width = 328)
  113.     this_level = actor.exp - actor.past_level_exp
  114.     next_level = actor.next_level_exp - actor.past_level_exp
  115.     draw_gauge(x, y, width, actor.exp_rate, exp_gauge_color1, exp_gauge_color2)
  116.     change_color(system_color)
  117.     if display
  118.       draw_text(x, y, 30, line_height, "EXP")
  119.       draw_current_and_max_values(x, y, width, this_level, next_level, mp_color(actor), normal_color)
  120.     end
  121.   end
  122.   def draw_actor_exp2(actor, x, y, display = true, width = 448)
  123.     this_level = actor.exp - actor.past_level_exp
  124.     next_level = actor.next_level_exp - actor.past_level_exp
  125.     draw_gauge(x, y, width, actor.exp_rate, exp_gauge_color1, exp_gauge_color2)
  126.     change_color(system_color)
  127.     if display
  128.       draw_text(x, y, 30, line_height, "EXP")
  129.       draw_current_and_max_values(x, y, width, this_level, next_level, mp_color(actor), normal_color)
  130.     end
  131.   end
  132.  
  133.  
  134. class Game_Actor < Game_Battler
  135.   #--------------------------------------------------------------------------
  136.   # ● EXP の割合を取得
  137.   #--------------------------------------------------------------------------
  138.   def exp_rate
  139.     this_level = exp - past_level_exp
  140.     next_level = next_level_exp - past_level_exp
  141.     next_level > 0 ? this_level.to_f / next_level : 0
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 前のレベルの経験値を取得
  145.   #--------------------------------------------------------------------------
  146.   def past_level_exp
  147.     @level > 1 ? exp_for_level(@level - 1) : 0
  148.   end
  149. end

作者: 怪蜀黍    时间: 2015-12-14 19:11
XD的脚本系列需要基础模板才能运行的,汝不放上来喵?




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1