| 赞 | 0  | 
 
| VIP | 0 | 
 
| 好人卡 | 0 | 
 
| 积分 | 1 | 
 
| 经验 | 21598 | 
 
| 最后登录 | 2017-9-25 | 
 
| 在线时间 | 448 小时 | 
 
 
 
 
 
Lv1.梦旅人 
	- 梦石
 - 0 
 
        - 星屑
 - 50 
 
        - 在线时间
 - 448 小时
 
        - 注册时间
 - 2011-10-9
 
        - 帖子
 - 184
 
 
 
 | 
	
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员  
 
x
 
 本帖最后由 冷徹心扉 于 2015-11-28 17:03 编辑  
 
這是我的橫戰顯示敵血條腳本 (橫戰版本3.4E) 
想在血條上顯示敵人當前的HP數值、以及將敵人的狀態圖標一併顯示 
請問該怎麼修改呢? 
萬分感謝!- #==============================================================================
 
 - # ★要啟用這個腳本
 
 - #==============================================================================
 
 - # ■ Sprite_Battler
 
 - #==============================================================================
 
  
- class Sprite_Battler < Sprite_Base
 
 -   # Word used in enemy Notes field to hide HP gauge 註解以隱藏HP條
 
 -   GAUGE_M = "HIDEHP"
 
 -   # 背景色                       [邊框顏色,                       內部顏色]
 
 -   GAUGE_BC = [Color.new(100,0,0,255), Color.new(0,0,0,255)]  #155.205.155
 
  
-   # 面層色(漸變效果) [左端, 右端]
 
 -   GAUGE_GC = [Color.new(150,0,0), Color.new(240,50,50)]
 
 -   
 
 -   GAUGE_W = 82 # 寬度
 
 -   GAUGE_H = 5 # 高度 4
 
 -   GAUGE_S = 70 # 扣減速度(超過2)40 越小越快
 
 -   GAUGE_T = 1200 # 顯示幀數 1秒3000   10秒30000   30秒90000    60秒180000
 
 -   GAUGE_O = 16 # 不透明度16
 
 -   #
 
 -   GAUGE_V = false # 當光標出現可疑損壞。需要STRxx光標。
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 繪畫血條
 
 -   #--------------------------------------------------------------------------
 
 -   def create_enhpgauge
 
 -     g_width = GAUGE_W  # 長
 
 -     g_height = GAUGE_H # 高
 
 -     f_color = GAUGE_BC # 背景色
 
 -     g_color = GAUGE_GC # 面層色
 
 -     # 圖畫繪製
 
 -     bitmap = Bitmap.new(g_width, g_height * 2)
 
 -     # 上半部分:圖畫定義,背景色
 
 -     bitmap.fill_rect(0, 0, g_width, g_height, f_color[0])         # 外框
 
 -     bitmap.fill_rect(1, 1, g_width - 2, g_height - 2, f_color[1]) # 內部
 
 -     # 上半部分:圖畫定義,面層色
 
 -     bitmap.gradient_fill_rect(1, g_height + 1, g_width - 2, g_height - 2,
 
 -                               g_color[0], g_color[1])             # 層次
 
 -     # 血條建立 # [0] = 背景色 ; [1] = 面層色
 
 -     @hp_gauge = [Sprite.new, Sprite.new]
 
  
-     for i in 0..1
 
 -       sprite = @hp_gauge[i]   
 
 -       sprite.viewport = self.viewport
 
 -       sprite.bitmap = bitmap
 
 -       sprite.src_rect.set(0, 0, g_width, g_height)
 
 -       sprite.src_rect.y = g_height if i == 1
 
 -       if $back_attack && N01::BACK_ATTACK && N01::BACK_ATTACK_NON_BACK_MIRROR
 
 -         sprite.x = Graphics.width - @battler.screen_x
 
 -       else
 
 -   #----------------------------------------------------------------------------------------------------------------------------------------------------        
 
 - #~           sprite.x = 10  #固定顯示位置
 
 - #~           sprite.x = @battler.screen_x + 5  #血條位置
 
 -           sprite.x = @battler.screen_x + 12  #血條位置
 
 -       end
 
 -  
 
 -       sprite.y = @battler.screen_y  + 15 #血條高低
 
  
