Help - Search - Members - Calendar
Full Version: Custom Hud - State Display
RPG RPG Revolution Forums > Scripting > Script Development and Support > RGSS2
Pillanious
Hi everyone! smile.gif

I'm currently using the following script to generate a custom HUD:

CODE
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Custom HUD for Melody
# Author: Yami
# Site: Loctien.net
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#~~~ Initialize ~~~#

module YAMI
  module HUD_MELODY
    #~~ Base HUD ~~#
    HUD_SIZE_X = 520
    HUD_SIZE_Y = 32
    HEIGHT_PER_HUD = 32
    
    #~~ HP/MP/Rage ~~#
    HP_GAUGE_X = 189
    HP_GAUGE_Y = 21 #True HP_GAUGE_Y = HP_GAUGE_Y + index * YAMI::HUD_MELODY::HEIGHT_PER_HUD
    MP_GAUGE_X = 264
    MP_GAUGE_Y = 22 #True MP_GAUGE_Y = MP_GAUGE_Y + index * YAMI::HUD_MELODY::HEIGHT_PER_HUD
    RAGE_GAUGE_X = 339
    RAGE_GAUGE_Y = 22 #True RAGE_GAUGE_Y = RAGE_GAUGE_Y + index * YAMI::HUD_MELODY::HEIGHT_PER_HUD
    HP_GAUGE_WIDTH = 62
    MP_GAUGE_WIDTH = 62
    RAGE_GAUGE_WIDTH = 75
    
    #~~ HP/MP/RAGE Number ~~#
    USE_IMAGE = true
    USE_IMAGE_RAGE = true
    #IF USE_IMAGE = false
    HP_COLOR = 2
    MP_COLOR = 1
    RAGE_SHOW = "\\C[10]Rage: \\C[0]%d"
    
    #~~ States ~~#
    SHOW_STATES = 50
    SCROLL_STATES = true
    STATES_X = 15
    SCROLL_STATES_DELAY = 100 #This is Frames_Count, which 60 frames ~ 1 second
  end
end

#~~~ End Initialize ~~~#

