Project1

标题: RTAB系统敌人血条怎么弄 [打印本页]

作者: eu国猪    时间: 2012-6-16 15:16
标题: RTAB系统敌人血条怎么弄
RTAB系统我想怎么加一个敌人血条如下:不过却程序出错了,怎么办呀

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================  
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 重新定义的内容,可以显示敌人的HP\MP百分比
# 你可以改脚本的开头部分定义生命、精神描述词。只和敌人描述有关,可随意修改
#==============================================================================
class Window_Help < Window_Base
  def set_enemy(actor)   
    #--------------------------------------------------------------------
    # 在这里修改描述文字,比如@生命描述词="敌人生命"
    #--------------------------------------------------------------------
     
    @生命描述词 = $data_system.words.hp
    @精神描述词 = $data_system.words.sp
     
    #--------------------------------------------------------------------
    #--------------------------------------------------------------------
    self.contents.clear
    draw_actor_name(actor, 4, 0)
    draw_actor_state(actor, 140, 0)
    carol3_draw_hp_bar(actor, 284, 12)
    carol3_draw_sp_bar(actor, 460, 12)
    @text = nil
    self.visible = true
  end  
  def carol3_draw_hp_bar(actor, x, y, width = 128, height = 14) #宽度可调
    w = width * actor.hp / [actor.maxhp,1].max
    hp_color_1 = Color.new(255, 0, 0, 192)  
    hp_color_2 = Color.new(255, 255, 0, 192)  
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))  
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)  
    x -= 1  
    y += (height/4).floor  
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))  
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)  
    x -= 1  
    y += (height/4).ceil  
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))  
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)  
    x -= 1  
    y += (height/4).ceil  
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))  
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)  
    self.contents.font.color = Color.new(0,0,0,255)
    self.contents.draw_text(x+2,-3,128,32,@生命描述词,1)
    self.contents.font.color = Color.new(255,255,255,255)
    self.contents.draw_text(x,-4,128,32,@生命描述词,1)
  end  
  def carol3_draw_sp_bar(actor, x, y, width = 128, height=14)
    w = width * actor.sp / [actor.maxsp,1].max  
    hp_color_1 = Color.new( 0, 0, 255, 192)  
    hp_color_2 = Color.new( 0, 255, 255, 192)  
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))  
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)  
    x -= 1  
    y += (height/4).floor  
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))  
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)  
    x -= 1  
    y += (height/4).ceil  
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))  
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)  
    x -= 1  
    y += (height/4).ceil  
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))  
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)  
    self.contents.font.color = Color.new(0,0,0,255)
    self.contents.draw_text(x+2,-3,128,32,@精神描述词,1)
    self.contents.font.color = Color.new(255,255,255,255)
    self.contents.draw_text(x,-4,128,32,@精神描述词,1)
  end
  #--------------------------------------------------------------------------  
  # ● ライン描画 by 桜雅 在土  
  #--------------------------------------------------------------------------  
  def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)  
    # 描写距離の計算。大きめに直角時の長さ。  
    distance = (start_x - end_x).abs + (start_y - end_y).abs  
    # 描写開始  
    if end_color == start_color  
      for i in 1..distance  
        x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i  
        y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i  
        if width == 1  
          self.contents.set_pixel(x, y, start_color)  
        else  
          self.contents.fill_rect(x, y, width, width, start_color)  
        end  
      end  
    else  
      for i in 1..distance  
        x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i  
        y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i  
        r = start_color.red * (distance-i)/distance + end_color.red * i/distance  
        g = start_color.green * (distance-i)/distance + end_color.green * i/distance  
        b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance  
        a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance  
        if width == 1  
          self.contents.set_pixel(x, y, Color.new(r, g, b, a))  
        else  
          self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))  
        end  
      end  
    end  
  end  
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==================dsu_plus_rewardpost_czw
作者: woyaozhuce    时间: 2012-6-16 19:11
同求!  
作者: eu国猪    时间: 2012-6-16 19:20
呵呵
作者: 明特·布兰马修    时间: 2012-6-16 20:11
  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  
  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 + 21  
  54.       # HP/SPメーターの描写  
  55.       draw_actor_hp_meter_line(actor, actor_x, 52, 96, 12)  
  56.       draw_actor_sp_meter_line(actor, actor_x, 84, 96, 12)  
  57.       # HP数値の描写  
  58.       self.contents.font.size = 24 # HP/SP数値の文字の大きさ  
  59.       self.contents.font.color = Color.new(0,0,0,192)  
  60.       self.contents.draw_text(actor_x, 40, 96, 24, actor.hp.to_s, 2)  
  61.       self.contents.font.color = actor.hp == 0 ? knockout_color :  
  62.       actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color  
  63.       self.contents.draw_text(actor_x-2, 38, 96, 24, actor.hp.to_s, 2)  
  64.       # SP数値の描写  
  65.       self.contents.font.color = Color.new(0,0,0,192)  
  66.       self.contents.draw_text(actor_x, 72, 96, 24, actor.sp.to_s, 2)  
  67.       self.contents.font.color = actor.sp == 0 ? knockout_color :  
  68.       actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color  
  69.       self.contents.draw_text(actor_x-2, 70, 96, 24, actor.sp.to_s, 2)  
  70.       # 用語「HP」と用語「SP」の描写  
  71.       self.contents.font.size = 18 # 用語「HP/SP」の文字の大きさ  
  72.       self.contents.font.color = Color.new(0,0,0,192)  
  73.       self.contents.draw_text(actor_x+2, 32, 196, 24, $data_system.words.hp)  
  74.       self.contents.draw_text(actor_x+2, 64, 196, 24, $data_system.words.sp)  
  75.       self.contents.font.color = system_color # 用語「HP/SP」の文字の色  
  76.       self.contents.draw_text(actor_x, 30, 196, 24, $data_system.words.hp)  
  77.       self.contents.draw_text(actor_x, 62, 196, 24, $data_system.words.sp)  
  78.       # ステートの描写  
  79.       draw_actor_state(actor, actor_x, 100)  
  80.       # 値を更新  
  81.       @previous_hp[i] = actor.hp  
  82.       @previous_hp[i] = actor.hp  
  83.     end  
  84.   end  
  85. end  
  86. #==============================================================================
  87. # ■ Window_Base  
  88. #==============================================================================
  89. class Window_Base < Window  
  90.   #--------------------------------------------------------------------------  
  91.   # ● HPメーター の描画  
  92.   #--------------------------------------------------------------------------  
  93.   def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)  
  94.     w = width * actor.hp / [actor.maxhp,1].max  
  95.     hp_color_1 = Color.new(255, 0, 0, 192)  
  96.     hp_color_2 = Color.new(255, 255, 0, 192)  
  97.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))  
  98.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)  
  99.     x -= 1  
  100.     y += (height/4).floor  
  101.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))  
  102.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)  
  103.     x -= 1  
  104.     y += (height/4).ceil  
  105.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))  
  106.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)  
  107.     x -= 1  
  108.     y += (height/4).ceil  
  109.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))  
  110.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)  
  111.   end  
  112.   #--------------------------------------------------------------------------  
  113.   # ● SPメーター の描画  
  114.   #--------------------------------------------------------------------------  
  115.   def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)  
  116.     w = width * actor.sp / [actor.maxsp,1].max  
  117.     hp_color_1 = Color.new( 0, 0, 255, 192)  
  118.     hp_color_2 = Color.new( 0, 255, 255, 192)  
  119.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))  
  120.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)  
  121.     x -= 1  
  122.     y += (height/4).floor  
  123.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))  
  124.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)  
  125.     x -= 1  
  126.     y += (height/4).ceil  
  127.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))  
  128.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)  
  129.     x -= 1  
  130.     y += (height/4).ceil  
  131.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))  
  132.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)  
  133.   end  
  134.   #--------------------------------------------------------------------------  
  135.   # ● 名前の描画  
  136.   #--------------------------------------------------------------------------  
  137.   alias xrxs_bp7_draw_actor_name draw_actor_name  
  138.   def draw_actor_name(actor, x, y)  
  139.     xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true  
  140.   end  
  141.   #--------------------------------------------------------------------------  
  142.   # ● ステートの描画  
  143.   #--------------------------------------------------------------------------  
  144.   alias xrxs_bp7_draw_actor_state draw_actor_state  
  145.   def draw_actor_state(actor, x, y, width = 120)  
  146.     xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true  
  147.   end  
  148.   #--------------------------------------------------------------------------  
  149.   # ● HP の描画  
  150.   #--------------------------------------------------------------------------  
  151.   alias xrxs_bp7_draw_actor_hp draw_actor_hp  
  152.   def draw_actor_hp(actor, x, y, width = 144)  
  153.     xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true  
  154.   end  
  155.   #--------------------------------------------------------------------------  
  156.   # ● SP の描画  
  157.   #--------------------------------------------------------------------------  
  158.   alias xrxs_bp7_draw_actor_sp draw_actor_sp  
  159.   def draw_actor_sp(actor, x, y, width = 144)  
  160.     xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true  
  161.   end  
  162. end  
  163. #==============================================================================
  164. # ■ Scene_Battle  
  165. #==============================================================================
  166. class Scene_Battle  
  167.   #--------------------------------------------------------------------------  
  168.   # ● フレーム更新  
  169.   #--------------------------------------------------------------------------  
  170.   alias xrxs_bp7_update update  
  171.   def update  
  172.     xrxs_bp7_update  
  173.     # メッセージウィンドウ表示中の場合  
  174.     if $game_temp.message_window_showing  
  175.       @status_window.update_cp_only = true        
  176.     else  
  177.       @status_window.update_cp_only = false  
  178.     end  
  179.   end  
  180. end  
  181. #==============================================================================
  182. # ◇ 外部ライブラリ  
  183. #==============================================================================
  184. class Window_Base  
  185.   #--------------------------------------------------------------------------  
  186.   # ● ライン描画 軽量版 by 桜雅 在土  
  187.   #--------------------------------------------------------------------------  
  188.   def draw_lineght(start_x, start_y, end_x, end_y, start_color)  
  189.     # 描写距離の計算。大きめに直角時の長さ。  
  190.     distance = (start_x - end_x).abs + (start_y - end_y).abs  
  191.     # 描写開始  
  192.     for i in 1..distance  
  193.       x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i  
  194.       y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i  
  195.       self.contents.set_pixel(x, y, start_color)  
  196.     end  
  197.   end  
  198.   #--------------------------------------------------------------------------  
  199.   # ● ライン描画 by 桜雅 在土  
  200.   #--------------------------------------------------------------------------  
  201.   def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)  
  202.     # 描写距離の計算。大きめに直角時の長さ。  
  203.     distance = (start_x - end_x).abs + (start_y - end_y).abs  
  204.     # 描写開始  
  205.     if end_color == start_color  
  206.       for i in 1..distance  
  207.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i  
  208.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i  
  209.         if width == 1  
  210.           self.contents.set_pixel(x, y, start_color)  
  211.         else  
  212.           self.contents.fill_rect(x, y, width, width, start_color)  
  213.         end  
  214.       end  
  215.     else  
  216.       for i in 1..distance  
  217.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i  
  218.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i  
  219.         r = start_color.red * (distance-i)/distance + end_color.red * i/distance  
  220.         g = start_color.green * (distance-i)/distance + end_color.green * i/distance  
  221.         b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance  
  222.         a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance  
  223.         if width == 1  
  224.           self.contents.set_pixel(x, y, Color.new(r, g, b, a))  
  225.         else  
  226.           self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))  
  227.         end  
  228.       end  
  229.     end  
  230.   end  
  231. end  
  232. #==============================================================================
  233. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  234. #==============================================================================
