设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 4996|回复: 6
打印 上一主题 下一主题

[已经解决] va谁有怪物血量显示的脚本啊

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
123 小时
注册时间
2012-2-12
帖子
73
跳转到指定楼层
1
发表于 2012-3-9 10:26:46 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
求分享脚本

Lv1.梦旅人

梦石
0
星屑
59
在线时间
831 小时
注册时间
2010-8-23
帖子
487
2
发表于 2012-3-9 10:35:22 | 只看该作者
LZ悲剧了。。这样发帖会被扣经验的。。。
正统RPG进度更新~
剧情:■■■■■■■■■
系统:■■■■■■■■□□
设定:■■■■■■■■□□
左右时尚鞋坊 美丽从脚开始
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
149 小时
注册时间
2010-7-12
帖子
47
3
发表于 2012-3-9 10:58:17 | 只看该作者
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Battle Engine Add-On: Enemy HP Bars v1.10
  4. # -- Last Updated: 2012.02.10
  5. # -- Level: Easy, Normal
  6. # -- Requires: YEA - Ace Battle Engine v1.00+.
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-EnemyHPBars"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.02.10 - Bug Fixed: AoE selection doesn't reveal hidden enemies.
  15. # 2012.02.01 - Bug Fixed: Back and front of gauge randomly don't appear.
  16. # 2012.01.11 - Efficiency update.
  17. # 2012.01.04 - Compatibility Update: Area of Effect
  18. # 2011.12.28 - Efficiency update.
  19. #            - Bug Fixed: HP bars didn't disappear after a heal.
  20. # 2011.12.26 - Bug Fixed: HP bars were not depleting.
  21. # 2011.12.23 - Efficiency update.
  22. # 2011.12.10 - Bug Fixed: HP bars no longer appear when dead and an AoE skill
  23. #              has been selected.
  24. # 2011.12.08 - New feature. Hide HP Bars until defeated once.
  25. # 2011.12.06 - Started Script and Finished.
  26. #
  27. #==============================================================================
  28. # ▼ Introduction
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # This script shows HP gauges on enemies as they're selected for targeting or
  31. # whenever they're damaged. The HP gauges will actually slide downward or
  32. # upward as the enemies take damage.
  33. #
  34. # Included in v1.01 is the option to require the player having slain an enemy
  35. # once before enemies of that type will show their HP gauge.
  36. #
  37. #==============================================================================
  38. # ▼ Instructions
  39. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  40. # To install this script, open up your script editor and copy/paste this script
  41. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  42. #
  43. # -----------------------------------------------------------------------------
  44. # Enemy Notetags - These notetags go in the enemy notebox in the database.
  45. # -----------------------------------------------------------------------------
  46. # <back gauge: x>
  47. # Changes the colour of the enemy HP back gauge to x where x is the text colour
  48. # used from the "Window" skin image under Graphics\System.
  49. #
  50. # <hp gauge 1: x>
  51. # <hp gauge 2: x>
  52. # Changes the colour of the enemy HP HP gauge to x where x is the text colour
  53. # used from the "Window" skin image under Graphics\System.
  54. #
  55. # <hide gauge>
  56. # <show gauge>
  57. # Hides/shows HP gauge for enemies in battle. These gauges appear whenever the
  58. # enemy is targeted for battle or whenever the enemy takes HP damage. Note that
  59. # using the <show gauge> tag will bypass the requirement for needing to defeat
  60. # an enemy once if that setting is enabled.
  61. #
  62. #==============================================================================
  63. # ▼ Compatibility
  64. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  65. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  66. # it will run with RPG Maker VX without adjusting.
  67. #
  68. # This script requires Yanfly Engine Ace - Ace Battle Engine v1.00+ and the
  69. # script must be placed under Ace Battle Engine in the script listing.
  70. #
  71. #==============================================================================

  72. module YEA
  73.   module BATTLE
  74.    
  75.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  76.     # - Enemy HP Gauges -
  77.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  78.     # Adjust the settings for the enemy HP gauges. You can choose to show the
  79.     # enemy HP gauges by default, the size of the gauge, the colour of the
  80.     # gauge, and the back colour of the gauge.
  81.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  82.     SHOW_ENEMY_HP_GAUGE    = true   # Display Enemy HP Gauge?
  83.     ANIMATE_HP_GAUGE       = true   # Animate the HP gauge?
  84.     DEFEAT_ENEMIES_FIRST   = false  # Must defeat enemy first to show HP?
  85.     ENEMY_GAUGE_WIDTH      = 128    # How wide the enemy gauges are.
  86.     ENEMY_GAUGE_HEIGHT     = 12     # How tall the enemy gauges are.
  87.     ENEMY_HP_GAUGE_COLOUR1 = 20     # Colour 1 for HP.
  88.     ENEMY_HP_GAUGE_COLOUR2 = 21     # Colour 2 for HP.
  89.     ENEMY_BACKGAUGE_COLOUR = 19     # Gauge Back colour.
  90.    
  91.   end # BATTLE
  92. end # YEA

  93. #==============================================================================
  94. # ▼ Editting anything past this point may potentially result in causing
  95. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  96. # halitosis so edit at your own risk.
  97. #==============================================================================

  98. if $imported["YEA-BattleEngine"]

  99. module YEA
  100.   module REGEXP
  101.   module ENEMY
  102.    
  103.     HIDE_GAUGE = /<(?:HIDE_GAUGE|hide gauge)>/i
  104.     SHOW_GAUGE = /<(?:SHOW_GAUGE|show gauge)>/i
  105.    
  106.     BACK_GAUGE = /<(?:BACK_GAUGE|back gauge):[ ]*(\d+)>/i
  107.     HP_GAUGE_1 = /<(?:HP_GAUGE_1|hp gauge 1):[ ]*(\d+)>/i
  108.     HP_GAUGE_2 = /<(?:HP_GAUGE_2|hp gauge 2):[ ]*(\d+)>/i
  109.    
  110.   end # ENEMY
  111.   end # REGEXP
  112. end # YEA

  113. #==============================================================================
  114. # ■ DataManager
  115. #==============================================================================

  116. module DataManager
  117.   
  118.   #--------------------------------------------------------------------------
  119.   # alias method: load_database
  120.   #--------------------------------------------------------------------------
  121.   class <<self; alias load_database_ehpb load_database; end
  122.   def self.load_database
  123.     load_database_ehpb
  124.     load_notetags_ehpb
  125.   end
  126.   
  127.   #--------------------------------------------------------------------------
  128.   # new method: load_notetags_ehpb
  129.   #--------------------------------------------------------------------------
  130.   def self.load_notetags_ehpb
  131.     groups = [$data_enemies]
  132.     for group in groups
  133.       for obj in group
  134.         next if obj.nil?
  135.         obj.load_notetags_ehpb
  136.       end
  137.     end
  138.   end
  139.   
  140. end # DataManager

  141. #==============================================================================
  142. # ■ RPG::Enemy
  143. #==============================================================================

  144. class RPG::Enemy < RPG::BaseItem
  145.   
  146.   #--------------------------------------------------------------------------
  147.   # public instance variables
  148.   #--------------------------------------------------------------------------
  149.   attr_accessor :show_gauge
  150.   attr_accessor :require_death_show_gauge
  151.   attr_accessor :back_gauge_colour
  152.   attr_accessor :hp_gauge_colour1
  153.   attr_accessor :hp_gauge_colour2
  154.   
  155.   #--------------------------------------------------------------------------
  156.   # common cache: load_notetags_ehpb
  157.   #--------------------------------------------------------------------------
  158.   def load_notetags_ehpb
  159.     @show_gauge = YEA::BATTLE::SHOW_ENEMY_HP_GAUGE
  160.     @require_death_show_gauge = YEA::BATTLE::DEFEAT_ENEMIES_FIRST
  161.     @back_gauge_colour = YEA::BATTLE::ENEMY_BACKGAUGE_COLOUR
  162.     @hp_gauge_colour1 = YEA::BATTLE::ENEMY_HP_GAUGE_COLOUR1
  163.     @hp_gauge_colour2 = YEA::BATTLE::ENEMY_HP_GAUGE_COLOUR2
  164.     #---
  165.     self.note.split(/[\r\n]+/).each { |line|
  166.       case line
  167.       #---
  168.       when YEA::REGEXP::ENEMY::HIDE_GAUGE
  169.         @show_gauge = false
  170.       when YEA::REGEXP::ENEMY::SHOW_GAUGE
  171.         @show_gauge = true
  172.         @require_death_show_gauge = false
  173.       when YEA::REGEXP::ENEMY::BACK_GAUGE
  174.         @back_gauge_colour = [$1.to_i, 31].min
  175.       when YEA::REGEXP::ENEMY::HP_GAUGE_1
  176.         @hp_gauge_colour1 = [$1.to_i, 31].min
  177.       when YEA::REGEXP::ENEMY::HP_GAUGE_2
  178.         @hp_gauge_colour2 = [$1.to_i, 31].min
  179.       end
  180.     } # self.note.split
  181.     #---
  182.   end
  183.   
  184. end # RPG::Enemy

  185. #==============================================================================
  186. # ■ Sprite_Battler
  187. #==============================================================================

  188. class Sprite_Battler < Sprite_Base
  189.   
  190.   #--------------------------------------------------------------------------
  191.   # alias method: initialize
  192.   #--------------------------------------------------------------------------
  193.   alias sprite_battler_initialize_ehpb initialize
  194.   def initialize(viewport, battler = nil)
  195.     sprite_battler_initialize_ehpb(viewport, battler)
  196.     create_enemy_gauges
  197.   end
  198.   
  199.   #--------------------------------------------------------------------------
  200.   # alias method: dispose
  201.   #--------------------------------------------------------------------------
  202.   alias sprite_battler_dispose_ehpb dispose
  203.   def dispose
  204.     sprite_battler_dispose_ehpb
  205.     dispose_enemy_gauges
  206.   end
  207.   
  208.   #--------------------------------------------------------------------------
  209.   # alias method: update
  210.   #--------------------------------------------------------------------------
  211.   alias sprite_battler_update_ehpb update
  212.   def update
  213.     sprite_battler_update_ehpb
  214.     update_enemy_gauges
  215.   end
  216.   
  217.   #--------------------------------------------------------------------------
  218.   # new method: create_enemy_gauges
  219.   #--------------------------------------------------------------------------
  220.   def create_enemy_gauges
  221.     return if @battler.nil?
  222.     return if @battler.actor?
  223.     return unless @battler.enemy.show_gauge
  224.     @back_gauge_viewport = Enemy_HP_Gauge_Viewport.new(@battler, self, :back)
  225.     @hp_gauge_viewport = Enemy_HP_Gauge_Viewport.new(@battler, self, :hp)
  226.   end
  227.   
  228.   #--------------------------------------------------------------------------
  229.   # new method: dispose_enemy_gauges
  230.   #--------------------------------------------------------------------------
  231.   def dispose_enemy_gauges
  232.     @back_gauge_viewport.dispose unless @back_gauge_viewport.nil?
  233.     @hp_gauge_viewport.dispose unless @hp_gauge_viewport.nil?
  234.   end
  235.   
  236.   #--------------------------------------------------------------------------
  237.   # new method: update_enemy_gauges
  238.   #--------------------------------------------------------------------------
  239.   def update_enemy_gauges
  240.     @back_gauge_viewport.update unless @back_gauge_viewport.nil?
  241.     @hp_gauge_viewport.update unless @hp_gauge_viewport.nil?
  242.   end
  243.   
  244.   #--------------------------------------------------------------------------
  245.   # new method: update_enemy_gauge_value
  246.   #--------------------------------------------------------------------------
  247.   def update_enemy_gauge_value
  248.     @back_gauge_viewport.new_hp_updates unless @back_gauge_viewport.nil?
  249.     @hp_gauge_viewport.new_hp_updates unless @hp_gauge_viewport.nil?
  250.   end
  251.   
  252. end # Sprite_Battler

  253. #==============================================================================
  254. # ■ Game_BattlerBase
  255. #==============================================================================

  256. class Game_BattlerBase
  257.   
  258.   #--------------------------------------------------------------------------
  259.   # public instance variables
  260.   #--------------------------------------------------------------------------
  261.   attr_accessor :hidden
  262.   
  263.   #--------------------------------------------------------------------------
  264.   # alias method: refresh
  265.   #--------------------------------------------------------------------------
  266.   alias game_battlerbase_refresh_ehpb refresh
  267.   def refresh
  268.     game_battlerbase_refresh_ehpb
  269.     return unless SceneManager.scene_is?(Scene_Battle)
  270.     return if actor?
  271.     sprite.update_enemy_gauge_value
  272.   end
  273.   
  274. end # Game_BattlerBase

  275. #==============================================================================
  276. # ■ Game_Battler
  277. #==============================================================================

  278. class Game_Battler < Game_BattlerBase
  279.   
  280.   #--------------------------------------------------------------------------
  281.   # alias method: die
  282.   #--------------------------------------------------------------------------
  283.   alias game_battler_die_ehpb die
  284.   def die
  285.     game_battler_die_ehpb
  286.     return if actor?
  287.     $game_party.add_defeated_enemy(@enemy_id)
  288.   end
  289.   
  290.   #--------------------------------------------------------------------------
  291.   # alias method: hp=
  292.   #--------------------------------------------------------------------------
  293.   alias game_battlerbase_hpequals_ehpb hp=
  294.   def hp=(value)
  295.     game_battlerbase_hpequals_ehpb(value)
  296.     return unless SceneManager.scene_is?(Scene_Battle)
  297.     return if actor?
  298.     return if value == 0
  299.     sprite.update_enemy_gauge_value
  300.   end
  301.   
  302. end # Game_Battler

  303. #==============================================================================
  304. # ■ Game_Party
  305. #==============================================================================

  306. class Game_Party < Game_Unit
  307.   
  308.   #--------------------------------------------------------------------------
  309.   # alias method: init_all_items
  310.   #--------------------------------------------------------------------------
  311.   alias game_party_init_all_items_ehpb init_all_items
  312.   def init_all_items
  313.     game_party_init_all_items_ehpb
  314.     @defeated_enemies = []
  315.   end
  316.   
  317.   #--------------------------------------------------------------------------
  318.   # new method: defeated_enemies
  319.   #--------------------------------------------------------------------------
  320.   def defeated_enemies
  321.     @defeated_enemies = [] if @defeated_enemies.nil?
  322.     return @defeated_enemies
  323.   end
  324.   
  325.   #--------------------------------------------------------------------------
  326.   # new method: add_defeated_enemy
  327.   #--------------------------------------------------------------------------
  328.   def add_defeated_enemy(id)
  329.     @defeated_enemies = [] if @defeated_enemies.nil?
  330.     @defeated_enemies.push(id) unless @defeated_enemies.include?(id)
  331.   end
  332.   
  333. end # Game_Party

  334. #==============================================================================
  335. # ■ Enemy_HP_Gauge_Viewport
  336. #==============================================================================

  337. class Enemy_HP_Gauge_Viewport < Viewport
  338.   
  339.   #--------------------------------------------------------------------------
  340.   # initialize
  341.   #--------------------------------------------------------------------------
  342.   def initialize(battler, sprite, type)
  343.     @battler = battler
  344.     @base_sprite = sprite
  345.     @type = type
  346.     dw = YEA::BATTLE::ENEMY_GAUGE_WIDTH
  347.     dw += 2 if @type == :back
  348.     @start_width = dw
  349.     dh = YEA::BATTLE::ENEMY_GAUGE_HEIGHT
  350.     dh += 2 if @type == :back
  351.     rect = Rect.new(0, 0, dw, dh)
  352.     @current_hp = @battler.hp
  353.     @current_mhp = @battler.mhp
  354.     @target_gauge_width = target_gauge_width
  355.     @gauge_rate = 1.0
  356.     setup_original_hide_gauge
  357.     super(rect)
  358.     self.z = 125
  359.     create_gauge_sprites
  360.     self.visible = false
  361.     update_position
  362.   end
  363.   
  364.   #--------------------------------------------------------------------------
  365.   # dispose
  366.   #--------------------------------------------------------------------------
  367.   def dispose
  368.     @sprite.bitmap.dispose unless @sprite.bitmap.nil?
  369.     @sprite.dispose
  370.     super
  371.   end
  372.   
  373.   #--------------------------------------------------------------------------
  374.   # update
  375.   #--------------------------------------------------------------------------
  376.   def update
  377.     super
  378.     self.visible = gauge_visible?
  379.     @sprite.ox += 4 if YEA::BATTLE::ANIMATE_HP_GAUGE
  380.     update_position
  381.     update_gauge
  382.     @visible_counter -= 1
  383.   end
  384.   
  385.   #--------------------------------------------------------------------------
  386.   # setup_original_hide_gauge
  387.   #--------------------------------------------------------------------------
  388.   def setup_original_hide_gauge
  389.     @original_hide = @battler.enemy.require_death_show_gauge
  390.     return unless @original_hide
  391.     if YEA::BATTLE::DEFEAT_ENEMIES_FIRST
  392.       enemy_id = @battler.enemy_id
  393.       @original_hide = !$game_party.defeated_enemies.include?(enemy_id)
  394.     end
  395.   end
  396.   
  397.   #--------------------------------------------------------------------------
  398.   # create_gauge_sprites
  399.   #--------------------------------------------------------------------------
  400.   def create_gauge_sprites
  401.     @sprite = Plane.new(self)
  402.     dw = self.rect.width * 2
  403.     @sprite.bitmap = Bitmap.new(dw, self.rect.height)
  404.     case @type
  405.     when :back
  406.       colour1 = Colour.text_colour(@battler.enemy.back_gauge_colour)
  407.       colour2 = Colour.text_colour(@battler.enemy.back_gauge_colour)
  408.     when :hp
  409.       colour1 = Colour.text_colour(@battler.enemy.hp_gauge_colour1)
  410.       colour2 = Colour.text_colour(@battler.enemy.hp_gauge_colour2)
  411.     end
  412.     dx = 0
  413.     dy = 0
  414.     dw = self.rect.width
  415.     dh = self.rect.height
  416.     @gauge_width = target_gauge_width
  417.     @sprite.bitmap.gradient_fill_rect(dx, dy, dw, dh, colour1, colour2)
  418.     @sprite.bitmap.gradient_fill_rect(dw, dy, dw, dh, colour2, colour1)
  419.     @visible_counter = 0
  420.   end
  421.   
  422.   #--------------------------------------------------------------------------
  423.   # update_visible
  424.   #--------------------------------------------------------------------------
  425.   def gauge_visible?
  426.     update_original_hide
  427.     return false if @original_hide
  428.     return false if case_original_hide?
  429.     return true if @visible_counter > 0
  430.     return true if @gauge_width != @target_gauge_width
  431.     if SceneManager.scene_is?(Scene_Battle)
  432.       return false if SceneManager.scene.enemy_window.nil?
  433.       unless @battler.dead?
  434.         if SceneManager.scene.enemy_window.active
  435.           return true if SceneManager.scene.enemy_window.enemy == @battler
  436.           return true if SceneManager.scene.enemy_window.select_all?
  437.           return true if highlight_aoe?
  438.         end
  439.       end
  440.     end
  441.     return false
  442.   end
  443.   
  444.   #--------------------------------------------------------------------------
  445.   # highlight_aoe?
  446.   #--------------------------------------------------------------------------
  447.   def highlight_aoe?
  448.     return false unless $imported["YEA-AreaofEffect"]
  449.     return false if @battler.enemy? && @battler.hidden
  450.     return SceneManager.scene.enemy_window.hightlight_aoe?(@battler)
  451.   end
  452.   
  453.   #--------------------------------------------------------------------------
  454.   # new_hp_updates
  455.   #--------------------------------------------------------------------------
  456.   def new_hp_updates
  457.     return if @current_hp == @battler.hp && @current_mhp == @battler.mhp
  458.     @current_hp = @battler.hp
  459.     @current_mhp = @battler.mhp
  460.     return if @gauge_rate == target_gauge_rate
  461.     @gauge_rate = target_gauge_rate
  462.     @target_gauge_width = target_gauge_width
  463.     @visible_counter = 60
  464.   end
  465.   
  466.   #--------------------------------------------------------------------------
  467.   # case_original_hide?
  468.   #--------------------------------------------------------------------------
  469.   def case_original_hide?
  470.     return false if [email protected]_death_show_gauge
  471.     if YEA::BATTLE::DEFEAT_ENEMIES_FIRST
  472.       enemy_id = @battler.enemy_id
  473.       return true unless $game_party.defeated_enemies.include?(enemy_id)
  474.     end
  475.     return false
  476.   end
  477.   
  478.   #--------------------------------------------------------------------------
  479.   # update_original_hide
  480.   #--------------------------------------------------------------------------
  481.   def update_original_hide
  482.     return unless @original_hide
  483.     return if @battler.dead?
  484.     enemy_id = @battler.enemy_id
  485.     @original_hide = false if $game_party.defeated_enemies.include?(enemy_id)
  486.   end
  487.   
  488.   #--------------------------------------------------------------------------
  489.   # update_position
  490.   #--------------------------------------------------------------------------
  491.   def update_position
  492.     dx = @battler.screen_x - @start_width / 2
  493.     dy = @battler.screen_y
  494.     self.rect.x = dx
  495.     self.rect.y = dy
  496.     dh = self.rect.height + 1
  497.     dh += 2 unless @type == :back
  498.     dy = [@battler.screen_y, Graphics.height - dh - 120].min
  499.     dy += 1 unless @type == :back
  500.     self.rect.y = dy
  501.   end
  502.   
  503.   #--------------------------------------------------------------------------
  504.   # update_gauge
  505.   #--------------------------------------------------------------------------
  506.   def update_gauge
  507.     return if @gauge_width == @target_gauge_width
  508.     rate = 3
  509.     @target_gauge_width = target_gauge_width
  510.     if @gauge_width > @target_gauge_width
  511.       @gauge_width = [@gauge_width - rate, @target_gauge_width].max
  512.     elsif @gauge_width < @target_gauge_width
  513.       @gauge_width = [@gauge_width + rate, @target_gauge_width].min
  514.     end
  515.     @visible_counter = @gauge_width == 0 ? 10 : 60
  516.     return if @type == :back
  517.     self.rect.width = @gauge_width
  518.   end
  519.   
  520.   #--------------------------------------------------------------------------
  521.   # target_gauge_rate
  522.   #--------------------------------------------------------------------------
  523.   def target_gauge_rate
  524.     return @current_hp.to_f / @current_mhp.to_f
  525.   end
  526.   
  527.   #--------------------------------------------------------------------------
  528.   # target_gauge_width
  529.   #--------------------------------------------------------------------------
  530.   def target_gauge_width
  531.     return [@current_hp * @start_width / @current_mhp, @start_width].min
  532.   end
  533.   
  534. end # Enemy_HP_Gauge_Viewport

  535. end # $imported["YEA-BattleEngine"]

  536. #==============================================================================
  537. #
  538. # ▼ End of File
  539. #
  540. #==============================================================================
