查看: 2766|回复: 4

[已经解决] 如何在战斗中给敌人加血槽?急.

[复制链接]
梦石
0
星屑
50
在线时间
46 小时
注册时间
2012-4-28
回帖
7
发表于 2012-10-20 19:08:54 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 小驴生制作组 于 2012-10-26 14:35 编辑

rmva,急求(无任何要求,本人小白,脚本放在哪里我都不知道!)
谢谢!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1

虚空人形

梦石
0
星屑
4866
在线时间
2037 小时
注册时间
2011-8-11
回帖
3260

贵宾

发表于 2012-10-21 08:05:29 | 显示全部楼层
本帖最后由 hcm 于 2012-10-21 08:08 编辑

地球村发的脚本合集http://rpg.blue/thread-225130-1-1.html
有的,但敌人血条仅在攻击时出现。
或者
  1. #==============================================================================
  2. # 功能:战斗中显示敌人血和蓝于敌人脚下
  3. # 适用:RMVX Ace
  4. # 作者:殇殃 2012.3.10
  5. # 使用方法:复制整个脚本插入到Main之前
  6. # 注意:由于血条是显示在敌人脚下,所以敌群的位置不能太靠底部,不然会被挡住。
  7. # 可以自行更改坐标修改显示位置、血条的颜色等。
  8. #==============================================================================
  9. # ■ Window_Base
  10. #------------------------------------------------------------------------------
  11. #  游戏中全部窗口的超级类。
  12. #==============================================================================

  13. class Window_Base < Window
  14. #--------------------------------------------------------------------------
  15. # ● 描绘敌人HP
  16. #--------------------------------------------------------------------------
  17. def draw_enemy_hp(enemy, x, y, width = 80)
  18. draw_gauge(x, y, width, enemy.hp_rate, hp_gauge_color1, hp_gauge_color2)
  19. self.contents.font.color = system_color
  20. self.contents.draw_text(x, y, 30, line_height, Vocab::hp_a)
  21. self.contents.font.color = hp_color(enemy)
  22. self.contents.draw_text(x + width - 64, y, 64, line_height, enemy.hp, 2)
  23. #一个数字占16像素
  24. end
  25. #--------------------------------------------------------------------------
  26. # ● 绘制敌人MP
  27. #--------------------------------------------------------------------------
  28. def draw_enemy_mp(enemy, x, y, width = 80)
  29. draw_gauge(x, y, width, enemy.mp_rate, mp_gauge_color1, mp_gauge_color2)
  30. self.contents.font.color = system_color
  31. self.contents.draw_text(x, y, 30, line_height, Vocab::mp_a)
  32. self.contents.font.color = mp_color(enemy)
  33. self.contents.draw_text(x + width - 64, y, 64, line_height, enemy.mp, 2)
  34. end
  35. end
  36. #==============================================================================
  37. # ■ Sprite_Battler
  38. #------------------------------------------------------------------------------
  39. #  战斗显示用活动块。Game_Battler 类的实例监视、
  40. # 活动块的状态的监视、活动块状态自动变化。
  41. #==============================================================================

  42. class Sprite_Battler < Sprite_Base
  43. #--------------------------------------------------------------------------
  44. # ● 初始化对象
  45. # viewport : 视区
  46. # battler : 战斗者 (Game_Battler)
  47. #--------------------------------------------------------------------------
  48. def initialize(viewport, battler = nil)
  49. super(viewport)
  50. @battler = battler
  51. @battler_visible = false
  52. @effect_type = nil
  53. @effect_duration = 0
  54. if @battler.is_a?(Game_Enemy)
  55. width = 24 + 80 #边距12*2+血条的长度(在draw_enemy_hp中定义)
  56. height = 24 + 24*2 #边距12*2+line_height*2
  57. x = @battler.screen_x - width/2 #screen_x是怪物图片水平方向上的中点位置
  58. y = @battler.screen_y - 12 #边距12,显示HP/MP的窗口无边框
  59. @enemy_hpmp_window = Window_Base.new(x, y, width, height)
  60. @enemy_hpmp_window.opacity = 0
  61. @enemy_hpmp_window.contents = Bitmap.new(width - 24, height - 24)#位图比窗口小24像素取消边框
  62. @enemy_hpmp_window.draw_enemy_hp(@battler, 0, 0)
  63. @old_hp = -1
  64. @enemy_hpmp_window.draw_enemy_mp(@battler, 0, 24)
  65. @old_mp = -1
  66. end
  67. end
  68. #--------------------------------------------------------------------------
  69. # ● 释放
  70. #--------------------------------------------------------------------------
  71. def dispose
  72. if self.bitmap != nil
  73. self.bitmap.dispose
  74. @enemy_hpmp_window.dispose
  75. end
  76. super
  77. end
  78. #--------------------------------------------------------------------------
  79. # ● 更新画面
  80. #--------------------------------------------------------------------------
  81. def update
  82. super
  83. if @battler == nil
  84. self.bitmap = nil
  85. else
  86. @use_sprite = @battler.use_sprite?
  87. if @use_sprite
  88. update_bitmap
  89. update_origin
  90. update_position
  91. end
  92. setup_new_effect
  93. setup_new_animation
  94. update_effect
  95. if @enemy_hpmp_window != nil and (@old_hp != @battler.hp or @old_mp != @battler.mp)
  96. if @battler.hp == 0
  97. @enemy_hpmp_window.hide
  98. else
  99. @enemy_hpmp_window.contents.clear
  100. @enemy_hpmp_window.draw_enemy_hp(@battler, 0, 0)
  101. @old_hp = @battler.hp
  102. @enemy_hpmp_window.draw_enemy_mp(@battler, 0, 24)
  103. @old_mp = @battler.mp
  104. @enemy_hpmp_window.show #怪物死后再被复活
  105. end #if battler.hp == 0
  106. end
  107. end #if @battler == nil
  108. end

  109. end