class Scene_Battle < Scene_Base
  def start_target_actor_selection
    pause_atb(true) if semi_active_atb? or wait_atb?
    if @command_action
      @info_viewport.ox += @status_window.width
      @info_viewport.rect.x += @status_window.width
    end
    create_highlighted_targets($game_party)
    @target_help_window.active = true
    @target_actor_window = Window_BattleStatus.new(false)
    @target_actor_window.index = 0
    @target_actor_window.active = true
    @target_actor_window.y = @info_viewport.rect.y + 12
    @actor_command_window.active = false
    #---

    #---
    if atb_target_actor_case
      obj = @selected_battler.action.skill if @selected_battler.action.skill?
      obj = @selected_battler.action.item if @selected_battler.action.item?
      if atb?
        case @selected_battler.action.atb_queue_kind
        when 1
          obj = $data_skills[@selected_battler.action.atb_queue_basic]
        when 2
          obj = $data_items[@selected_battler.action.atb_queue_basic]
        end
      end
      @target_actor_window.target_highlight = true
      @target_actor_window.highlight_all = true if obj.for_all?
      @target_actor_window.highlight_all = true if obj.for_random?
      @target_actor_window.highlight_user = true if obj.for_user?
      @target_actor_window.frozen_cursor = true if obj.for_user?
      @target_actor_window.index = @selected_battler.index if obj.for_user?
      @target_actor_window.highlight_none = true if obj.for_none?
      @target_actor_window.highlight_dead = true if obj.for_dead_friend?
      @target_actor_window.refresh
    end
    #---
    @target_help_window.refresh(@target_actor_window.actor, @selected_battler)
    hide_object_windows
    update_battle_cursor
    create_aoe_indicator(@target_actor_window)
  end

  def end_target_actor_selection
    @target_help_window.active = false
    @last_target_enemy = nil
    @status_window.draw_item(@selected_battler.index)
    @target_actor_window.dispose
    @target_actor_window = nil
    #---
    #---
    show_object_windows
    if @actor_command_window.item == :attack or @command_action
      @info_viewport.ox -= @status_window.width
      @info_viewport.rect.x -= @status_window.width
      @actor_command_window.active = true
      @command_action = false
    end
    pause_atb(false) if semi_active_atb?
    dispose_aoe_indicator
  end
  
  def hide_object_windows
    @skill_window.visible = false if @skill_window != nil
    @item_window.visible = false if @item_window != nil
  end
  
  def show_object_windows
    @skill_window.visible = true if @skill_window != nil
    @item_window.visible = true if @item_window != nil
  end
  
  def close_input_windows
    @party_command_window.active = false
    @actor_command_window.active = false
    @confirm_command_window.active = false
    @party_command_window.openness = 0
    @actor_command_window.openness = 0
    @confirm_command_window.openness = 0
    loop do
      update_basic
      break if @info_viewport.ox == 128
      if @info_viewport.ox >= 128
        @info_viewport.ox -= [16, (128 - @info_viewport.ox).abs].min
      else
        @info_viewport.ox += [16, (128 - @info_viewport.ox).abs].min
      end
    end
    @status_window.index = @actor_index = -1
  end
  
  def create_info_viewport
    force_preemptive_or_surprise
    #---
    @info_viewport = Viewport.new(0, Graphics.height-160, Graphics.width, 160)
    @info_viewport.z = 100
    #---
    @status_window = Window_BattleStatus.new(true)
    @status_window.viewport = @info_viewport
    @status_window.x = 112
    @status_window.y += 12
    @status_hp_window = Window_BattleStatusHP.new
    @status_hp_window.viewport = @info_viewport
    @status_hp_window.x = 112
    @status_hp_window.y += 12    
    @status_mp_window = Window_BattleStatusMP.new
    @status_mp_window.viewport = @info_viewport
    @status_mp_window.x = 112
    @status_mp_window.y += 12    
    @status_rage_window = Window_BattleStatusRage.new
    @status_rage_window.viewport = @info_viewport
    @status_rage_window.x = 112
    @status_rage_window.y += 12    
    @status_states_window = Window_BattleStatusStates.new
    @status_states_window.viewport = @info_viewport
    @status_states_window.x = 112
    @status_states_window.y += 12    
    #---
    @party_command_window = Window_PartyCommand.new
    @actor_command_window = Window_ActorCommand.new
    @party_command_window.viewport = @info_viewport
    @actor_command_window.viewport = @info_viewport
    @actor_command_window.x = Graphics.width
    @confirm_command_window = Window_ConfirmCommand.new
    @confirm_command_window.viewport = @info_viewport
    @confirm_command_window.x = Graphics.width
    @actor_command_window.y += 32
    @confirm_command_window.y += 32
    @party_command_window.y += 32
    #---
    @info_viewport.ox = 128
    @actor_index = 0
    @status_shortcut_index = 0
    @status_window.index = 0
    @status_window.refresh
    actor = @status_window.actor
    @actor_command_window.setup(actor)
    if $game_switches[YEM::BATTLE_ENGINE::OPTIONS[:autocursor_sw]]
      @actor_command_window.index = actor.battle_command_index.to_i
    end
    #--- Calculate PTB Initiative
    if ptb? and (rand($game_party.total_agi) < rand($game_troop.total_agi) or
    $game_troop.surprise and !$scene.atb?)
      if !(($TEST or $BTEST) and Input.press?(Input::CTRL)) and
      !$game_troop.preemptive
        @ptb_initiative = true
        @info_viewport.ox = 64
        @actor_index = -1
        @status_window.index = -1
        @status_window.refresh
        @actor_command_window.openness = 0
        @party_command_window.openness = 0
      end
    end
    if ctb?
      make_action_orders_ctb
      if @action_battlers[0].actor?
        @actor_index = @action_battlers[0].index
        @status_window.index = @action_battlers[0].index
        actor = @status_window.actor
        @actor_command_window.setup(actor)
        if $game_switches[YEM::BATTLE_ENGINE::OPTIONS[:autocursor_sw]]
          index = actor.battle_command_index.to_i
          maximum = @actor_command_window.item_max - 1
          @actor_command_window.index = [index, maximum].min
        end
      else
        @ctb_initiative = true
        @info_viewport.ox = 64
        @actor_index = -1
        @status_window.index = -1
        @actor_command_window.openness = 0
        @party_command_window.openness = 0
      end
      @status_window.refresh
    end
    #---
    @info_viewport.visible = true
  end
  
  def dispose_info_viewport
    #---
    @status_window.dispose
    @status_hp_window.dispose
    @status_mp_window.dispose
    @status_rage_window.dispose
    @status_states_window.dispose
    #---
    @party_command_window.dispose
    @actor_command_window.dispose
    @confirm_command_window.dispose
    @info_viewport.dispose
    #---
    dispose_bem_windows
  end
