Pacman's Enemy HUD Small Fix

Joined
Apr 17, 2013
Messages
93
Reaction score
6
First Language
English
Primarily Uses
N/A
Link to Pacman's script:

The script works great, but it shows enemies with the "appear halfway" tag as targetable. Because of this, the element of surprise is often lost, and it also gives the player the ability to attack enemies that have not appeared yet.

I believe/hope it is easy to fix, but I have no idea how. Can anyone help?
 

Attachments

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
After line 241 add in
return if enemy.hidden?
to give you this
Code:
  def draw_item(index)
    rect = item_rect(index)
    rect.x += 4
    rect.width -= 8
    contents.clear_rect(rect)
    contents.font.color = normal_color
    enemy = $game_troop.members[index]
    return if enemy.hidden?
    draw_basic_area(basic_area_rect(index), enemy)
    draw_gauge_area(gauge_area_rect(index), enemy)
  end
 
Joined
Apr 17, 2013
Messages
93
Reaction score
6
First Language
English
Primarily Uses
N/A
Swift as always.
It still shows that there are additional enemies as attack options, though the options are blank and choosing them will instead choose the already appeared enemies for attacks.
Well, I guess it's fine.

Thanks Ronin.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
Sorry, missed that part. I'll look into it more. @Gravemaster

EDIT* fixed the extra enemy line showing
Change Item_max to this
Code:
  def item_max
    @troop_hidden = 0
    $game_troop.members.each do |enemy|
      if enemy.hidden?
        @troop_hidden += 1
      end
    end
    return $game_troop.members.size - @troop_hidden
  end
Still has an issue from what I can see. Dead members show up as targetable.

EDIT 2* Fixed. Had to change the draw_item condition
It shows
Code:
enemy = $game_troop.members[index]
Change to
Code:
enemy = $game_troop.alive_members[index]
EDIT 3*
Change the script back to normal
Here is the add on patch
Code:
#===============================================================================
#
# Enemy HUD (1.3)
# 15/4/2012
# By Pacman (ported to VXA from a VX script also by Pacman)
# patch by Roninator2
# Fixes hidden enemies
#===============================================================================

class Window_EnemyHUD < Window_BattleStatus
  #--------------------------------------------------------------------------
  # * Get item max
  #--------------------------------------------------------------------------
  def item_max
    @troop_hidden = 0
    $game_troop.members.each do |enemy|
      if enemy.hidden?
        @troop_hidden += 1
      end
    end
    return $game_troop.members.size - @troop_hidden - $game_troop.dead_members.size
  end
  #--------------------------------------------------------------------------
  # * Get enemy
  #--------------------------------------------------------------------------
  def enemy
    $game_troop.alive_members[@index]
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item to be drawn
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    rect.x += 4
    rect.width -= 8
    contents.clear_rect(rect)
    contents.font.color = normal_color
    enemy = $game_troop.alive_members[index]
    return if enemy.hidden?
    draw_basic_area(basic_area_rect(index), enemy)
    draw_gauge_area(gauge_area_rect(index), enemy)
  end
end
 
Last edited:
Joined
Apr 17, 2013
Messages
93
Reaction score
6
First Language
English
Primarily Uses
N/A
Great work! Thanks Ronin.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
Just did some more testing. Still has a problem.
Enemies killed in the middle of the group will not have the correct index number.
So you end up selecting an enemy that may not be the correct one that is actually attacked.
@Gravemaster
*EDIT - quick fix. updated code above.
had to change def enemy
Code:
  def enemy
    $game_troop.alive_members[@index]
  end
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,975
Members
137,563
Latest member
cexojow
Top