Show enemy buffs/debuffs

Discussion in 'RGSS3 Script Requests' started by Draw, May 21, 2016.

  1. Draw

    Draw Veteran Veteran

    Messages:
    83
    Likes Received:
    1
    First Language:
    French
    Hello again !


    In Rm Vx Ace, by default you can see buffs/debuffs icons next actors name, but you can't with enemy names.


    It could be an efficient way to track enemy buffs/debuffs. I've searched in Window_BattleEnemy, but I can't find a way to do that.


    #==============================================================================
    # ■ Window_BattleEnemy
    #------------------------------------------------------------------------------
    #  バトル画面で、行動対象の敵キャラを選択するウィンドウです。
    #==============================================================================

    class Window_BattleEnemy < Window_Selectable
    #--------------------------------------------------------------------------
    # ● オブジェクト初期化
    # info_viewport : 情報表示用ビューポート
    #--------------------------------------------------------------------------
    def initialize(info_viewport)
    super(0, info_viewport.rect.y, window_width, fitting_height(4))
    refresh
    self.visible = false
    @info_viewport = info_viewport
    end
    #--------------------------------------------------------------------------
    # ● ウィンドウ幅の取得
    #--------------------------------------------------------------------------
    def window_width
    Graphics.width - 128
    end
    #--------------------------------------------------------------------------
    # ● 桁数の取得
    #--------------------------------------------------------------------------
    def col_max
    return 1
    end
    #--------------------------------------------------------------------------
    # ● 項目数の取得
    #--------------------------------------------------------------------------
    def item_max
    $game_troop.alive_members.size
    end
    #--------------------------------------------------------------------------
    # ● 敵キャラオブジェクト取得
    #--------------------------------------------------------------------------
    def enemy
    $game_troop.alive_members[@index]
    end
    #--------------------------------------------------------------------------
    # ● 項目の描画
    #--------------------------------------------------------------------------
    def draw_item(index)
    change_color(normal_color)
    name = $game_troop.alive_members[index].name
    draw_text(item_rect_for_text(index), name)
    end
    #--------------------------------------------------------------------------
    # ● ウィンドウの表示
    #--------------------------------------------------------------------------
    def show
    if @info_viewport
    width_remain = Graphics.width - width
    self.x = width_remain
    @info_viewport.rect.width = width_remain
    select(0)
    end
    super
    end
    #--------------------------------------------------------------------------
    # ● ウィンドウの非表示
    #--------------------------------------------------------------------------
    def hide
    @info_viewport.rect.width = Graphics.width if @info_viewport
    super
    end
    end


    Here's a picture to explain : 


    http://hpics.li/50f768d


    That's all, if someone finds out.
     
    #1
  2. stupid enough to like FF13

    stupid enough to like FF13 Veteran Veteran

    Messages:
    587
    Likes Received:
    316
    First Language:
    English
    Code:
    class Window_BattleEnemy < Window_Selectable
      #--------------------------------------------------------------------------
      # * Overwrite "draw_item"; displays state icons for enemies
      #--------------------------------------------------------------------------
      def draw_item(index)
        change_color(normal_color)
        name = $game_troop.alive_members[index].name
        draw_text(item_rect_for_text(index), name)
        rectx = item_rect_for_text(index).x + item_rect_for_text(index).width - 48
        recty = item_rect_for_text(index).y
        draw_actor_icons($game_troop.alive_members[index], rectx, recty, 48)
      end
    end
    Edit: Alias method (in case of incompatibility)

    Code:
    class Window_BattleEnemy < Window_Selectable
      #--------------------------------------------------------------------------
      # * Alias "draw_item"
      #--------------------------------------------------------------------------
      alias draw_enemy draw_item
      def draw_item(index)
        draw_enemy(index)
        rectx = item_rect_for_text(index).x + item_rect_for_text(index).width - 48
        recty = item_rect_for_text(index).y
        draw_actor_icons($game_troop.alive_members[index], rectx, recty, 48)
      end
    end
     
    Last edited by a moderator: May 21, 2016
    #2
    Draw likes this.
  3. Draw

    Draw Veteran Veteran

    Messages:
    83
    Likes Received:
    1
    First Language:
    French


    It works fine, thank you !
     
    #3

Share This Page