end  


class Window_BattleStatusStates < Window_BattleStatus  

  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    recreate if @current_party != $game_party.members
    for member in $game_party.members
      draw_item(member.index) if redraw?(member)
    end
  end
  
  #--------------------------------------------------------------------------
  # redraw?
  #--------------------------------------------------------------------------
  def redraw?(member)
    return true if ((Graphics.frame_count > 0) and (Graphics.frame_count % 180 == 0))
    return true if member.update_states
    return false
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    max_members = YEM::BATTLE_ENGINE::MAXIMUM_PARTY_MEMBERS
    @item_max = [$game_party.members.size, max_members].max
    for i in 0...@item_max; draw_item(i); end
  end
  
end
class Window_BattleStatusHP < Window_BattleStatus  
  #--------------------------------------------------------------------------
  # draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    actor = $game_party.members[index]
    return if actor == nil
    draw_member_hp_2(actor, index)
  end  
end

class Window_BattleStatusMP < Window_BattleStatus
  #--------------------------------------------------------------------------
  # draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    actor = $game_party.members[index]
    return if actor == nil
    draw_member_mp_2(actor, index)
  end
  
end

class Window_BattleStatusRage < Window_BattleStatus

  #--------------------------------------------------------------------------
  # draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    actor = $game_party.members[index]
    return if actor == nil
    draw_member_rage_2(actor, index)
  end
  
end # Window_BattleStatusRage