- #----------------------------------------------------------------------------------------------------------------------------------------------------      
 
 -       sprite.ox = g_width / 2 - 4
 
 -       sprite.oy = g_height / 2 - 1
 
 - #~       sprite.z = @battler.screen_z + 1 #血條優先度
 
 -     sprite.z = self.z =  battler.position_z + 10#血條優先度
 
 -   
 
 - #~       sprite.z = +20 if i == 1         
 
 -       sprite.opacity = 0
 
 -     end
 
 -     # 各種
 
 -     @enid = @battler.enemy_id
 
 -     @hp = @battler.hp
 
 -     
 
 -     @gauge_width = GAUGE_W + 1    
 
 -     @gauge_opacity = 0
 
 -   end
 
 -   #----------------------------------------------------------------------------------------------------------------------------------------------------
 
 -   # ● 血條更新
 
 -   #--------------------------------------------------------------------------
 
 -   def enhpgauge_update
 
 -     # 如果對應ID敵人被傷害的時候需要顯示
 
 -     if @enid != @battler.enemy_id
 
 -       @enid = @battler.enemy_id
 
 -       @gauge_visible = true
 
 - #~ ##      @gauge_visible = false if $data_enemies[@enid].note.include?(GAUGE_M)
 
 - #~  ##     for i in @hp_gauge do i.visible = @gauge_visible end
 
 -       end
 
 -     return unless @gauge_visible
 
 -     # 計算更新
 
 -     if @hp != @battler.hp
 
 -       g_width = (@battler.hp / (@battler.maxhp * 1.0))
 
 -       @gauge_width = ((GAUGE_W * g_width) + 1).truncate
 
 -       @gauge_opacity = GAUGE_T
 
 -       @hp = @battler.hp
 
 -     end
 
 -     # 長
 
 -     g_width = @hp_gauge[1].src_rect.width
 
 -     speed = GAUGE_S
 
 -     rect = @hp_gauge[1].src_rect
 
 -     rect.width = (@gauge_width + (g_width * (speed - 1))) / speed
 
 -     if rect.width != @gauge_width
 
 -       if rect.width > @gauge_width
 
 -         rect.width -= 1
 
 -       else
 
 -         rect.width += 1
 
 -       end
 
 -     end
 
 -     rect.width = 2 if rect.width <= 1 and @hp > 0
 
 -     
 
 -     
 
 -     # 透明度
 
 -     if GAUGE_V and @battler.cursor_flash
 
 -       @gauge_opacity += GAUGE_O * 2 if @gauge_opacity <= GAUGE_T / 2
 
 -     else
 
 -       @gauge_opacity -= GAUGE_O if @gauge_opacity > 0
 
 -     end
 
 -     # 透明度適用
 
 -     for i in @hp_gauge do i.opacity = @gauge_opacity end
 
 -       
 
  
- #-----------------------------------------------------------------------------------------------------------------
 
 -         if @battler.hp > 0#or @gauge_width > 1  #假如敵人存活就顯示血條
 
 -                 @gauge_visible = true
 
 -                 @gauge_opacity = 255
 
 -               end        
 
 - #-----------------------------------------------------------------------------------------------------------------
 
 -       
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 對象初始化
 
 -   #--------------------------------------------------------------------------
 
 -   alias initialize_str15 initialize
 
 -   def initialize(viewport, battler = nil)
 
 -     initialize_str15(viewport, battler)
 
 -     if @battler.is_a?(Game_Enemy)
 
 -       create_enhpgauge
 
 -       @gauge_visible = true
 
 - #~ ##      @gauge_visible = false if $data_enemies[@enid].note.include?(GAUGE_M)
 
 - #~   ##    for i in @hp_gauge do i.visible = @gauge_visible end
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 解放(dispose)
 
 -   #--------------------------------------------------------------------------
 
 -   alias dispose_str15 dispose
 
 -   def dispose
 
 -     dispose_str15
 
 -     if @battler.is_a?(Game_Enemy)
 
 -       @hp_gauge[0].bitmap.dispose
 
 -       @hp_gauge[0].dispose
 
 -       @hp_gauge[1].dispose
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 幀更新
 
 -   #--------------------------------------------------------------------------
 
 -   alias update_str15 update
 
 -   def update
 
 -     update_str15
 
 -     enhpgauge_update if @battler.is_a?(Game_Enemy)
 
 -   end
 
 - end
 
 
  复制代码 |   
 
 
 
 |