Jump to content
Sign in to follow this  
ZombieBear

Enemy Name Window In Battle

Recommended Posts

Hello,

 

I created an enemy name window in battle (in the style of older FF games) and am trying to get the window to NOT print duplicate names. Ex: if there are 4 skeletons and 1 ghost, I would like to read:

                         -------------------

                         | skeleton   x4 

                         | ghost       x1  

                         -------------------

 

Here's what I have for the name window thus far; its just a status window on the battlescreen that displays all the names. Other than that it has no functionality and is pretty simple. I have copied a few things from Game_troop to see if I can narrow down what to do... but no luck so far.

 

I was thinking about using enemy.plural to check the number of enemies, then if it was true write just one enemy name, but I can't put it all together. Any help would be greatly appreciated; thanks! :)

 

 

 

#==============================================================================
# ** Window_BattleEnemy
#------------------------------------------------------------------------------
#  Window for selecting the enemy who is the action target on the battle
# screen.
#==============================================================================

class Window_EnemyName < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     info_viewport : Viewport for displaying information
  #--------------------------------------------------------------------------
  def initialize(info_viewport)
    super(0, info_viewport.rect.y, window_width, fitting_height(4))
    refresh
    self.openness = 0
    self.back_opacity = 255
    self.z = 0
    #self.visible = false
    @info_viewport = info_viewport
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    return 200 #Graphics.width - 364
  end
  #--------------------------------------------------------------------------
  # * Get Digit Count
  #--------------------------------------------------------------------------
  def col_max
    return 1
  end
  #--------------------------------------------------------------------------
  # * Get Number of Items
  #--------------------------------------------------------------------------
  def item_max
    $game_troop.alive_members.size
  end
  #--------------------------------------------------------------------------
  # * Get Enemy Object
  #--------------------------------------------------------------------------
  def enemy
    $game_troop.alive_members[@index]
  end
  #--------------------------------------------------------------------------
  # * Get Enemy Number
  #--------------------------------------------------------------------------
   def make_unique_names
    members.each do |enemy|
      next unless enemy.alive?
 #     next unless enemy.letter.empty?
      n = @names_count[enemy.original_name] || 0
 #     enemy.letter = letter_table[n % letter_table.size]
      @names_count[enemy.original_name] = n + 1
    end
    members.each do |enemy|
      n = @names_count[enemy.original_name] || 0
      enemy.plural = true if n >= 2
    end
  end
  #--------------------------------------------------------------------------
  # * Get Enemy Name Array
  #    For display at start of battle. Overlapping names are removed.
  #--------------------------------------------------------------------------
  def enemy_names
    names = []
    members.each do |enemy|
      next unless enemy.alive?
      next unless enemy.plural?
      next if names.include?(enemy.original_name)
      names.push(enemy.original_name)
    end
    names
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    change_color(normal_color)
    name = $game_troop.alive_members[index].name
    #if enemy.plural == true
      #draw_text(item_rect_for_text(index), name)
    #else
      draw_text(item_rect_for_text(index), name)
    #end
  end
end

 

 

 

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×