复制代码

或者http://rpg.blue/forum.php?m ... DQ2fDIzMTQyMQ%3D%3D
回复

使用道具 举报

梦石
0
星屑
604
在线时间
333 小时
注册时间
2011-11-19
回帖
166
发表于 2012-10-21 11:26:47 | 显示全部楼层
本帖最后由 q854240045 于 2012-10-21 13:02 编辑
  1. #==============================================================================
  2. # +++ MOG - Combo Count (v1.2) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]http://www.atelier-rgss.com/[/url]
  6. #==============================================================================
  7. # Apresenta a quantidade de acertos no alvo e o dano maximo.
  8. #==============================================================================
  9. # É necessário ter os arquivos imagens na pasta Graphics/Systems.
  10. # Combo_Damage.png
  11. # Combo_Hud.png
  12. # Combo_Number.png
  13. #==============================================================================

  14. #==============================================================================
  15. # ● Histórico (Version History)
  16. #==============================================================================
  17. # v 1.2 - Corrigido o erro de crash randômico. (relativo a dispose de imagem.)
  18. # v 1.1 - Opção de definir a prioridade da Hud.
  19. #==============================================================================
  20. module MOG_COMBO_COUNT
  21.   #Ativar tempo para fazer combo.
  22.   TIME_COUNT = true
  23.   # Tempo para fazer um combo. (60 = 1s)
  24.   COMBO_TIME = 120
  25.   # Cancelar a contagem de Combo caso o inimigo acertar o herói.
  26.   ENEMY_CANCEL_COMBO = true
  27.   # Posição geral das imagens. X Y
  28.   COMBO_POSITION = [10,90]
  29.   # Posição do número de HITS. X Y
  30.   HIT_POSITION = [55,20]
  31.   # Posição do número de dano. X Y
  32.   TOTAL_POSITION = [100,-20]
  33.   # Prioridade da HUD
  34.   HUD_Z = 1
  35. end

  36. #===============================================================================
  37. # ■ Game_Temp
  38. #===============================================================================
  39. class Game_Temp
  40.    attr_accessor :combo_hit
  41.    attr_accessor :max_damage   
  42.    attr_accessor :combo_time  
  43.   #--------------------------------------------------------------------------
  44.   # ● initialize
  45.   #--------------------------------------------------------------------------   
  46.    alias mog_combo_display_initialize initialize
  47.    def initialize
  48.        @combo_hit = 0
  49.        @max_damage = 0  
  50.        @combo_time = 0   
  51.        mog_combo_display_initialize
  52.    end
  53. end

  54. #===============================================================================
  55. # ■ Game_Battler
  56. #===============================================================================
  57. class Game_Battler
  58.   
  59.   #--------------------------------------------------------------------------
  60.   # ● Item Apply
  61.   #--------------------------------------------------------------------------      
  62.   alias mog_combo_display_item_apply item_apply
  63.   def item_apply(user, item)
  64.       mog_combo_display_item_apply(user, item)
  65.       unless @result.hit?
  66.          $game_temp.combo_time = 0
  67.       end  
  68.   end  
  69.   
  70.   #--------------------------------------------------------------------------
  71.   # ● execute_damage
  72.   #--------------------------------------------------------------------------     
  73.   alias mog_combo_display_execute_damage execute_damage
  74.   def execute_damage(user)
  75.       mog_combo_display_execute_damage(user)
  76.       if @result.hp_damage > 0   
  77.           if user.is_a?(Game_Actor)  
  78.              $game_temp.combo_hit += 1
  79.              $game_temp.max_damage += @result.hp_damage
  80.              $game_temp.combo_time = MOG_COMBO_COUNT::COMBO_TIME
  81.           else
  82.              $game_temp.combo_time = 0 if MOG_COMBO_COUNT::ENEMY_CANCEL_COMBO == true
  83.           end  
  84.       end  
  85.     end
  86. end

  87. #===============================================================================
  88. # Scene_Battle
  89. #===============================================================================
  90. class Scene_Battle < Scene_Base

  91.   #--------------------------------------------------------------------------
  92.   # ● start
  93.   #--------------------------------------------------------------------------
  94.   alias mog_combo_start start
  95.   def start
  96.       create_cb_sprite
  97.       mog_combo_start
  98.   end
  99.   
  100.   #--------------------------------------------------------------------------
  101.   # ● create_cb_sprite
  102.   #--------------------------------------------------------------------------  
  103.   def create_cb_sprite
  104.       @combo_sprite = Combo_Sprite_Hud.new
  105.   end

  106.   #--------------------------------------------------------------------------
  107.   # ● Terminate
  108.   #--------------------------------------------------------------------------  
  109.   alias mog_combo_terminate terminate
  110.   def terminate
  111.       mog_combo_terminate
  112.       @combo_sprite.dispose
  113.   end
  114.   
  115.   #--------------------------------------------------------------------------
  116.   # ● update_basic
  117.   #--------------------------------------------------------------------------
  118.   alias mog_combo_update_basic update_basic
  119.   def update_basic
  120.       mog_combo_update_basic
  121.       update_combo_hit   
  122.   end      
  123.   
  124.   #--------------------------------------------------------------------------
  125.   # ● Update Combo Hit
  126.   #--------------------------------------------------------------------------   
  127.   def update_combo_hit
  128.       @combo_sprite.update
  129.       if (@spriteset.animation? or @spriteset.effect?)
  130.           @combo_sprite.combo_wait = true
  131.       else
  132.           @combo_sprite.combo_wait = false
  133.       end      
  134.   end
  135.    
  136. end  

  137. #===============================================================================
  138. # ■ Combo_Sprite_Hud
  139. #===============================================================================
  140. class Combo_Sprite_Hud
  141.    attr_accessor :combo_wait
  142.    include MOG_COMBO_COUNT
  143.    
  144. #--------------------------------------------------------------------------
  145. # ● Initialize
  146. #--------------------------------------------------------------------------
  147.   def initialize
  148.       dispose
  149.       @combo_wait = false
  150.       $game_temp.combo_time = 0
  151.       $game_temp.combo_hit = 0
  152.       $game_temp.max_damage = 0     
  153.       @combo_hit_old = 0
  154.       @animation_speed = 0
  155.       @pos_x = COMBO_POSITION[0]
  156.       @pos_x_fix = 0
  157.       @pos_y = COMBO_POSITION[1]
  158.       create_combo_sprite
  159.       create_total_damage_sprite     
  160.       create_hud_sprite     
  161.    end  
  162.    
  163. #--------------------------------------------------------------------------
  164. # ● create_hud_sprite   
  165. #--------------------------------------------------------------------------
  166. def create_hud_sprite   
  167.      @hud = Sprite.new
  168.      @hud.bitmap = Cache.system("Combo_HUD")
  169.      @hud.z = HUD_Z
  170.      @hud.x = COMBO_POSITION[0]
  171.      @hud.y = COMBO_POSITION[1]
  172.      @hud.opacity = 250
  173.      @hud.visible = false
  174. end
  175.    
  176. #--------------------------------------------------------------------------
  177. # ● create_total_damage_sprite
  178. #--------------------------------------------------------------------------
  179. def create_total_damage_sprite   
  180.      @total_image = Cache.system("Combo_damage")
  181.      @total = Sprite.new
  182.      @total.bitmap = Bitmap.new(@combo_image.width,@combo_image.height)
  183.      @total_im_cw = @total_image.width / 10
  184.      @total_im_ch = @total_image.height     
  185.      @total.z = HUD_Z + 1
  186.      @total_orig_x = COMBO_POSITION[0] + TOTAL_POSITION[0]
  187.      @total_orig_y = COMBO_POSITION[1] + TOTAL_POSITION[1]
  188.      @total.x = @total_orig_x
  189.      @total.y = @total_orig_y
  190.      @total.zoom_x = 1.00
  191.      @total.zoom_y = 1.00
  192.      @total.opacity = 250  
  193.      @total.visible = false
  194. end     

  195. #--------------------------------------------------------------------------
  196. # ● create_combo_number  
  197. #--------------------------------------------------------------------------
  198. def create_combo_sprite
  199.      @combo_image = Cache.system("Combo_Number")
  200.      @combo = Sprite.new
  201.      @combo.bitmap = Bitmap.new(@combo_image.width,@combo_image.height)
  202.      @combo_im_cw = @combo_image.width / 10
  203.      @combo_im_ch = @combo_image.height     
  204.      @combo.z = HUD_Z + 2
  205.      @combo_orig_x = COMBO_POSITION[0] + HIT_POSITION[0]
  206.      @combo_orig_y = COMBO_POSITION[1] + HIT_POSITION[1]
  207.      @combo.zoom_x = 1.00
  208.      @combo.zoom_y = 1.00
  209.      @combo.opacity = 250
  210.      @combo.visible = false
  211. end  

  212. #--------------------------------------------------------------------------
  213. # ● Dispose
  214. #--------------------------------------------------------------------------
  215.    def dispose
  216.        return if @hud == nil
  217.        @hud.bitmap.dispose
  218.        @hud.dispose
  219.        @hud = nil
  220.        @combo_image.dispose
  221.        @combo.bitmap.dispose
  222.        @combo.dispose
  223.        @total_image.dispose      
  224.        @total.bitmap.dispose
  225.        @total.dispose
  226.    end

  227. #--------------------------------------------------------------------------
  228. # ● Refresh
  229. #--------------------------------------------------------------------------
  230.    def refresh
  231.      @combo_hit_old = $game_temp.combo_hit
  232.      @combo.bitmap.clear
  233.      @total.bitmap.clear
  234.      @combo_number_text = $game_temp.combo_hit.abs.to_s.split(//)
  235.      for r in [email]0..@combo_number_text.size[/email] - 1
  236.        @combo_number_abs = @combo_number_text[r].to_i
  237.        @combo_src_rect = Rect.new(@combo_im_cw * @combo_number_abs, 0, @combo_im_cw, @combo_im_ch)
  238.        @combo.bitmap.blt(@combo_im_cw *  r, 0, @combo_image, @combo_src_rect)        
  239.      end            
  240.      @total_number_text = $game_temp.max_damage.abs.to_s.split(//)
  241.      for r in [email]0..@total_number_text.size[/email] - 1
  242.        @total_number_abs = @total_number_text[r].to_i
  243.        @total_src_rect = Rect.new(@total_im_cw * @total_number_abs, 0, @total_im_cw, @total_im_ch)
  244.        @total.bitmap.blt(@total_im_cw *  r, 20, @total_image, @total_src_rect)        
  245.      end
  246.        #Combo Position
  247.        @pos_x_fix = (@combo_im_cw / 2 * @combo_number_text.size)
  248.        @combo.x = @combo_orig_x - @pos_x_fix
  249.        @combo.y = @combo_orig_y
  250.        @combo.zoom_x = 2
  251.        @combo.zoom_y = 2
  252.        @combo.opacity = 70
  253.        @combo.visible = true
  254.        #Total Position      
  255.        @total.x = @total_orig_x + 20
  256.        @total.y = @total_orig_y     
  257.        @total.opacity = 100
  258.        @total.visible = true            
  259.        #Hud Position
  260.        @hud.x = COMBO_POSITION[0]
  261.        @hud.y = COMBO_POSITION[1]
  262.        @hud.opacity = 255
  263.        @hud.visible = true
  264. end   

  265. #--------------------------------------------------------------------------
  266. # ● Slide Update
  267. #--------------------------------------------------------------------------
  268.   def slide_update
  269.     return if !@combo.visible
  270.     if $game_temp.combo_time > 0 and @combo_wait == false
  271.        $game_temp.combo_time -= 1 if TIME_COUNT == true
  272.     end
  273.     if $game_temp.combo_time > 0 and $game_temp.combo_hit > 0   
  274.          #Total Damage
  275.          if @total.x > @total_orig_x
  276.             @total.x -= 1
  277.             @total.opacity += 8
  278.          else   
  279.             @total.x = @total_orig_x
  280.             @total.opacity = 255
  281.          end  
  282.          #Combo
  283.          if @combo.zoom_x > 1.00
  284.             @combo.zoom_x -= 0.05
  285.             @combo.zoom_y -= 0.05      
  286.             @combo.opacity += 8
  287.          else
  288.             @combo.zoom_x = 1
  289.             @combo.zoom_y = 1
  290.             @combo.opacity = 255
  291.             @combo.x = @combo_orig_x - @pos_x_fix
  292.             @combo.y = @combo_orig_y
  293.          end           
  294.      elsif $game_temp.combo_time == 0 and @combo.visible
  295.            @combo.x -= 5
  296.            @combo.opacity -= 10
  297.            @total.x -= 3
  298.            @total.opacity -= 10
  299.            @hud.x += 5
  300.            @hud.opacity -= 10     
  301.            $game_temp.combo_hit = 0
  302.            @combo_hit_old = $game_temp.combo_hit
  303.            $game_temp.max_damage = 0
  304.            if @combo.opacity <= 0
  305.               @combo.visible = false
  306.               @total.visible = false
  307.               @hud.visible = false
  308.            end  
  309.      end   
  310.   end

  311. #--------------------------------------------------------------------------
  312. # ● Cancel
  313. #--------------------------------------------------------------------------   
  314.   def cancel
  315.       $game_temp.combo_hit = 0
  316.       $game_temp.max_damage = 0
  317.       $game_temp.combo_time = 0      
  318.       @combo_hit_old = $game_temp.combo_hit
  319.   end  

  320. #--------------------------------------------------------------------------
  321. # ● Clear
  322. #--------------------------------------------------------------------------     
  323.   def clear
  324.       $game_temp.combo_time = 0
  325.   end      

  326. #--------------------------------------------------------------------------
  327. # ● Update
  328. #--------------------------------------------------------------------------
  329.   def update
  330.       return if @hud == nil
  331.       refresh if $game_temp.combo_hit != @combo_hit_old
  332.       slide_update
  333.   end   
  334. end

  335. $mog_rgss3_combo_count = true
复制代码





















and























  1. #==============================================================================
  2. # +++ MOG - Enemy HP Meter  (v1.1) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]http://www.atelier-rgss.com/[/url]
  6. #==============================================================================
  7. # Apresenta um medidor animado com o HP do inimigo.
  8. #==============================================================================
  9. # Para ocultar o HP do inimigo use a TAG abaixo na caixa de notas.
  10. #
  11. # <Hide HP>
  12. #
  13. #==============================================================================
  14. # Serão necessários as imagens.
  15. #
  16. # Battle_Enemy_HP_Layout.png
  17. # Battle_Enemy_HP_Meter.png
  18. #
  19. #
  20. #==============================================================================

  21. #==============================================================================
  22. # ● Histórico (Version History)
  23. #==============================================================================
  24. # v 1.1 - Corrigido o erro de crash randômico. (relativo a dispose de imagem.)
  25. #==============================================================================

  26. module MOG_ENEMY_HP
  27.    #Posição geral do medidor em relação ao battler.
  28.    POSITION_CORRECTION = [0,0]
  29.    #Posição do medidor de HP.
  30.    HP_METER_POSITION = [2,4]
  31.    #Prioridade do medidor na tela.
  32.    PRIORITY_Z = 101   
  33. end

  34. #==============================================================================
  35. # ■ Game Enemy
  36. #==============================================================================
  37. class Game_Enemy < Game_Battler

  38.   attr_accessor :hp_meter_active               
  39.   
  40.   #--------------------------------------------------------------------------
  41.   # ● Initialize
  42.   #--------------------------------------------------------------------------
  43.   alias mog_enemy_hp_initialize initialize
  44.   def initialize(index, enemy_id)
  45.       mog_enemy_hp_initialize(index, enemy_id)
  46.       hide = enemy.note =~ /<Hide HP>/i ? true : false
  47.       @hp_meter_active = [false,hide]
  48.   end  

  49. end

  50. #==============================================================================
  51. # ■ Game_Battler
  52. #==============================================================================
  53. class Game_Battler < Game_BattlerBase
  54.   
  55.   #--------------------------------------------------------------------------
  56.   # ● Item Apply
  57.   #--------------------------------------------------------------------------  
  58.    alias mog_enemy_hp_item_apply item_apply
  59.    def item_apply(user, item)
  60.        mog_enemy_hp_item_apply(user, item)
  61.        if self.is_a?(Game_Enemy)
  62.           self.hp_meter_active[0] = true if @result.hp_damage != 0
  63.        end
  64.    end

  65.   #--------------------------------------------------------------------------
  66.   # ● Regenerate HP
  67.   #--------------------------------------------------------------------------
  68.   alias mog_enemy_hp_regenerate_hp regenerate_hp
  69.   def regenerate_hp
  70.       mog_enemy_hp_regenerate_hp
  71.       if self.is_a?(Game_Enemy)
  72.          self.hp_meter_active[0] = true if @result.hp_damage != 0      
  73.       end         
  74.   end
  75.    
  76. end
  77.   

  78. #==============================================================================
  79. # ■ Battle_Hud
  80. #==============================================================================
  81. class Enemy_HP
  82.   include MOG_ENEMY_HP
  83.   
  84.   #--------------------------------------------------------------------------
  85.   # ● Initialize
  86.   #--------------------------------------------------------------------------   
  87.   def initialize(viewport = nil,enemy)
  88.       dispose
  89.       @enemy = enemy
  90.       @fade_time = -1
  91.       create_layout   
  92.       create_hp_meter      
  93.       b_pos = [enemy.screen_x - (@layout.width / 2) + POSITION_CORRECTION[0], enemy.screen_y + POSITION_CORRECTION[1] - (@layout.height / 2)]
  94.       @layout.opacity = 0
  95.       @org_pos1 = [b_pos[0],b_pos[1]]
  96.       @layout.x = @org_pos1[0]
  97.       @layout.y = @org_pos1[1]
  98.       @layout.visible = false
  99.       @hp_meter.opacity = 0
  100.       @hp_meter.visible = false
  101.       @org_pos2 = [b_pos[0] + HP_METER_POSITION[0], b_pos[1] + HP_METER_POSITION[1]]
  102.       @hp_meter.x = @org_pos2[0]
  103.       @hp_meter.y = @org_pos2[1]
  104.       @hp_meter.viewport = viewport
  105.       @hp_meter.z = PRIORITY_Z
  106.       @layout.viewport = viewport
  107.       @layout.z = PRIORITY_Z
  108.       @enemy.hp_meter_active[0] = false
  109.       @hide = @enemy.hp_meter_active[1]
  110.   end
  111.   
  112.   #--------------------------------------------------------------------------
  113.   # ● Create HP Meter
  114.   #--------------------------------------------------------------------------        
  115.   def create_layout
  116.       @layout = Sprite.new
  117.       @layout.bitmap = Cache.system("Battle_Enemy_HP_Layout")
  118.   end
  119.    
  120.   #--------------------------------------------------------------------------
  121.   # ● Create HP Meter
  122.   #--------------------------------------------------------------------------      
  123.   def create_hp_meter
  124.       @meter_image = Cache.system("Battle_Enemy_HP_Meter")
  125.       @meter_cw = @meter_image.width
  126.       @meter_ch = @meter_image.height / 2      
  127.       @hp_meter = Sprite.new
  128.       @hp_meter.bitmap = Bitmap.new(@meter_cw,@meter_ch)
  129.       @hp_width_old = @meter_cw * @enemy.hp / @enemy.mhp
  130.     end  
  131.   
  132.   #--------------------------------------------------------------------------
  133.   # ● Hp Flow Update
  134.   #--------------------------------------------------------------------------
  135.   def update_hp_flow
  136.       return if !@layout.visible     
  137.       hp_width = @meter_cw * @enemy.hp / @enemy.mhp
  138.       @hp_meter.bitmap.clear      
  139.       execute_damage_flow(hp_width)
  140.       hp_src_rect = Rect.new(0, 0,hp_width, @meter_ch)
  141.       @hp_meter.bitmap.blt(0,0, @meter_image, hp_src_rect)
  142.   end
  143.    
  144.   #--------------------------------------------------------------------------
  145.   # ● Execute Damage Flow
  146.   #--------------------------------------------------------------------------
  147.   def execute_damage_flow(hp_width)
  148.       n = (@hp_width_old - hp_width).abs * 3 / 100
  149.       damage_flow = [[n, 2].min,0.5].max
  150.       @hp_width_old -= damage_flow
  151.       if @hp_width_old <= hp_width
  152.          @hp_width_old = hp_width
  153.       end   
  154.       src_rect_old = Rect.new(0,@meter_ch,@hp_width_old, @meter_ch)
  155.       @hp_meter.bitmap.blt(0,0, @meter_image, src_rect_old)      
  156.   end   
  157.   
  158.   #--------------------------------------------------------------------------
  159.   # ● Dispose
  160.   #--------------------------------------------------------------------------      
  161.   def dispose
  162.       return if @meter_image == nil
  163.       @layout.bitmap.dispose
  164.       @layout.dispose
  165.       @hp_meter.bitmap.dispose
  166.       @hp_meter.dispose
  167.       @meter_image.dispose
  168.       @meter_image = nil
  169.   end
  170.   
  171.   #--------------------------------------------------------------------------
  172.   # ● Update
  173.   #--------------------------------------------------------------------------      
  174.   def update
  175.       return if @meter_image == nil
  176.       return if @hide
  177.       update_fade   
  178.       update_visible
  179.       update_hp_flow
  180.       refresh if @enemy.hp_meter_active[0]
  181.   end  
  182.   
  183.   #--------------------------------------------------------------------------
  184.   # ● Update Fade
  185.   #--------------------------------------------------------------------------        
  186.   def update_fade
  187.       @fade_time -= 1 if @fade_time > 0
  188.       return if @fade_time != 0
  189.       @layout.opacity -= 10
  190.       @hp_meter.opacity -= 10
  191.       @layout.x += 1
  192.       @hp_meter.x += 1
  193.       @fade_time = -1 if @layout.opacity == 0
  194.   end  
  195.   
  196.   #--------------------------------------------------------------------------
  197.   # ● Update Visible
  198.   #--------------------------------------------------------------------------        
  199.   def update_visible
  200.       return if !@layout.visible
  201.       vis = can_visible?
  202.       @layout.visible = vis
  203.       @hp_meter.visible = vis
  204.   end
  205.   
  206.   #--------------------------------------------------------------------------
  207.   # ● Refresh
  208.   #--------------------------------------------------------------------------         
  209.   def refresh     
  210.       @enemy.hp_meter_active[0] = false
  211.       @layout.opacity = 255
  212.       @hp_meter.opacity = 255   
  213.       @layout.visible = true
  214.       @hp_meter.visible = true
  215.       @fade_time = 60
  216.       @layout.x = @org_pos1[0]
  217.       @layout.y = @org_pos1[1]
  218.       @hp_meter.x = @org_pos2[0]
  219.       @hp_meter.y = @org_pos2[1]      
  220.       hp_width = @meter_cw * @enemy.hp / @enemy.mhp
  221.       @hp_width_old = hp_width if @hp_width_old < hp_width
  222.       update_hp_flow
  223.   end
  224.   
  225.   #--------------------------------------------------------------------------
  226.   # ● Can Visible?
  227.   #--------------------------------------------------------------------------         
  228.   def can_visible?
  229.       return false if @layout.opacity == 0      
  230.       return true
  231.   end
  232.    
  233. end

  234. #==============================================================================
  235. # ■ Spriteset Battle
  236. #==============================================================================
  237. class Spriteset_Battle
  238.   
  239.   #--------------------------------------------------------------------------
  240.   # ● Initialize
  241.   #--------------------------------------------------------------------------  
  242.   alias mog_enemy_hp_initialize initialize
  243.   def initialize
  244.       mog_enemy_hp_initialize
  245.       create_enemy_hp      
  246.   end
  247.   
  248.   #--------------------------------------------------------------------------
  249.   # ● Create Battle Hud
  250.   #--------------------------------------------------------------------------   
  251.   def create_enemy_hp
  252.       dispose_enemy_hp
  253.       @enemy_hp = []      
  254.       for i in $game_troop.members
  255.           @enemy_hp.push(Enemy_HP.new(@viewport1,i))
  256.       end
  257.   end
  258.   
  259.   #--------------------------------------------------------------------------
  260.   # ● Dispose
  261.   #--------------------------------------------------------------------------      
  262.   alias mog_enemy_hp_dispose dispose
  263.   def dispose
  264.       mog_enemy_hp_dispose
  265.       dispose_enemy_hp
  266.   end  
  267.   
  268.   #--------------------------------------------------------------------------
  269.   # ● Dispose Enemy HP
  270.   #--------------------------------------------------------------------------        
  271.   def dispose_enemy_hp
  272.       return if @enemy_hp == nil
  273.       @enemy_hp.each {|sprite| sprite.dispose }
  274.       @enemy_hp.clear
  275.       @enemy_hp = nil
  276.   end
  277.   
  278.   #--------------------------------------------------------------------------
  279.   # ● Update
  280.   #--------------------------------------------------------------------------        
  281.   alias mog_enemy_hp_update update
  282.   def update
  283.       mog_enemy_hp_update
  284.       update_enemy_hp
  285.   end
  286.   
  287.   #--------------------------------------------------------------------------
  288.   # ● Update Enemy HP
  289.   #--------------------------------------------------------------------------         
  290.   def update_enemy_hp
  291.       return if @enemy_hp == nil
  292.       @enemy_hp.each {|sprite| sprite.update }
  293.   end  
  294. end

  295. $mog_rgss3_enemy_hp_meter = true
复制代码





按F11
左侧栏右键插入两个,分别复制粘贴












VA超级正合脚本里的,第一个是连击统计,第二个是动态血槽,配合在一起挺好用的!���
支持《彼岸之光》系列!加油!
回复

使用道具 举报

梦石
0
星屑
50
在线时间
46 小时
注册时间
2012-4-28
回帖
7
 楼主| 发表于 2012-10-26 14:34:33 | 显示全部楼层
不好使。。。。。。
回复

使用道具 举报

梦石
0
星屑
50
在线时间
52 小时
注册时间
2014-1-4
回帖
101
发表于 2014-2-7 15:15:27 | 显示全部楼层
您看看这个脚本适合不适合您。
地址:http://rpg.blue/thread-344203-1-1.html
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部