复制代码
是不是这个?

点评

好吧...我以为是通用的  发表于 2012-3-9 11:48
这个需要YEA的战斗脚本作为前置的  发表于 2012-3-9 11:43
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
69 小时
注册时间
2012-3-3
帖子
79
4
发表于 2012-3-10 15:56:26 | 只看该作者
  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
复制代码

战斗中显示敌人血条.png (304.9 KB, 下载次数: 67)

战斗中显示敌人血条.png

点评

无效啊啊啊!肿么回事。。。  发表于 2012-3-11 17:47
LZ真是老好人。。。  发表于 2012-3-11 17:41

评分

参与人数 1星屑 +400 梦石 +2 收起 理由
迷糊的安安 + 400 + 2 认可答案

查看全部评分

内事不决问@度娘,外事不决问@谷哥。
有此二人辅佐,何愁天下不定乎!
回复 支持 1 反对 0

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
123 小时
注册时间
2012-2-12
帖子
73
5
 楼主| 发表于 2012-3-10 21:28:55 | 只看该作者
解决了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
69 小时
注册时间
2012-3-3
帖子
79
6
发表于 2012-3-12 10:07:22 | 只看该作者
注意:那个截图里的标题是“project1”,是新建工程
如果脚本无效,应该是跟你自己以前的脚本有冲突
内事不决问@度娘,外事不决问@谷哥。
有此二人辅佐,何愁天下不定乎!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
18 小时
注册时间
2013-7-15
帖子
26
7
发表于 2013-8-21 14:45:44 | 只看该作者
殇殃 发表于 2012-3-10 15:56

还没有到中途出来的怪物就显示了血槽 这不是错误了么?求教求补。
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-16 19:49

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表