class Window_BattleStatus < Window_Selectable
  def initialize(minimum = false)
    super(0, 0, 544, 192)
    max_members = YEM::BATTLE_ENGINE::MAXIMUM_PARTY_MEMBERS
    @item_max = [$game_party.members.size, max_members].max
    @column_max = 1
    @minimum = minimum
    @current_party = $game_party.members
    recreate unless @miniature
    self.active = false
    self.opacity = 0
  end
  
  def refresh
    return if @miniature
    max_members = YEM::BATTLE_ENGINE::MAXIMUM_PARTY_MEMBERS
    @item_max = [$game_party.members.size, max_members].max
    @column_max = 1
    for i in 0...@item_max; draw_item(i); end
  end
    
  def update_cursor
    self.cursor_rect.empty
  end  
  
  def update
    super unless prevent_left_right?
    if (Graphics.frame_count > 0) and (Graphics.frame_count % (YAMI::HUD_MELODY::SCROLL_STATES_DELAY) == 0) then
      for i in $game_party.members
        actor = i
        @state_id_show[actor.id] += 1
      end
    end
    redraw if @last_index != self.index
    redraw if @battle_refresh_call
    return unless @minimum
    recreate if @current_party != $game_party.members
    return unless $scene.is_a?(Scene_Battle)
    for member in $game_party.members; redraw if member.update_states; end
    redraw if @last_active_battler != $scene.active_battler
  end
    
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    actor = $game_party.members[index]
    return if actor == nil
    draw_member_face_new(actor, index)
    draw_member_action_2(actor, rect.clone)
    return if @minimum
    draw_member_states(actor, rect.clone)
    draw_member_hp_2(actor, index)
    draw_member_mp_2(actor, index)
    draw_member_rage_2(actor, index)
  end
  
  def draw_item2(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    actor = $game_party.members[index]
    return if actor == nil
    draw_member_face(actor, rect.clone)
    draw_member_action(actor, rect.clone)
    return if @minimum
    draw_member_name(actor, rect.clone)
    draw_member_states(actor, rect.clone)
    draw_member_hp(actor, rect.clone)
    draw_member_mp(actor, rect.clone)
    draw_member_rage(actor, rect.clone)
  end
  
  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = YAMI::HUD_MELODY::HUD_SIZE_X
    rect.height = YAMI::HUD_MELODY::HUD_SIZE_Y
    rect.x = 0
    rect.y = index * rect.height
    return rect
  end
  
  def draw_member_face_new(actor, index)
    dx = 0
    dy = YAMI::HUD_MELODY::HEIGHT_PER_HUD * index
    lower_opacity = YEM::BATTLE_ENGINE::PARTY_WINDOW[:face_opacity]
    opacity = opacity?(actor) ? 255 : lower_opacity
    bitmap = Cache.picture(actor.name+"_HUD")    
    rect = Rect.new(0, 0, 0, 0)
    rect.width = YAMI::HUD_MELODY::HUD_SIZE_X
    rect.height = YAMI::HUD_MELODY::HUD_SIZE_Y
    rect.x = 0
    rect.y = 0
    self.contents.blt(dx, dy, bitmap, rect, opacity)
  end
  
  def draw_member_states(actor, rect)
    if YAMI::HUD_MELODY::SCROLL_STATES then
      bitmap = bitmap_state(actor)
      if ((@state_id_show[actor.id]) >= actor.states.size) then
        @state_id_show[actor.id] = 0
      end
      rect_new = Rect.new(@state_id_show[actor.id] * 24, 0, 24, 24)
      self.contents.blt(rect.x + YAMI::HUD_MELODY::STATES_X, rect.y+8, bitmap, rect_new)  
      actor.update_states = false
    else
      count = 0
      for state in actor.states
        next if state.hide_state
        draw_icon(state.icon_index, rect.x + YAMI::HUD_MELODY::STATES_X + 28 * count, rect.y+6)
        count += 1
        break if count >= YAMI::HUD_MELODY::SHOW_STATES
      end
      actor.update_states = false
    end
  end
  
  def bitmap_state(actor)
    icon = Cache.system("Iconset")
    w = actor.states.size * 24
    w = 24 if w < 1
    bitmap = Bitmap.new(w, 24)
    count = 0
    for state in actor.states
      next if state.hide_state
      icon_index = state.icon_index
      x = 24 * count
      rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
      bitmap.blt(x, 0, icon, rect)
      count += 1
    end
    return bitmap
  end
  
  def draw_member_action_2(actor, rect)
    return unless YEM::BATTLE_ENGINE::PARTY_WINDOW[:action_icons]
    icon = YEM::BATTLE_ENGINE::ICON_MESSAGE[:wait_icon]
    case actor.action.kind
    when 0 # Basic
      case actor.action.basic
      when 0 # Attack
        icon = actor.attack_icon
      when 1 # Guard
        icon = actor.guard_icon
      when 2 # Escape
        icon = YEM::BATTLE_ENGINE::ICON_MESSAGE[:flee_icon]
      end
    when 1 # Skill
      icon = actor.action.skill.icon_index
    when 2 # Item
      icon = actor.action.item.icon_index
    end
    enabled = actor.action.valid?
    enabled = false if actor.action.kind == 0 and actor.action.basic == 3
    if $scene.is_a?(Scene_Battle) and $scene.ctb? and actor.action.guard?
      icon = actor.guard_icon
      enabled = true
    end
    draw_icon(icon, rect.x + 142, rect.y + 4, enabled)
  end
  
  #--------------------------------------------------------------------------
  # recreate
  #--------------------------------------------------------------------------
  def recreate
    max_members = YEM::BATTLE_ENGINE::MAXIMUM_PARTY_MEMBERS
    @item_max = [$game_party.members.size, max_members].max
    @item_max = 1 if @minitature
    @updating = -1
    @current_party = $game_party.members
    @current_hp = {}; @current_hp_gauge = {}; @maxhp = {}
    @current_mp = {}; @current_mp_gauge = {}; @maxmp = {}
    @current_rage = {}; @current_rage_gauge = {}; @max_rage = {}
    @hp_gauge = {}; @mp_gauge = {}; @rage_gauge = {}
    temp_rect = item_rect(0)
    @hp_gauge_width = YAMI::HUD_MELODY::HP_GAUGE_WIDTH
    @mp_gauge_width = YAMI::HUD_MELODY::MP_GAUGE_WIDTH
    @rg_gauge_width = YAMI::HUD_MELODY::RAGE_GAUGE_WIDTH
    @state_id_show = {}
    for i in 0...@current_party.size
      actor = $game_party.members[i]
      @state_id_show[actor.id] = 0
      #--
      @current_hp[i] = actor.hp
      maxhp = [[actor.maxhp, actor.base_maxhp, 1].max, actor.maxhp_limit].min
      @current_hp_gauge[i] = (actor.hp * @hp_gauge_width / maxhp)
      @maxhp[i] = maxhp
      @hp_gauge[i] = Cache.system("HP")
      rect = Rect.new(0, 0, @current_hp_gauge[i], @hp_gauge[i].height)
      self.contents.blt(0, 0, @hp_gauge[i], rect)      
      #--
      maxmp = [[actor.maxmp, actor.base_maxmp, 1].max, actor.maxmp_limit].min
      @current_mp[i] = actor.mp
      @current_mp_gauge[i] = (actor.mp * @mp_gauge_width / [actor.maxmp,1].max)
      @maxmp[i] = maxmp
      @mp_gauge[i] = Cache.system("MP")
      rect = Rect.new(0, 0, @current_mp_gauge[i], @mp_gauge[i].height)
      self.contents.blt(0, 0, @mp_gauge[i], rect)
      #---
      actor.rage = 0 if actor.rage == nil
      @current_rage[i] = actor.rage
      @current_rage_gauge[i] = actor.rage * @rg_gauge_width / actor.max_rage
      @max_rage[i] = actor.max_rage
      @rage_gauge[i] = Cache.system("Rage2")
      rect = Rect.new(0, 0, @current_rage_gauge[i], @rage_gauge[i].height)
      self.contents.blt(0, 0, @rage_gauge[i], rect)      
    end
    refresh
  end
  
  def draw_member_rage_2(actor, index)
    return unless actor.use_rage?
    @updating = -1
    i = actor.index
    max_rage = @max_rage[i]
    dy = YAMI::HUD_MELODY::RAGE_GAUGE_Y + index * YAMI::HUD_MELODY::HEIGHT_PER_HUD
    dx = YAMI::HUD_MELODY::RAGE_GAUGE_X
    rg_gw = @rg_gauge_width
    #---
    target_gauge = (actor.rage * @rg_gauge_width / max_rage)
    target_gauge += 2 if actor.rage > 0
    if @current_rage_gauge[i] > target_gauge
      @updating = i
      value = [1,(@current_rage_gauge[i]-target_gauge).abs].min
      @current_rage_gauge[i] -= value
      @current_rage_gauge[i] = [@current_rage_gauge[i], 0].max
      rect = Rect.new(0, 0, @current_rage_gauge[i], @rage_gauge[i].height)
      self.contents.blt(dx, dy, @rage_gauge[i], rect)  
    elsif @current_rage_gauge[i] < target_gauge
      @updating = i
      value = [1,(@current_rage_gauge[i]-target_gauge).abs].min
      @current_rage_gauge[i] += value
      @current_rage_gauge[i] = [@current_rage_gauge[i], rg_gw].min
      rect = Rect.new(0, 0, @current_rage_gauge[i], @rage_gauge[i].height)
      self.contents.blt(dx, dy, @rage_gauge[i], rect)
    else
      gw = @current_rage_gauge[i]
      gw = [gw, 3].max if actor.rage > 0
      rect = Rect.new(0, 0, gw, @rage_gauge[i].height)
      self.contents.blt(dx, dy, @rage_gauge[i], rect)
    end
    #---
    if @current_rage[i] != actor.rage
      @updating = i
      @current_rage[i] += (@current_rage[i] > actor.rage) ? -1 : 1
      @current_rage[i] = actor.rage if @current_rage_gauge[i] == target_gauge
    end
    #---
    text = @current_rage[i]
    if YAMI::HUD_MELODY::USE_IMAGE_RAGE then
      write_number(text,dx+4,dy-20,2)
    else
      self.contents.font.size = 12
      self.contents.draw_format_text(dx, dy-20, 75, WLH, sprintf(YAMI::HUD_MELODY::RAGE_SHOW,text), 0)
    end
    #---
  end
  
  def draw_member_mp_2(actor, index)
    @updating = -1
    i = actor.index
    maxmp = @maxmp[i]
    dy = YAMI::HUD_MELODY::MP_GAUGE_Y + index * YAMI::HUD_MELODY::HEIGHT_PER_HUD
    dx = YAMI::HUD_MELODY::MP_GAUGE_X
    mp_gw = @mp_gauge_width
    #---
    target_gauge = (actor.mp * @mp_gauge_width / maxmp)
    if @current_mp_gauge[i] > target_gauge and !@miniature
      @updating = i
      @current_mp_gauge[i] -= [1, (@current_mp_gauge[i]-target_gauge).abs].min
      @current_mp_gauge[i] = [@current_mp_gauge[i], 0].max
      rect = Rect.new(0, 0, @current_mp_gauge[i], @mp_gauge[i].height)
      self.contents.blt(dx, dy, @mp_gauge[i], rect)  
    elsif @current_mp_gauge[i] < target_gauge and !@miniature
      @updating = i
      @current_mp_gauge[i] += [1, (@current_mp_gauge[i]-target_gauge).abs].min
      @current_mp_gauge[i] = [@current_mp_gauge[i], @mp_gauge_width].min
      rect = Rect.new(0, 0, @current_mp_gauge[i], @mp_gauge[i].height)
      self.contents.blt(dx, dy, @mp_gauge[i], rect)  
    else
      gw = mp_gw * actor.mp / maxmp
      gw = [gw, 3].max if actor.mp > 0
      rect = Rect.new(0, 0, gw, @mp_gauge[i].height)
      self.contents.blt(dx, dy, @mp_gauge[i], rect)  
    end
    #---
    if actor.base_maxmp > actor.maxmp
      gbw = mp_gw
      gbw *= (actor.base_maxmp - actor.maxmp) / [actor.base_maxmp, 1].max + 1
      rect = Rect.new(0, 0, mp_gw-gbw, @mp_gauge[i].height)
      self.contents.blt(dx, dy, @mp_gauge[i], rect)
    end
    #---
    if @current_mp[i] != actor.mp
      @updating = i
      den = [mp_gw/3 + rand(mp_gw/2), 1].max
      value = [[maxmp/den, (@current_mp[i]-actor.mp).abs].min, 1].max
      @current_mp[i] += (@current_mp[i] > actor.mp) ? -value : value
      @current_mp[i] = actor.mp if @current_mp_gauge[i] == target_gauge
    end
    #---
    text = @current_mp[i]
    if YAMI::HUD_MELODY::USE_IMAGE then
      write_number(text,dx+6,dy-20,1)
    else      
      self.contents.font.color = text_color(YAMI::HUD_MELODY::MP_COLOR)
      self.contents.font.size = 16
      self.contents.draw_text(dx+22, dy-20, 75, WLH, text, 0)
    end
    #---
  end
  
  def draw_member_hp_2(actor, index)
    @updating = -1
    i = actor.index
    maxhp = @maxhp[i]
    dy = YAMI::HUD_MELODY::HP_GAUGE_Y + index * YAMI::HUD_MELODY::HEIGHT_PER_HUD
    dx = YAMI::HUD_MELODY::HP_GAUGE_X
    #---
    target_gauge = (actor.hp * @hp_gauge_width / maxhp)
    if @current_hp_gauge[i] > target_gauge
      @updating = i
      @current_hp_gauge[i] -= [1, (@current_hp_gauge[i]-target_gauge).abs].min
      @current_hp_gauge[i] = [@current_hp_gauge[i], 0].max
      rect = Rect.new(0, 0, @current_hp_gauge[i], @hp_gauge[i].height)
      self.contents.blt(dx, dy, @hp_gauge[i], rect)      
    elsif @current_hp_gauge[i] < target_gauge
      @updating = i
      @current_hp_gauge[i] += [1, (@current_hp_gauge[i]-target_gauge).abs].min
      @current_hp_gauge[i] = [@current_hp_gauge[i], @hp_gauge_width].min
      rect = Rect.new(0, 0, @current_hp_gauge[i], @hp_gauge[i].height)
      self.contents.blt(dx, dy, @hp_gauge[i], rect)
    else
      gw = @hp_gauge_width * actor.hp / maxhp
      gw = [gw, 3].max if actor.hp > 0
      rect = Rect.new(0, 0, gw, @hp_gauge[i].height)
      self.contents.blt(dx, dy, @hp_gauge[i], rect)
    end
    #---
    if maxhp > actor.maxhp
      gbw = @hp_gauge_width * (actor.base_maxhp - actor.maxhp) / maxhp + 1
      rect = Rect.new(0, 0, @hp_gauge_width-gbw, @hp_gauge[i].height)
      self.contents.blt(dx, dy, @hp_gauge[i], rect)
    end
    #---
    if @current_hp[i] != actor.hp
      @updating = i
      den = [@hp_gauge_width/3 + rand(@hp_gauge_width/2), 1].max
      value = [[maxhp/den, (@current_hp[i]-actor.hp).abs].min, 1].max
      @current_hp[i] += (@current_hp[i] > actor.hp) ? -value : value
      @current_hp[i] = actor.hp if @current_hp_gauge[i] == target_gauge
    end
    #---
    text = @current_hp[i]
    if YAMI::HUD_MELODY::USE_IMAGE then
      write_number(text,dx+4,dy-20,0)
    else
      self.contents.font.color = text_color(YAMI::HUD_MELODY::HP_COLOR)
      self.contents.font.size = 16
      self.contents.draw_text(dx+22, dy-20, 75, WLH, text, 0)
    end    
    #---
  end
  
  def write_number(num,x,y,line = 0)
    index = String(num).length    
    work = num
    if work == 0 then
      d_int = 0
      bitmap = Cache.system("String02")
      rect = Rect.new(d_int * (bitmap.width / 10), line * (bitmap.height / 4), (bitmap.width / 10), (bitmap.height / 4))
      self.contents.blt(x + 15, y + 6, bitmap, rect)  
      return
    end
    while work != 0 do
      d_int = work % 10
      work = (work - d_int) / 10
      bitmap = Cache.system("String02")
      rect = Rect.new(d_int * (bitmap.width / 10), line * (bitmap.height / 4), (bitmap.width / 10), (bitmap.height / 4))
      self.contents.blt(x + index * (bitmap.width / 10 - 4), y + 6, bitmap, rect)  
      index -= 1
    end
  end
end

class Window_BattleStatus_Mini < Window_BattleStatus
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_item2($scene.selected_battler.index)
  end  
end # Window_BattleStatus_Mini


and I wondered if anyone with some scripting knowledge would know how to edit it so that certain states are omitted from showing. I'm using YEM's passive states, and I don't want them to cycle through in battle, since they have no icons - and it seems silly to have 9-11 states constantly scrolling on each actor...

Essentially, what I'd like is something like

If State # is between x and y Then Hide State.

I'm illiterate as far as coding is concerned, so any help would be greatly appreciated! smile.gif
Pillanious
Bumpy - If there's any information missing for someone to be able to assist me, please let me know and I'll be happy to provide what I can smile.gif
Pillanious
Bump! smile.gif
Pillanious
Bump again - Is there any additional information I could provide to make this problem solvable? smile.gif
Helios
I remember KGC have a script that hide states with 0 priority.
Pillanious
QUOTE (Helios @ Sep 24 2011, 07:06 AM) *
I remember KGC have a script that hide states with 0 priority.


Do you have a link by any chance?
Pillanious
QUOTE (Helios @ Sep 24 2011, 11:26 PM) *



Much appreciated. Unfortunately - it seems this script and mine are not compatible, as it does not work sad.gif (I tried placing it both above and below the script I currently use for my custom HUD)

I sincerely appreciate the attempt, though - Thank you! smile.gif
Pillanious
bump again!
Helios
There's an alternative, though I'm not sure if it will work in your case.

Set the priority to 0, and use no icon (or even no name) for the states you wish to hide.

If done properly, you won't be able to see it at all, even if other states are present (as long as their priorities are higher than 0).
Pillanious
QUOTE (Helios @ Oct 3 2011, 08:31 PM) *
There's an alternative, though I'm not sure if it will work in your case.

Set the priority to 0, and use no icon (or even no name) for the states you wish to hide.

If done properly, you won't be able to see it at all, even if other states are present (as long as their priorities are higher than 0).


That's what I've been doing - but because I have Passive states, if one character has, say, 10 of them - and another has none, then the person with no passives will show their state afflictions almost constantly, while the other will scroll through a lot quicker. Slowing down the scroll speed seems to make it worse sad.gif
Helios
I'm not a script guru, so I'm just trying my luck here.

After taking a close look at the code, I found this line:

Line 425:
next if state.hide_state

Which probably imply it has a built-in hide feature. Unfortunately I can't find any further information.

Instead, try to replace that line with a KGC one, and use 0 priority, see if it works.

next if state.priority == 0
Pillanious
QUOTE (Helios @ Oct 4 2011, 04:05 PM) *
I'm not a script guru, so I'm just trying my luck here.

After taking a close look at the code, I found this line:

Line 425:
next if state.hide_state

Which probably imply it has a built-in hide feature. Unfortunately I can't find any further information.

Instead, try to replace that line with a KGC one, and use 0 priority, see if it works.

next if state.priority == 0


I tried it - and it seems to work. The statuses still cycle through at the same speed, but even if the effect has an icon, it won't be drawn if the priority is zero. It looks a bit odd, but it works. Thank you! smile.gif

If any mod reads this, you're welcome to close this particular thread biggrin.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.