Project1

标题: 战斗血条脚本问题 [打印本页]

作者: 245318464    时间: 2011-11-11 23:01
标题: 战斗血条脚本问题
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================


  4. # ————————————————————————————————————

  5. # ▼▲▼ XRXS_BP 7. バトルステータス?クリアデザイン ver.1.03 ▼▲▼
  6. # by 桜雅 在土

  7. #==============================================================================
  8. # ■ Window_BattleStatus
  9. #==============================================================================
  10. class Window_BattleStatus < Window_Base_RPGVX
  11.   #--------------------------------------------------------------------------
  12.   # ● 公開インスタンス変数
  13.   #--------------------------------------------------------------------------
  14.   attr_accessor :update_cp_only # CPメーターのみの更新
  15.   #--------------------------------------------------------------------------
  16.   # ● オブジェクト初期化
  17.   #--------------------------------------------------------------------------
  18.   alias xrxs_bp7_initialize initialize
  19.   def initialize
  20.     # 初期化
  21.     @previous_hp = []
  22.     @previous_sp = []
  23.     # 呼び戻す
  24.     xrxs_bp7_initialize
  25.     # ↓Full-Viewの場合は下二行の # を消してください。
  26.     #self.opacity = 0
  27.     #self.back_opacity = 0
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● リフレッシュ
  31.   #--------------------------------------------------------------------------
  32.   alias xrxs_bp7_refresh refresh
  33.   def refresh
  34.     # CPメーターの更新のみ の場合
  35.     if @update_cp_only
  36.       xrxs_bp7_refresh
  37.       return
  38.     end
  39.     # 変更するものがない場合、飛ばす
  40.     @item_max = $game_party.actors.size
  41.     bool = false
  42.     for i in 0...@item_max
  43.       actor = $game_party.actors[i]
  44.       if (@previous_hp[i] != actor.hp) or (@previous_sp[i] != actor.sp)
  45.         bool = true
  46.       end
  47.     end
  48.     return if bool == false
  49.     # 描写を開始
  50.     self.contents.clear
  51.     for i in 0...@item_max
  52.       actor = $game_party.actors[i]
  53.       actor_x = i * 160 + 35
  54.       # 歩行キャラグラフィックの描写
  55.       draw_actor_battlegraphic(actor, actor_x - 40, 0)
  56.       # HP/SPメーターの描写
  57.       draw_actor_hp_meter_line(actor, actor_x, 62, 96, 10)
  58.       draw_actor_sp_meter_line(actor, actor_x, 80, 96, 10)
  59.       # HP数値の描写
  60.       self.contents.font.size = 12 # HP/SP数値の文字の大きさ
  61.       self.contents.font.color = Color.new(0,0,0,192)
  62.       self.contents.draw_text(actor_x-2, 56, 96, 24, actor.hp.to_s, 2)
  63.       self.contents.font.color = actor.hp == 0 ? knockout_color :
  64.       actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  65.       self.contents.draw_text(actor_x-4, 54, 96, 24, actor.hp.to_s, 2)
  66.       # SP数値の描写
  67.       self.contents.font.color = Color.new(0,0,0,192)
  68.       self.contents.draw_text(actor_x-2, 74, 96, 24, actor.sp.to_s, 2)
  69.       self.contents.font.color = actor.sp == 0 ? knockout_color :
  70.       actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  71.       self.contents.draw_text(actor_x-4, 72, 96, 24, actor.sp.to_s, 2)
  72.       # 用語「HP」と用語「SP」の描写
  73.       self.contents.font.size = 17 # 用語「HP/SP」の文字の大きさ
  74.       self.contents.font.color = Color.new(0,0,0,0)
  75.       self.contents.draw_text(actor_x+2, 32, 196, 24, $data_system.words.hp)
  76.       self.contents.draw_text(actor_x+2, 64, 196, 24, $data_system.words.sp)
  77.       self.contents.font.color = system_color # 用語「HP/SP」の文字の色
  78.       self.contents.draw_text(actor_x, 200, 196, 24, $data_system.words.hp)
  79.       self.contents.draw_text(actor_x, 200, 196, 24, $data_system.words.sp)
  80.       # 状态の描写
  81.       draw_actor_state(actor, actor_x - 36, 98)
  82.       # 値を更新
  83.       @previous_hp[i] = actor.hp
  84.       @previous_hp[i] = actor.hp
  85.     end
  86.   end
  87. end
  88. #==============================================================================
  89. # ■ Window_Base
  90. #==============================================================================
  91. class Window_Base < Window
  92.   #--------------------------------------------------------------------------
  93.   # ● HPメーター の描画
  94.   #--------------------------------------------------------------------------
  95.   def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
  96.     w = width * actor.hp / [actor.maxhp,1].max
  97.     hp_color_1 = Color.new(255, 255, 0, 192)
  98.     hp_color_2 = Color.new(255, 0, 0, 192)
  99.     self.contents.fill_rect(x, y, width, (height/4).floor, Color.new(0, 0, 0, 128))
  100.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  101.     x -= 1
  102.     y += (height/4).floor
  103.     self.contents.fill_rect(x, y, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  104.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  105.     x -= 1
  106.     y += (height/4).ceil
  107.     self.contents.fill_rect(x, y, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  108.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  109.     x -= 1
  110.     y += (height/4).ceil
  111.     self.contents.fill_rect(x, y, width, (height/4).floor, Color.new(0, 0, 0, 128))
  112.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● SPメーター の描画
  116.   #--------------------------------------------------------------------------
  117.   def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
  118.     w = width * actor.sp / [actor.maxsp,1].max
  119.     hp_color_1 = Color.new( 0, 255, 255, 192)
  120.     hp_color_2 = Color.new( 0, 0, 255, 192)
  121.     self.contents.fill_rect(x, y, width, (height/4).floor, Color.new(0, 0, 0, 128))
  122.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  123.     x -= 1
  124.     y += (height/4).floor
  125.     self.contents.fill_rect(x, y, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  126.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  127.     x -= 1
  128.     y += (height/4).ceil
  129.     self.contents.fill_rect(x, y, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  130.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  131.     x -= 1
  132.     y += (height/4).ceil
  133.     self.contents.fill_rect(x, y, width, (height/4).floor, Color.new(0, 0, 0, 128))
  134.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● 名前の描画
  138.   #--------------------------------------------------------------------------
  139.   alias xrxs_bp7_draw_actor_name draw_actor_name
  140.   def draw_actor_name(actor, x, y)
  141.     xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 状态の描画
  145.   #--------------------------------------------------------------------------
  146.   alias xrxs_bp7_draw_actor_state draw_actor_state
  147.   def draw_actor_state(actor, x, y, width = 120)
  148.     xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ● HP の描画
  152.   #--------------------------------------------------------------------------
  153.   alias xrxs_bp7_draw_actor_hp draw_actor_hp
  154.   def draw_actor_hp(actor, x, y, width = 144)
  155.     xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● SP の描画
  159.   #--------------------------------------------------------------------------
  160.   alias xrxs_bp7_draw_actor_sp draw_actor_sp
  161.   def draw_actor_sp(actor, x, y, width = 144)
  162.     xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
  163.   end
  164. end
  165. #==============================================================================
  166. # ■ Scene_Battle
  167. #==============================================================================
  168. class Scene_Battle
  169.   #--------------------------------------------------------------------------
  170.   # ● フレーム更新
  171.   #--------------------------------------------------------------------------
  172.   alias xrxs_bp7_update update
  173.   def update
  174.     xrxs_bp7_update
  175.     # メッセージウィンドウ表示中の場合
  176.     if $game_temp.message_window_showing
  177.       @status_window.update_cp_only = true      
  178.     else
  179.       @status_window.update_cp_only = false
  180.     end
  181.   end
  182. end
  183. #==============================================================================
  184. # ◇ 外部ライブラリ
  185. #==============================================================================
  186. class Window_Base
  187.   #--------------------------------------------------------------------------
  188.   # ● ライン描画 軽量版 by 桜雅 在土
  189.   #--------------------------------------------------------------------------
  190.   def draw_lineght(start_x, start_y, end_x, end_y, start_color)
  191.     # 描写距離の計算。大きめに直角時の長さ。
  192.     distance = (start_x - end_x).abs + (start_y - end_y).abs
  193.     # 描写開始
  194.     for i in 1..distance
  195.       x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  196.       y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  197.       self.contents.set_pixel(x, y, start_color)
  198.     end
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ● ライン描画 by 桜雅 在土
  202.   #--------------------------------------------------------------------------
  203.   def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  204.     # 描写距離の計算。大きめに直角時の長さ。
  205.     distance = (start_x - end_x).abs + (start_y - end_y).abs
  206.     # 描写開始
  207.     if end_color == start_color
  208.       for i in 1..distance
  209.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  210.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  211.         if width == 1
  212.           self.contents.set_pixel(x, y, start_color)
  213.         else
  214.           self.contents.fill_rect(x, y, width, width, start_color)
  215.         end
  216.       end
  217.     else
  218.       for i in 1..distance
  219.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  220.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  221.         r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  222.         g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  223.         b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  224.         a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  225.         if width == 1
  226.           self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  227.         else
  228.           self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  229.         end
  230.       end
  231.     end
  232.   end
  233. end


  234. #==============================================================================
  235. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  236. #==============================================================================
复制代码
第36行错误,这是怎么回事。
   小弟脚本盲,还望高手指点。 dsu_plus_rewardpost_czw
作者: 钢铁列兵    时间: 2011-11-11 23:48
本帖最后由 钢铁列兵 于 2011-11-11 23:50 编辑

关键是你还使用了哪些脚本?RPGVX又是哪儿来的?你的操作系统是xp还是vx?
建议你打包上传DATA里的Scripts
作者: 245318464    时间: 2011-11-13 09:33
本帖最后由 245318464 于 2011-11-13 12:05 编辑

我用的是DKRM的操作系统,DK+XP+VX的混合脚本(ps:这么复杂,出错也难免……)。
我把他发上来,请各位高手帮小弟改改在发上来。谢谢(ps:应为小弟是伸手党,所以大部分的素材+脚本都是网上搜索,想拿没关系。)
谢谢
  附件地址:http://115.com/file/e6mg34io#
新游戏测试版0.1脚本篇.7z




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