| 赞 | 0  | 
 
| VIP | 0 | 
 
| 好人卡 | 0 | 
 
| 积分 | 0 | 
 
| 经验 | 0 | 
 
| 最后登录 | 2015-2-18 | 
 
| 在线时间 | 9 小时 | 
 
 
 
 
 
Lv1.梦旅人 
	- 梦石
 - 0 
 
        - 星屑
 - 415 
 
        - 在线时间
 - 9 小时
 
        - 注册时间
 - 2012-8-4
 
        - 帖子
 - 1
 
 
 
 | 
	
血量的脚本吧……- #==============================================================================
 
 - # ■ 显示敌人血条 by 沉影不器
 
 - #------------------------------------------------------------------------------
 
 - # 功能描述:
 
 - #     ① 战斗时让敌人显示血条,宽度可定制
 
 - #     ② 可选功能: 显示具体生命值 显示敌人名称
 
 - # 使用说明:
 
 - #     ① 脚本插入到Main之前
 
 - #     ② 脚本第19行设定血条的默认宽度
 
 - #        为个别敌人指定血条宽度是"数据库-敌角色-备注栏"填写"hp_width=数值"
 
 - #     ③ 脚本第20行选择是否显示具体生命值
 
 - #     ④ 脚本第21行选择是否显示敌人名称
 
 - #     ⑤ 其它参数设定详见脚本
 
 - #     ⑥ 此脚本需要基础脚本[读取rmvx备注栏指定字段]
 
 - #==============================================================================
 
 - # ■ 参数设定
 
 - #==============================================================================
 
 - module Enemy_HP
 
 -   HP_WIDTH    = 64                    # 血条的默认宽度
 
 -   SHOW_VALUE = false                  # 是否显示敌人生命值
 
 -   SHOW_NAME = true                    # 是否显示敌人名称
 
 -   NAME_SIZE = 16                      # 敌人名称字体大小
 
 -   NAME_COLOR = 0                      # 敌人名称字体颜色
 
 - end
 
 - #==============================================================================
 
 - # ■ RPG
 
 - #==============================================================================
 
 - module RPG
 
 -   class Enemy
 
 -     def hp_width
 
 -       return self.read_note('hp_width')
 
 -     end
 
 -   end
 
 - end
 
 - #==============================================================================
 
 - # ■ Game_Enemy
 
 - #==============================================================================
 
 - class Game_Enemy < Game_Battler
 
 -   #--------------------------------------------------------------------------
 
 -   # ○ 血条宽度
 
 -   #--------------------------------------------------------------------------
 
 -   def hp_width
 
 -     return $data_enemies[@enemy_id].hp_width
 
 -   end
 
 - end
 
 - #==============================================================================
 
 - # ■ Sprite_Battler
 
 - #==============================================================================
 
 - class Sprite_Battler < Sprite_Base
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 初始化对象
 
 -   #     viewport : 视区
 
 -   #     battler  : 战斗者 (Game_Battler)
 
 -   #--------------------------------------------------------------------------
 
 -   def initialize(viewport, battler = nil)
 
 -     super(viewport)
 
 -     @battler = battler
 
 -     @battler_visible = false
 
 -     @effect_type = 0            # 效果种类
 
 -     @effect_duration = 0        # 效果剩余时间
 
 -     if @battler.is_a?(Game_Enemy)
 
 -       width = hp_width + 32
 
 -       height = 24 + 32
 
 -       x = @battler.screen_x - width/2
 
 -       y = @battler.screen_y - height/2
 
 -       # 调节名称位置
 
 -       if Enemy_HP::SHOW_NAME
 
 -         height += Enemy_HP::NAME_SIZE + 2
 
 -         y -= Enemy_HP::NAME_SIZE + 2
 
 -       end
 
 -       # 生成血条窗体
 
 -       @enemy_hp_window = Window_Base.new(x, y, width, height)
 
 -       @enemy_hp_window.opacity = 0
 
 -       @enemy_hp_window.contents_opacity = 0
 
 -       @enemy_hp_window.contents = Bitmap.new(width - 32, height - 32)
 
 -       @enemy_hp_window.draw_enemy_info(@battler, 0, 0, width - 32)
 
 -       # 保存旧血量(控制刷新)
 
 -       @old_hp = -1
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 释放
 
 -   #--------------------------------------------------------------------------
 
 -   def dispose
 
 -     if self.bitmap != nil
 
 -       self.bitmap.dispose
 
 -       @enemy_hp_window.dispose
 
 -     end
 
 -     super
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 释放敌人活动块
 
 -   #--------------------------------------------------------------------------
 
 -   def dispose_enemies
 
 -     for sprite in @enemy_sprites
 
 -       sprite.dispose
 
 -       @enemy_hp_window.dispose
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 更新画面
 
 -   #--------------------------------------------------------------------------
 
 -   def update
 
 -     super
 
 -     if @battler == nil
 
 -       self.bitmap = nil
 
 -     else
 
 -       @use_sprite = @battler.use_sprite?
 
 -       if @use_sprite
 
 -         self.x = @battler.screen_x
 
 -         self.y = @battler.screen_y
 
 -         self.z = @battler.screen_z
 
 -         update_battler_bitmap
 
 -       end
 
 -       setup_new_effect
 
 -       update_effect
 
 -       # 更新血条窗体
 
 -       if @enemy_hp_window != nil and @old_hp != @battler.hp
 
 -         @enemy_hp_window.contents.clear
 
 -         @enemy_hp_window.draw_enemy_info(@battler, 0, 0, hp_width)
 
 -         @old_hp = @battler.hp
 
 -       end
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 更新出现效果
 
 -   #--------------------------------------------------------------------------
 
 -   def update_appear
 
 -     self.blend_type = 0
 
 -     self.color.set(0, 0, 0, 0)
 
 -     self.opacity = (16 - @effect_duration) * 16
 
 -     # 对象非敌人时返回
 
 -     return unless @battler.is_a?(Game_Enemy) 
 
 -     @enemy_hp_window.contents_opacity = self.opacity
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 更新消失效果
 
 -   #--------------------------------------------------------------------------
 
 -   def update_disappear
 
 -     self.blend_type = 0
 
 -     self.color.set(0, 0, 0, 0)
 
 -     self.opacity = 256 - (32 - @effect_duration) * 10
 
 -     # 对象非敌人时返回
 
 -     return unless @battler.is_a?(Game_Enemy) 
 
 -     @enemy_hp_window.contents_opacity = self.opacity
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ◎ 更新崩溃效果
 
 -   #--------------------------------------------------------------------------
 
 -   def update_collapse
 
 -     self.blend_type = 1
 
 -     self.color.set(255, 128, 128, 128)
 
 -     self.opacity = 256 - (48 - @effect_duration) * 6
 
 -     # 对象非敌人时返回
 
 -     return unless @battler.is_a?(Game_Enemy) 
 
 -     @enemy_hp_window.contents_opacity = self.opacity
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ○ 血条宽度
 
 -   #--------------------------------------------------------------------------
 
 -   def hp_width
 
 -     result = Enemy_HP::HP_WIDTH
 
 -     if @battler.is_a?(Game_Enemy)
 
 -       if @battler.hp_width.to_i == 0
 
 -         result = Enemy_HP::HP_WIDTH
 
 -       else
 
 -         result = @battler.hp_width.to_i
 
 -       end
 
 -     end
 
 -     return result
 
 -   end
 
 - end
 
 - #==============================================================================
 
 - # ■ Window_Base
 
 - #==============================================================================
 
 - class Window_Base < Window
 
 -   #--------------------------------------------------------------------------
 
 -   # ○ 描绘敌人信息
 
 -   #     enemy : 角色
 
 -   #     x     : 描绘目标 X 坐标
 
 -   #     y     : 描绘目标 Y 坐标
 
 -   #     width : 宽
 
 -   #--------------------------------------------------------------------------
 
 -   def draw_enemy_info(enemy, x, y, width = 64)
 
 -     # 为字体阴影内缩1像素
 
 -     width -= 1
 
 -     # 显示名称
 
 -     if Enemy_HP::SHOW_NAME
 
 -       self.contents.font.color = text_color(Enemy_HP::NAME_COLOR)
 
 -       self.contents.font.size = Enemy_HP::NAME_SIZE
 
 -       self.contents.draw_text(x, y, width, WLH, enemy.name, 1)
 
 -       self.contents.font.size = Font.default_size
 
 -       y += Enemy_HP::NAME_SIZE + 2
 
 -     end
 
 -     # 描绘血槽
 
 -     draw_actor_hp_gauge(enemy, x, y, width)
 
 -     # 描绘生命符号
 
 -     self.contents.font.color = system_color
 
 -     self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a)
 
 -     # 描绘具体生命值
 
 -     return unless Enemy_HP::SHOW_VALUE
 
 -     self.contents.font.color = hp_color(enemy)
 
 -     xr = x + width
 
 -     self.contents.draw_text(xr - 40, y, 40, WLH, enemy.hp, 2)
 
 -   end
 
 - end
 
  复制代码 这个脚本可以看见敌人血量显示 |   
 
评分
- 
查看全部评分
 
 
 
 
 
 |