复制代码
试试这个血条脚本行不行哦

作者: woyaozhuce    时间: 2012-6-16 21:07
不行   

4.jpg (64.36 KB, 下载次数: 0)

4.jpg

作者: kangxi0109    时间: 2012-6-16 23:41
试试这个?
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. # ■ エネミーHP&SP(ver 0.98)

  5. # □ カスタマイズポイント
  6. #==============================================================================
  7. module PLAN_HPSP_DRAW
  8. FONT_NAME         = ["黑体", "楷体", "宋体"]    # フォント
  9. FONT_SIZE         =  14                               # フォントサイズ
  10. FONT_BOLD         = true                              # 太字
  11. FONT_ITALIC       = true                              # 斜体

  12. DRAW_NAME         = false                             # 名前の描画
  13. DRAW_HP           = true                              # HP の描画
  14. DRAW_SP           = true                              # SP の描画

  15. DRAW_WIDTH        =  80                               # 描画幅
  16. DRAW_HEIGHT       = 3 * 32                            # 描画高さ
  17. DRAW_SPACE        =   0                               # 行間
  18. DRAW_Y            =  36                               # Y 座標修正値
  19. end


  20. #==============================================================================
  21. # ■ Sprite_Battler
  22. #==============================================================================

  23. class Sprite_Battler < RPG::Sprite
  24. #--------------------------------------------------------------------------
  25. # ● オブジェクト初期化
  26. #--------------------------------------------------------------------------
  27. alias plan_enemy_hpsp_draw_initialize initialize
  28. def initialize(viewport, battler = nil)
  29.    # 元のメソッドに戻す
  30.    plan_enemy_hpsp_draw_initialize(viewport, battler)
  31.    # エネミーの場合
  32.    if @battler.is_a?(Game_Enemy)
  33.      width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
  34.      height = PLAN_HPSP_DRAW::DRAW_HEIGHT + 32
  35.      x = @battler.screen_x - width / 2
  36.      y = @battler.screen_y - height + 32 + PLAN_HPSP_DRAW::DRAW_Y
  37.      @enemy_hpsp_window = Window_Base.new(x, y, width, height)
  38.      @enemy_hpsp_window.contents = Bitmap.new(width - 32, height - 32)
  39.      @enemy_hpsp_window.contents.font.name = PLAN_HPSP_DRAW::FONT_NAME
  40.      @enemy_hpsp_window.contents.font.size = PLAN_HPSP_DRAW::FONT_SIZE
  41.      @enemy_hpsp_window.contents.font.bold = PLAN_HPSP_DRAW::FONT_BOLD
  42.      @enemy_hpsp_window.contents.font.italic = PLAN_HPSP_DRAW::FONT_ITALIC
  43.      y = 0
  44.      @old_enemy_hpsp = []
  45.      one_line = ((PLAN_HPSP_DRAW::FONT_SIZE * 100 / 28) * 32) / 100
  46.      if PLAN_HPSP_DRAW::DRAW_NAME
  47.        @enemy_hpsp_window.draw_actor_name(@battler, 0, y, width - 32)
  48.        y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
  49.        @old_enemy_hpsp.push(@battler.name)
  50.      end
  51.      if PLAN_HPSP_DRAW::DRAW_HP
  52.        @enemy_hpsp_window.draw_actor_hp2222(@battler, 0, y, width - 32)
  53.        y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
  54.        @old_enemy_hpsp.push(@battler.hp)
  55.      end
  56.      if PLAN_HPSP_DRAW::DRAW_SP
  57.        @enemy_hpsp_window.draw_actor_sp2222(@battler, 0, y, width - 32)
  58.        @old_enemy_hpsp.push(@battler.sp)
  59.      end
  60.      @enemy_hpsp_window.opacity = 0
  61.      @enemy_hpsp_window.contents_opacity = 0
  62.      @enemy_hpsp_window.z = -2
  63.    end
  64. end
  65. #--------------------------------------------------------------------------
  66. # ● 解放
  67. #--------------------------------------------------------------------------
  68. alias plan_enemy_hpsp_draw_dispose dispose
  69. def dispose
  70.    # エネミーの場合
  71.    if @battler.is_a?(Game_Enemy)
  72.      @enemy_hpsp_window.dispose
  73.    end
  74.    # 元のメソッドに戻す
  75.    plan_enemy_hpsp_draw_dispose
  76. end
  77. #--------------------------------------------------------------------------
  78. # ● フレーム更新
  79. #--------------------------------------------------------------------------
  80. alias plan_enemy_hpsp_draw_update update
  81. def update
  82.    # 元のメソッドに戻す
  83.    plan_enemy_hpsp_draw_update
  84.    # エネミーの場合
  85.    if @battler.is_a?(Game_Enemy)
  86.      @enemy_hpsp_window.visible = @battler_visible
  87.    # スプライトの座標を設定
  88.      width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
  89.      @enemy_hpsp_window.x = self.x - width / 2
  90.      @now_enemy_hpsp = []
  91.      if PLAN_HPSP_DRAW::DRAW_NAME
  92.        @now_enemy_hpsp.push(@battler.name)
  93.      end
  94.      if PLAN_HPSP_DRAW::DRAW_HP
  95.        @now_enemy_hpsp.push(@battler.hp)
  96.      end
  97.      if PLAN_HPSP_DRAW::DRAW_SP
  98.        @now_enemy_hpsp.push(@battler.sp)
  99.      end
  100.      if @old_enemy_hpsp != @now_enemy_hpsp and $game_temp.enemy_hpsp_refresh
  101.        @old_enemy_hpsp = @now_enemy_hpsp
  102.        @enemy_hpsp_window.contents.clear
  103.        y = 0
  104.        width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
  105.        one_line = ((PLAN_HPSP_DRAW::FONT_SIZE * 100 / 28) * 32) / 100
  106.        if PLAN_HPSP_DRAW::DRAW_NAME
  107.          @enemy_hpsp_window.draw_actor_name(@battler, 0, y, width - 32)
  108.          y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
  109.        end
  110.        if PLAN_HPSP_DRAW::DRAW_HP
  111.          @enemy_hpsp_window.draw_actor_hp2222(@battler, 0, y, width - 32)
  112.          y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
  113.        end
  114.        if PLAN_HPSP_DRAW::DRAW_SP
  115.          @enemy_hpsp_window.draw_actor_sp2222(@battler, 0, y, width - 32)
  116.        end
  117.        Graphics.frame_reset
  118.      end
  119.    end
  120. end
  121. #--------------------------------------------------------------------------
  122. # ● visible の設定
  123. #--------------------------------------------------------------------------
  124. if !method_defined?("plan_enemy_hpsp_draw_visible=")
  125.    alias plan_enemy_hpsp_draw_visible= visible=
  126. end
  127. def visible=(bool)
  128.    # エネミーの場合
  129.    if @battler.is_a?(Game_Enemy)
  130.      @enemy_hpsp_window.visible = bool
  131.    end
  132.    # 元のメソッドに戻す
  133.    self.plan_enemy_hpsp_draw_visible=(bool)
  134. end
  135. #--------------------------------------------------------------------------
  136. # ● 不透明度の設定
  137. #--------------------------------------------------------------------------
  138. if !method_defined?("plan_enemy_hpsp_draw_opacity=")
  139.    alias plan_enemy_hpsp_draw_opacity= opacity=
  140. end
  141. def opacity=(n)
  142.    # 元のメソッドに戻す
  143.    self.plan_enemy_hpsp_draw_opacity=(n)
  144.    # エネミーの場合
  145.    if @battler.is_a?(Game_Enemy)
  146.      @enemy_hpsp_window.contents_opacity = n
  147.    end
  148. end
  149. #--------------------------------------------------------------------------
  150. # ● ダメージ
  151. #--------------------------------------------------------------------------
  152. def damage(value, critical)
  153.    super(value, critical)
  154.    bitmap = @_damage_sprite.bitmap
  155.    @_damage_sprite.dispose
  156.    @_damage_sprite = ::Sprite.new(Viewport.new(0, 0, 640, 480))
  157.    @_damage_sprite.bitmap = bitmap
  158.    @_damage_sprite.ox = 80
  159.    @_damage_sprite.oy = 20
  160.    @_damage_sprite.x = self.x
  161.    @_damage_sprite.y = self.y - self.oy / 2
  162.    @_damage_sprite.viewport.z = self.viewport.z + 1
  163.    @_damage_sprite.z = 3000
  164.    @_damage_duration = 40
  165. end
  166. #--------------------------------------------------------------------------
  167. # ● ダメージ解放
  168. #--------------------------------------------------------------------------
  169. def dispose_damage
  170.    if @_damage_sprite != nil
  171.      @_damage_sprite.viewport.dispose
  172.    end
  173.    super
  174. end
  175. end





  176. #==============================================================================
  177. # ■ Game_Temp
  178. #==============================================================================

  179. class Game_Temp
  180. #--------------------------------------------------------------------------
  181. # ● 公開インスタンス変数
  182. #--------------------------------------------------------------------------
  183. attr_accessor :enemy_hpsp_refresh
  184. #--------------------------------------------------------------------------
  185. # ● オブジェクト初期化
  186. #--------------------------------------------------------------------------
  187. alias plan_enemy_hpsp_draw_initialize initialize
  188. def initialize
  189.    # 元のメソッドに戻す
  190.    plan_enemy_hpsp_draw_initialize
  191.    @enemy_hpsp_refresh = false
  192. end
  193. end

  194. #==============================================================================
  195. # ■ Scene_Battle
  196. #==============================================================================

  197. class Scene_Battle
  198. #--------------------------------------------------------------------------
  199. # ● プレバトルフェーズ開始 (エネミー名+アルファベット用)
  200. #--------------------------------------------------------------------------
  201. alias plan_enemy_hpsp_draw_start_phase1 start_phase1
  202. def start_phase1
  203.    $game_temp.enemy_hpsp_refresh = true
  204.    # 元のメソッドに戻す
  205.    plan_enemy_hpsp_draw_start_phase1
  206. end
  207. #--------------------------------------------------------------------------
  208. # ● パーティコマンドフェーズ開始 (エネミー名+アルファベット用)
  209. #--------------------------------------------------------------------------
  210. alias plan_enemy_hpsp_draw_start_phase2 start_phase2
  211. def start_phase2
  212.    $game_temp.enemy_hpsp_refresh = false
  213.    # 元のメソッドに戻す
  214.    plan_enemy_hpsp_draw_start_phase2
  215. end
  216. #--------------------------------------------------------------------------
  217. # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  218. #--------------------------------------------------------------------------
  219. alias plan_enemy_hpsp_draw_update_phase4_step5 update_phase4_step5
  220. def update_phase4_step5
  221.    # 元のメソッドに戻す
  222.    plan_enemy_hpsp_draw_update_phase4_step5
  223.    $game_temp.enemy_hpsp_refresh = true
  224. end
  225. #--------------------------------------------------------------------------
  226. # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  227. #--------------------------------------------------------------------------
  228. alias plan_enemy_hpsp_draw_update_phase4_step6 update_phase4_step6
  229. def update_phase4_step6
  230.    # 元のメソッドに戻す
  231.    plan_enemy_hpsp_draw_update_phase4_step6
  232.    $game_temp.enemy_hpsp_refresh = false
  233. end
  234. end


  235. #==============================================================================
  236. # ■ Window_Base
  237. #==============================================================================

  238. class Window_Base < Window
  239. #--------------------------------------------------------------------------
  240. # ● 名前の描画
  241. #--------------------------------------------------------------------------
  242. def draw_actor_name(actor, x, y, width = 120, align = 0)
  243.    self.contents.font.color = normal_color
  244.    align = 1 if $scene.is_a?(Scene_Battle)
  245.    self.contents.draw_text(x, y, width, 32, actor.name, align)
  246. end
  247. #--------------------------------------------------------------------------
  248. # ● ステートの描画
  249. #--------------------------------------------------------------------------
  250. def draw_actor_state(actor, x, y, width = 120)
  251.    # 元のメソッドに戻す
  252.    text = make_battler_state_text(actor, width, true)
  253.    self.contents.draw_text(x, y, width, 32, text, 1)
  254. end
  255. end


  256. #==============================================================================
  257. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  258. #==============================================================================

  259. class Window_Base < Window
  260.   def draw_actor_hp2222(actor, x, y, width = 100, height=8)
  261.     y+=3
  262.     olx = x
  263.     oly = y
  264.     w = width * actor.hp / [actor.maxhp,1].max
  265.     hp_color_1 = Color.new(255, 0, 0, 192)
  266.     hp_color_2 = Color.new(255, 255, 0, 192)
  267.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  268.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  269.     x -= 1
  270.     y += (height/4).floor
  271.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  272.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  273.     x -= 1
  274.     y += (height/4).ceil
  275.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  276.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  277.     x -= 1
  278.     y += (height/4).ceil
  279.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  280.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  281.     x = olx
  282.     y = oly-14   
  283.     # 描绘字符串 "HP"
  284.     self.contents.font.color = system_color
  285.     self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
  286.     # 计算描绘 MaxHP 所需的空间
  287.     if width - 32 >= 108
  288.       hp_x = x + width - 108
  289.       flag = true
  290.     elsif width - 32 >= 48
  291.       hp_x = x + width - 48
  292.       flag = false
  293.     end
  294.     # 描绘 HP
  295.     self.contents.font.color = actor.hp == 0 ? knockout_color :
  296.       actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  297.     self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
  298.     # 描绘 MaxHP
  299.     if flag
  300.       self.contents.font.color = normal_color
  301.       self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
  302.       self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
  303.     end   
  304.   end
  305.   def draw_actor_sp2222(actor, x, y, width = 100, height = 8)
  306.     y+=3
  307.     olx = x
  308.     oly = y
  309.     w = width * actor.sp / [actor.maxsp,1].max
  310.     hp_color_1 = Color.new( 0, 0, 255, 192)
  311.     hp_color_2 = Color.new( 0, 255, 255, 192)
  312.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  313.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  314.     x -= 1
  315.     y += (height/4).floor
  316.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  317.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  318.     x -= 1
  319.     y += (height/4).ceil
  320.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  321.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  322.     x -= 1
  323.     y += (height/4).ceil
  324.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  325.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  326.     x = olx
  327.     y = oly-14
  328.     # 描绘字符串 "SP"
  329.     self.contents.font.color = system_color
  330.     self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
  331.     # 计算描绘 MaxSP 所需的空间
  332.     if width - 32 >= 108
  333.       sp_x = x + width - 108
  334.       flag = true
  335.     elsif width - 32 >= 48
  336.       sp_x = x + width - 48
  337.       flag = false
  338.     end
  339.     # 描绘 SP
  340.     self.contents.font.color = actor.sp == 0 ? knockout_color :
  341.       actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  342.     self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
  343.     # 描绘 MaxSP
  344.     if flag
  345.       self.contents.font.color = normal_color
  346.       self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
  347.       self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
  348.     end   
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ● ライン描画 by 桜雅 在土
  352.   #--------------------------------------------------------------------------
  353.   def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  354.     # 描写距離の計算。大きめに直角時の長さ。
  355.     distance = (start_x - end_x).abs + (start_y - end_y).abs
  356.     # 描写開始
  357.     if end_color == start_color
  358.       for i in 1..distance
  359.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  360.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  361.         if width == 1
  362.           self.contents.set_pixel(x, y, start_color)
  363.         else
  364.           self.contents.fill_rect(x, y, width, width, start_color)
  365.         end
  366.       end
  367.     else
  368.       for i in 1..distance
  369.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  370.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  371.         r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  372.         g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  373.         b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  374.         a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  375.         if width == 1
  376.           self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  377.         else
  378.           self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  379.         end
  380.       end
  381.     end
  382.   end
  383. end
  384. #==============================================================================
  385. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  386. #==============================================================================
复制代码

作者: eu国猪    时间: 2012-6-17 07:53
不行耶。。




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