Help - Search - Members - Calendar
Full Version: Jens009's Enemy HP Window
RPG RPG Revolution Forums > Scripting > Script Tutorials > RGSS2
Pages: 1, 2
jens009
Jens009's Enemy HP Window

Version: 1.2
Author Jens009
Release Date July 29, 2008
Updated: August 8, 2008


Exclusive Script at RPG RPG Revolution


Introduction
So I was chatting at the IRC when puppeto4 said something like "There are no new scripts." And before she left she said something like "Make new scripts!" I took the challenge and ta-da. Here you go! =D

So did you ever wanted to know your enemy's current HP during battle? Well, you can now!
The script simply shows enemy's HP during Battle at the upper left corner. The best part? It's plug and play. No scripting needed. =]

Features
- Plug And Play
- Show Enemy's HP
- Aliased methods to increaased compatibility.
- Version 1.1:
-Able to turn of Enemy Windows
-Using a Game Switch or
-Using a Script Switch
- Version 1.2:
- Show enemy States
- Change X and Y spacing
- Change amount of Columns
- Option of having No Lag


Customization
Will add in the future.

Compatibility
Since I aliased most methods the compatibility on Custom Battle Systems should be high. If not, please report it to me.

Screenshot
Everyone loves a good screenshot
Version 1.2


Ehh that's when it's too clumped. But you can customize this because of the config section I added in the script.



With Woratana's Neo Gauge Script



DEMO
It's plug and play remember. ;D
If you Insist:
[Show/Hide] Verson 1.0


Installation
Plug and play. How many times should I repeat myself? =p
Instructions on how to activate/deactivate enemy HP window can be found inside the script.

Script
[Show/Hide] Jens009 Enemy HP Window Version 1.2

CODE
#======================================================================
# Jens009's Enemy Hp Window                                            
# Version 1.2                                                          
# Log: July 29, 2008                                                  
#     - Version 1.0: Show Enemy Hp Bars
#      August 5, 2008
#     - Version 1.1: Enable On/Off feature Using a $game_system instance
#                  : Enable On/Off feature using an in-game switch
#      August 8, 2008
#     - Version 1.2: Add New Options
#                  : Change Default Window Size
#                  : Add Enemy States
# Rant: [Code Geass ftw]                                              
#   C.C. Still loves Pizza <3                                          
#   Be nice to her Lulu.                                          
#   Oh.. I haven't done my summer homework yet. T_T
#                                                                        
# Credits to:                                                          
#  Jens009 (Translation and Modification)                                              
#  Puppeto4 (Alias tutorial and for bugging me to create a script)    
#      just kidding puppeto =p                                        
# Author's Note:                                                        
# 9 Methods were aliased. Refer to lines 110-118                      
#   4 Were not necessary but was needed so that Enemy Window          
#     was not present during item/skill selections.                    
#                                                                      
#                                                                      
# Modification:                                                        
#   If you want to modify the bars, look @lines 42-72.You can see that
#     I simply took draw_actor_hp and turned it into draw_enemy_hp      
#     This means you can use any bars you desire so long as you define  
#     it correctly. =]                                                  
#            
#-----------------------------------------------------------------------------
# CONFIG:
#
# I. Turning the Window On of Off during In-Game:
#
#    There are two kinds of switches you can use depending
#     upon your liking. I made it so that you either have a
#     game switch or a script switch that handles the enemy window flag.
#
#  If you want to use a script switch
#     -set USE_GSWITCH to false
#     -Use a call script, $game_system.enemy_window = true/false
#         True = Window Shows up, False = No Enemy Window
#
#  If you want to use a game switch
#     -Set USE_GSWITCH to true
#     -Decide what Game Switch ID you want to use
#         in ENEMY_WINDOW_SWITCH
#     -Use that game switch to check for showing the Enemy Hp Window
#        True = Window Shows up, False = No enemy window.
#
#
#  BY DEFAULT, USE_GSWITCH is false.
#     So you are using a Script Switch
#  
#  II.  ALWAYS_UPDATE
#         can either be set to true or false.
#         if true, the enemy window always update for every action
#             but the battle system will have more lag.
#         if false, the enemy window only updates at the end of each turn
#             and everytime the battle selection begins.
#         Setting it to false will lower compatibility but should still work
#        for most systems regardless.
#
# III. Spacing X and Y change
#    SPACING_X = Changing this number will change the X spacing of the windows
#    SPACING_Y = Changing this number will change the Y spacing of the windows
# IV. COLUMNS
#     COLUMNS = Draw enemy information by creating 4 columns.
# V. SHOW_STATES
#     if set to true, enemies state will be shown.
#======================================================================
module JCONFIG
  USE_GSWITCH = false       # Setting it to false will use the script
                            #   switch $game_system.enemy_hp instead.
                            # Setting it to true will use an in-game switch
                            #   using the switch ID below.
  ENEMY_WINDOW_SWITCH = 1 # Switch ID that will be used to check
                          # Enemy Window is only ON, when Switch is ON
  ALWAYS_UPDATE = true     # True = window always updates
                            # False = window updates at end of turn
  SPACING_X = 90          # X spacing per enemy info
  SPACING_Y = 44          # Y spacing per enemy info
  COLUMNS = 4             # By default, Do 4 Columns.
  SHOW_STATES = true      # true will show enemies states
                          # false will not show states
                            
end
                        
#======================================================================
# Start Game_System Edit
#======================================================================
class Game_System
  attr_accessor :enemy_hp       # Show enemy HP on battle
  
  alias jens009_system_initialize_enemy_hp initialize
#=============================================
# Initialize Values
#=============================================
  def initialize
    # Initialize enemy hp window to true
    @enemy_hp = true
    # Call previous methods
    jens009_system_initialize_enemy_hp
  end
  
end # END Game system Edit
  

class Window_Base
#====================================
# Define Enemy Name                  
#====================================
  def draw_enemy_name(enemy, x, y)
    self.contents.font.color = normal_color
    self.contents.draw_text (x, y, 120, 32, enemy.name)
  end
  
#==========================
# Define Enemy State
#========================
  def draw_enemy_state(enemy, x, y)
    count = 0
    for state in enemy.states
      draw_icon(state.icon_index, x + 24 * count, y)
      count += 1
      break if (24 * count > width - 24)
    end
  end
#--------------------------------------------------------------------------
# * Draw Enemy HP
#     actor : actor
#     x     : draw spot x-coordinate
#     y     : draw spot y-coordinate
#     width : Width
#--------------------------------------------------------------------------
  def draw_enemy_hp(enemy, x, y, width = 120)
    draw_enemy_hp_gauge(enemy, x, y, width)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a)
    last_font_size = self.contents.font.size
    xr = x + width
    if width < 120
      self.contents.draw_text(xr - 44, y, 44, WLH, enemy.hp, 2)
    else
      self.contents.draw_text(xr - 99, y, 44, WLH, enemy.hp, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(xr - 55, y, 11, WLH, "/", 2)
      self.contents.draw_text(xr - 44, y, 44, WLH, enemy.maxhp, 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw HP gauge
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : Width
  #--------------------------------------------------------------------------
  def draw_enemy_hp_gauge(enemy, x, y, width = 120)
    gw = width * enemy.hp / enemy.maxhp
    gc1 = hp_gauge_color1
    gc2 = hp_gauge_color2
    self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
    self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  end
  
end #End of Window_Base Class


#=====================================#
# Window_EnemyHP                      #  
# Class handles window for Enemy's HP #
#=====================================#
class Window_EnemyHP < Window_Selectable
  def initialize
    super ( 0, 0, 545, 300)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    @column_max = JCONFIG::COLUMNS
    refresh
  end
  
  def refresh
    self.contents.clear
    for i in 0...$game_troop.members.size
      enemy = $game_troop.members[i]
      x = i % @column_max * (JCONFIG::SPACING_X + @spacing)
    if JCONFIG::SHOW_STATES
      y = (i / @column_max * (JCONFIG::SPACING_Y + WLH) )
    else
      y = (i / @column_max * ((JCONFIG::SPACING_Y - 34) + WLH) )
    end
    
      #========================================
      # If Using Game_Switch
      #=========================================
      if JCONFIG::USE_GSWITCH and $game_switches[JCONFIG::ENEMY_WINDOW_SWITCH]
        draw_enemy_hp(enemy, x, y+20, 90)
        draw_enemy_name(enemy, x, y)
        if JCONFIG::SHOW_STATES
        draw_enemy_state(enemy, x, y +44)
        end
      end
      #==========================================
      # If Using Script Switch
      #==========================================
      if JCONFIG::USE_GSWITCH == false
        if $game_system.enemy_hp == true # Start check if Window Flag is On
          draw_enemy_hp(enemy, x, y+20, 90)
          draw_enemy_name(enemy, x, y)
          if JCONFIG::SHOW_STATES
          draw_enemy_state(enemy, x, y +44)
          end # END CHECK
        end #End flag check
      end # END game switche check
      
    end
  end #End Refresh

end #End of Window_EnemyHP Class


#====================================#
# Scene_Battle                       #
# New methods that were aliased:     #
#====================================#
class Scene_Battle
  
alias jens009_create_info_viewport create_info_viewport
alias jens009_dispose_info_viewport dispose_info_viewport
alias jens009_start_item_selection start_item_selection
alias jens009_start_skill_selection start_skill_selection
alias jens009_end_item_selection end_item_selection
alias jens009_end_skill_selection end_skill_selection
alias jens009_process_victory process_victory

alias jens009_update_info_viewport update_info_viewport

alias jens009_start_party_command_selection start_party_command_selection
alias jens009_execute_action execute_action
alias jens009_turn_end turn_end

# Create Information
def create_info_viewport
   jens009_create_info_viewport
   @enemy_window = Window_EnemyHP.new
end
# Dispose Information
def dispose_info_viewport
   jens009_dispose_info_viewport
   @enemy_window.dispose
end

#=============================================
# Always Update Window
#============================================
def update_info_viewport
  if JCONFIG::ALWAYS_UPDATE == true
    @enemy_window.refresh
    jens009_update_info_viewport
  else
    jens009_update_info_viewport
  end
end

#=============================================
# Update Only When Turn starts and ends
#============================================
def start_party_command_selection
  if JCONFIG::ALWAYS_UPDATE == true
    jens009_start_party_command_selection
    else
    @enemy_window.visible = true
    @enemy_window.refresh
    jens009_start_party_command_selection
  end
end

def execute_action
  if JCONFIG::ALWAYS_UPDATE == true
    jens009_execute_action
  else
    @enemy_window.visible = false
    jens009_execute_action
  end
end

def turn_end
  if JCONFIG::ALWAYS_UPDATE == true
    jens009_turn_end
  else
    @enemy_window.refresh
    jens009_turn_end
  end
end
#============================================
# END OF UPDATE CHECK
#===========================================

#=====================================
# Remove Window During Selection  
def start_item_selection
   @enemy_window.visible = false
   jens009_start_item_selection
end
# Remove Window During Selection
def start_skill_selection
   @enemy_window.visible = false
   jens009_start_skill_selection
end
# True Visibility after slection
def end_item_selection
   jens009_end_item_selection
   @enemy_window.visible = true
end
# True Visibility after selection
def end_skill_selection
   jens009_end_skill_selection
   @enemy_window.visible = true
end
# Refresh When Victorious
def process_victory
   @enemy_window.refresh
   jens009_process_victory
  end

#=====================================#
# End of Scene_Battle Method Edits    #
#=====================================#

end


[Show/Hide] Jens009 Enemy HP WIndow Version 1.1

CODE
#======================================================================
# Jens009's Enemy Hp Window                                            
# Version 1.1                                                          
# Log: July 29, 2008                                                  
#     - Version 1.0: Show Enemy Hp Bars
#      August 5, 2008
#     - Version 1.1: Enable On/Off feature Using a $game_system instance
#                  : Enable On/Off feature using an in-game switch
# Rant: [Code Geass ftw]                                              
#   C.C. Still loves Pizza <3                                          
#   Be nice to her Lulu.                                          
#   Oh.. I haven't done my summer homework yet. T_T
#                                                                        
# Credits to:                                                          
#  Jens009 (Translation and Modification)                                              
#  Puppeto4 (Alias tutorial and for bugging me to create a script)    
#      just kidding puppeto =p                                        
# Author's Note:                                                        
# 9 Methods were aliased. Refer to lines 110-118                      
#   4 Were not necessary but was needed so that Enemy Window          
#     was not present during item/skill selections.                    
#                                                                      
#                                                                      
# Modification:                                                        
#   If you want to modify the bars, look @lines 42-72.You can see that
#     I simply took draw_actor_hp and turned it into draw_enemy_hp      
#     This means you can use any bars you desire so long as you define  
#     it correctly. =]                                                  
#            
#-----------------------------------------------------------------------------
# Turning the Window On of Off during In-Game:
#
#    There are two kinds of switches you can use depending
#     upon your liking. I made it so that you either have a
#     game switch or a script switch that handles the enemy window flag.
#
#  If you want to use a script switch
#     -set USE_GSWITCH to false
#     -Use a call script, $game_system.enemy_window = true/false
#         True = Window Shows up, False = No Enemy Window
#
#  If you want to use a game switch
#     -Set USE_GSWITCH to true
#     -Decide what Game Switch ID you want to use
#         in ENEMY_WINDOW_SWITCH
#     -Use that game switch to check for showing the Enemy Hp Window
#        True = Window Shows up, False = No enemy window.
#
#
#  BY DEFAULT, USE_GSWITCH is false.
#     So you are using a Script Switch
#  
#
#======================================================================
module JCONFIG
  USE_GSWITCH = false       # Setting it to false will use the script
                            #   switch $game_system.enemy_hp instead.
                            # Setting it to true will use an in-game switch
                            #   using the switch ID below.
  ENEMY_WINDOW_SWITCH = 1 # Switch ID that will be used to check
                          # Enemy Window is only ON, when Switch is ON
end
                        
#======================================================================
# Start Game_System Edit
#======================================================================
class Game_System
  attr_accessor :enemy_hp       # Show enemy HP on battle
  
  alias jens009_system_initialize_enemy_hp initialize
#=============================================
# Initialize Values
#=============================================
  def initialize
    # Initialize enemy hp window to true
    @enemy_hp = true
    # Call previous methods
    jens009_system_initialize_enemy_hp
  end
  
end # END Game system Edit
  

class Window_Base
#====================================
# Define Enemy Name                  
#====================================
  def draw_enemy_name(enemy, x, y)
    self.contents.font.color = normal_color
    self.contents.draw_text (x, y, 120, 32, enemy.name)
  end

#--------------------------------------------------------------------------
# * Draw Enemy HP
#     actor : actor
#     x     : draw spot x-coordinate
#     y     : draw spot y-coordinate
#     width : Width
#--------------------------------------------------------------------------
  def draw_enemy_hp(enemy, x, y, width = 120)
    draw_enemy_hp_gauge(enemy, x, y, width)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a)
    last_font_size = self.contents.font.size
    xr = x + width
    if width < 120
      self.contents.draw_text(xr - 44, y, 44, WLH, enemy.hp, 2)
    else
      self.contents.draw_text(xr - 99, y, 44, WLH, enemy.hp, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(xr - 55, y, 11, WLH, "/", 2)
      self.contents.draw_text(xr - 44, y, 44, WLH, enemy.maxhp, 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw HP gauge
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : Width
  #--------------------------------------------------------------------------
  def draw_enemy_hp_gauge(enemy, x, y, width = 120)
    gw = width * enemy.hp / enemy.maxhp
    gc1 = hp_gauge_color1
    gc2 = hp_gauge_color2
    self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
    self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  end
  
end #End of Window_Base Class


#=====================================#
# Window_EnemyHP                      #  
# Class handles window for Enemy's HP #
#=====================================#
class Window_EnemyHP < Window_Selectable
  def initialize
    super ( 0, 0, 160, 300)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    refresh
  end
  
  def refresh
    self.contents.clear
    for i in 0...$game_troop.members.size
      enemy = $game_troop.members[i]
        x = 0
        y = i * 30
      #========================================
      # If Using Game_Switch
      #=========================================
      if JCONFIG::USE_GSWITCH and $game_switches[JCONFIG::ENEMY_WINDOW_SWITCH]
        draw_enemy_hp(enemy, x, y+20, 90)
        draw_enemy_name(enemy, x, y)
      end
      #==========================================
      # If Using Script Switch
      #==========================================
      if JCONFIG::USE_GSWITCH == false
        if $game_system.enemy_hp == true # Start check if Window Flag is On
          draw_enemy_hp(enemy, x, y+20, 90)
          draw_enemy_name(enemy, x, y)
        end #End flag check
      end # END game switche check
      
    end
  end #End Refresh

end #End of Window_EnemyHP Class


#====================================#
# Scene_Battle                       #
# New methods that were aliased:     #
#====================================#
class Scene_Battle
  
alias jens009_create_info_viewport create_info_viewport
alias jens009_dispose_info_viewport dispose_info_viewport
alias jens009_update update
alias jens009_update_info_viewport update_info_viewport
alias jens009_start_item_selection start_item_selection
alias jens009_start_skill_selection start_skill_selection
alias jens009_end_item_selection end_item_selection
alias jens009_end_skill_selection end_skill_selection
alias jens009_process_victory process_victory
  
# Create Information
def create_info_viewport
   jens009_create_info_viewport
   @enemy_window = Window_EnemyHP.new
end
# Dispose Information
def dispose_info_viewport
   jens009_dispose_info_viewport
   @enemy_window.dispose
end
#Update Window
def update
   jens009_update
   @enemy_window.refresh
end

# Update Window
def update_info_viewport
   @enemy_window.update
   jens009_update_info_viewport
end

# Remove Window During Selection  
def start_item_selection
   @enemy_window.visible = false
   jens009_start_item_selection
end
# Remove Window During Selection
def start_skill_selection
   @enemy_window.visible = false
   jens009_start_skill_selection
end
# True Visibility after slection
def end_item_selection
   jens009_end_item_selection
   @enemy_window.visible = true
end
# True Visibility after selection
def end_skill_selection
   jens009_end_skill_selection
   @enemy_window.visible = true
end
# Refresh When Victorious
def process_victory
   @enemy_window.refresh
   jens009_process_victory
  end

#=====================================#
# End of Scene_Battle Method Edits    #
#=====================================#

end


[Show/Hide] Jens009 Enemy HP Window Version 1.0

CODE
#======================================================================#
# Jens009's Enemy Hp Window                                            #
# Version 1.0                                                          #
# Log: July 29, 2008                                                   #
#     - Version 1.0: Show Enemy Hp Bars                                #
# Rant: [Code Geass ftw]                                               #
#   C.C. Still loves Pizza <3                                          #
#   Be nice to her Lulu.                                               #
#                                                                      #  
# Credits to:                                                          #
#  Jens009 (Translation and Modification from Noobitron)                              #                
#  Puppeto4 (Alias tutorial and for bugging me to create a script)     #
#      just kidding puppeto =p                                         #
# Author's Note:                                                       #  
# 9 Methods were aliased. Refer to lines 110-118                       #
#   4 Were not necessary but was needed so that Enemy Window           #
#     was not present during item/skill selections.                    #
#                                                                      #
#                                                                      #
# Modification:                                                        #
#   If you want to modify the bars, look @lines 42-72.You can see that #
#   I simply took draw_actor_hp and turned it into draw_enemy_hp       #
#   This means you can use any bars you desire so long as you define   #
#   it correctly. =]                                                   #
#   Other than that, you can also modify Window_EnemyHP for            #
#   coordinates                                                        #      
#======================================================================#

class Window_Base
#====================================#
# Define Enemy Name                  #
#====================================#
  def draw_enemy_name(enemy, x, y)
    self.contents.font.color = normal_color
    self.contents.draw_text (x, y, 120, 32, enemy.name)
  end

#--------------------------------------------------------------------------
# * Draw Enemy HP
#     actor : actor
#     x     : draw spot x-coordinate
#     y     : draw spot y-coordinate
#     width : Width
#--------------------------------------------------------------------------
  def draw_enemy_hp(enemy, x, y, width = 120)
    draw_enemy_hp_gauge(enemy, x, y, width)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a)
    last_font_size = self.contents.font.size
    xr = x + width
    if width < 120
      self.contents.draw_text(xr - 44, y, 44, WLH, enemy.hp, 2)
    else
      self.contents.draw_text(xr - 99, y, 44, WLH, enemy.hp, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(xr - 55, y, 11, WLH, "/", 2)
      self.contents.draw_text(xr - 44, y, 44, WLH, enemy.maxhp, 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw HP gauge
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : Width
  #--------------------------------------------------------------------------
  def draw_enemy_hp_gauge(enemy, x, y, width = 120)
    gw = width * enemy.hp / enemy.maxhp
    gc1 = hp_gauge_color1
    gc2 = hp_gauge_color2
    self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
    self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  end
  
end #End of Window_Base Class


#=====================================#
# Window_EnemyHP                      #  
# Class handles window for Enemy's HP #
#=====================================#
class Window_EnemyHP < Window_Selectable
  def initialize
    super ( 0, 0, 160, 300)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    refresh
  end
  
  def refresh
    self.contents.clear
    for i in 0...$game_troop.members.size
      enemy = $game_troop.members[i]
        x = 0
        y = i * 30
        draw_enemy_hp(enemy, x, y+20, 90)
        draw_enemy_name(enemy, x, y)
    end
  end #End Refresh

end #End of Window_EnemyHP Class


#====================================#
# Scene_Battle                       #
# New methods that were aliased:     #
#====================================#
class Scene_Battle
  
alias jens009_create_info_viewport create_info_viewport
alias jens009_dispose_info_viewport dispose_info_viewport
alias jens009_update update
alias jens009_update_info_viewport update_info_viewport
alias jens009_start_item_selection start_item_selection
alias jens009_start_skill_selection start_skill_selection
alias jens009_end_item_selection end_item_selection
alias jens009_end_skill_selection end_skill_selection
alias jens009_process_victory process_victory
  
# Create Information
def create_info_viewport
   jens009_create_info_viewport
   @enemy_window = Window_EnemyHP.new
end

# Dispose Information
def dispose_info_viewport
   jens009_dispose_info_viewport
   @enemy_window.dispose
end

#Update Window
def update
   jens009_update
   @enemy_window.refresh
end

# Update Window
def update_info_viewport
   @enemy_window.update
   jens009_update_info_viewport
end

# Remove Window During Selection  
def start_item_selection
   @enemy_window.visible = false
   jens009_start_item_selection
end

# Remove Window During Selection
def start_skill_selection
   @enemy_window.visible = false
   jens009_start_skill_selection
end

# True Visibility after slection
def end_item_selection
   jens009_end_item_selection
   @enemy_window.visible = true
end

# True Visibility after selection
def end_skill_selection
   jens009_end_skill_selection
   @enemy_window.visible = true
end

# Refresh When Victorious
def process_victory
   @enemy_window.refresh
   jens009_process_victory
  end

#=====================================#
# End of Scene_Battle Method Edits    #
#=====================================#

end



Neo Gauge Patch:
[Show/Hide] Patch v 1.0

CODE
#=======================================================
# EnemyHP Window with woratana's neo gauge script
# Taken from: Woratana's Neo Gauge Script
# Patch by: Jens009
# Instructions:
#  Simply paste below Window_EnemyHP
#======================================================

class Window_Base < Window
  #=============================================================
  # NEO HP/MP GAUGE SETTING #
  # (+) positive number | (+,-) positive or negative number
  #=============================================================
  E_HPMP_GAUGE_HEIGHT = 6 # gauge height (+) (minumum: 6)
  # Strongly recommend to use HPMP_GAUGE_HEIGHT at least 8
  # if you're using GAUGE_INSIDE_BORDER in Neo-Gauge
  E_HPMP_GAUHE_X_PLUS = 0 # Move gauge horizontally (+,-)
  E_HPMP_GAUGE_Y_PLUS = ((-1)*(E_HPMP_GAUGE_HEIGHT - 6)) # (+,-)
  # Change '((-1)*(HPMP_GAUGE_HEIGHT - 6))' to number to move gauge vertically
  #------------------------------------------------------------
  # * Neo Gauge Back Color: Return back colors
  # Set Gauge back color here~ #
  #------------------------------------------------------------
  def neo_gauge_back_color_e
    c1 = Color.new(0, 0, 0) # Black [Color1]
    c2 = Color.new(100, 100, 100) # Dark Gray [Color2]
    c3 = Color.new(200, 200, 200) # Light Gray [Color3]
    return c1, c2, c3
  end
  #===================================================================
  
  #--------------------------------------------------------------------------
  # [Rewrite] * Draw HP gauge
  #--------------------------------------------------------------------------
  def draw_enemy_hp_gauge(enemy, x, y, width = 120)
    gwidth = width * enemy.hp / enemy.maxhp
    cg = neo_gauge_back_color_e
    c1, c2, c3 = cg[0], cg[1], cg[2]
    draw_neo_gauge(x + E_HPMP_GAUHE_X_PLUS, y + WLH - 8 + E_HPMP_GAUGE_Y_PLUS, width,
E_HPMP_GAUGE_HEIGHT, c1, c2, c3)
    c1 = Color.new(139,0,0) # Dark Red
    c2 = Color.new(255,0,0) # Pure Red
    c3 = Color.new(255,255,0) # Pure Yellow
    draw_neo_gauge(x, y + WLH - 8 + E_HPMP_GAUGE_Y_PLUS, gwidth, E_HPMP_GAUGE_HEIGHT,
c1, c2, c3, false, false, width, 30)
  end
end



FAQ
Der's a 1337 bug I founded wat to do?
Post it up here and tell me the following:
QUOTE
What made the bug occur?
What happened before and after the bug occured?
What do you think caused it?
Did you fixed the bug? How?

I want to add this cool 1337 feature better than any system outz der.

Suggestions are always welcome. =] Post it up and Let's see what we can do about it.

Terms and Conditions
This script is for non-commercial use only. Contact me regarding commercial use. (No, I don't want your money).
This is an RRR script exclusive. It must not be posted under any other forums/site besides RRR
Give credits where its due.

Other than those terms above, I have nothing to add.


Credits
Jens009- Script Author
Noobitron- Script reference.
Yanxie- Alias tutorial
Grandhoug
since im most likey first to try i'll give u feedback
Grandhoug
works just fine from wat i can tell
but im not 100% that it will work that well with other battling scripts but wat do i kno, ima extremly n00b scripter
jens009
QUOTE (Grandhoug @ Jul 29 2008, 01:50 AM) *
works just fine from wat i can tell
but im not 100% that it will work that well with other battling scripts but wat do i kno, ima extremly n00b scripter

I aliased the methods that required the window so no errors should pop up. =]
Compatibility should be really high as mentioned earlier.
Grandhoug
QUOTE (jens009 @ Jul 29 2008, 04:51 AM) *
QUOTE (Grandhoug @ Jul 29 2008, 01:50 AM) *
works just fine from wat i can tell
but im not 100% that it will work that well with other battling scripts but wat do i kno, ima extremly n00b scripter

I aliased the methods that required the window so no errors should pop up. =]
Compatibility should be really high as mentioned earlier.


i just tried it in my acual game and it works just fine. good job banana.gif
link245
Thanks a lot jens009 for this script I've been looking for something like this. Its funny how your name is all over this script.
jens009
QUOTE (Grandhoug @ Jul 29 2008, 09:35 AM) *
QUOTE (jens009 @ Jul 29 2008, 04:51 AM) *
QUOTE (Grandhoug @ Jul 29 2008, 01:50 AM) *
works just fine from wat i can tell
but im not 100% that it will work that well with other battling scripts but wat do i kno, ima extremly n00b scripter

I aliased the methods that required the window so no errors should pop up. =]
Compatibility should be really high as mentioned earlier.


i just tried it in my acual game and it works just fine. good job banana.gif

THat's good to hear. What's the name of the battle system that was compatible with this one?

QUOTE (link245 @ Jul 29 2008, 09:48 AM) *
Thanks a lot jens009 for this script I've been looking for something like this. Its funny how your name is all over this script.

You're welcome. =] My name is all over the place because of the aliases. It's the only legal time I can actually spam up the script with my name =p.

Edit: Demo has been uploaded.
Rikufan12
This is great and I have no idea why this isn't included in the program but could somebody please make an animated version. As in, instead of it just appearing as a small bar, make it shrink. I know, I'm never satisfied happy.gif .
jens009
QUOTE (Rikufan12 @ Jul 29 2008, 01:31 PM) *
This is great and I have no idea why this isn't included in the program but could somebody please make an animated version. As in, instead of it just appearing as a small bar, make it shrink. I know, I'm never satisfied happy.gif .

Make it shrink? I don't think I get what you mean. Can you further elaborate?
RisingPhoenix
QUOTE (jens009 @ Jul 29 2008, 03:10 PM) *
QUOTE (Rikufan12 @ Jul 29 2008, 01:31 PM) *
This is great and I have no idea why this isn't included in the program but could somebody please make an animated version. As in, instead of it just appearing as a small bar, make it shrink. I know, I'm never satisfied happy.gif .

Make it shrink? I don't think I get what you mean. Can you further elaborate?


I think Rikufan12 wants the enemy health bars to have an animation of getting shorter when the enemy is damaged.
jens009
QUOTE (RisingPhoenix @ Jul 29 2008, 06:44 PM) *
I think Rikufan12 wants the enemy health bars to have an animation of getting shorter when the enemy is damaged.

Ah this makes sense. Well, It wouldn't be hard to adapt an animated version of the gradient. All he has to do is implement a gradient script that animates as it goes down.

This is giving me another scripting idea. XD Thanks for your suggestion.

Comments and suggestions are always welcome.
andani
Very neat script. I was wondering when this kind of thing would be made. It was kind of annoying with no health meter for enemies. Thanks, and the script works fine. Also, is it possible to customize the health bars to look similar to Woratana's Neo HP/MP Guage?
jens009
QUOTE (andani @ Jul 30 2008, 10:36 PM) *
Very neat script. I was wondering when this kind of thing would be made. It was kind of annoying with no health meter for enemies. Thanks, and the script works fine. Also, is it possible to customize the health bars to look similar to Woratana's Neo HP/MP Guage?

No problem. In fact, I'll add a patch right now so it looks like Wora's bars.

Give me 5 to 10 mins. =]

EDIT:
First post updated. Patch Posted. Screenshot Posted.

andani
Dude, you are the greatest. Thanks so much for working to do that. I was using your script before and thought about how difficult it would be for me to do that, since I am not very good with RGSS2, but you came along and made a patch for us. You are the best.
NDoerrFans
All right, I admit, I'm a complete scripting newbie. I ask for mercy when I make such a horrible request from people who are obviously much more talented than I at the scriptingz, but... hmm. I know this is "plug n' play", but I have no idea where to plug it into -- does it go under the Window_xxx stuff, or under Materials? By itself, or inside a different script? If inside another one, where? I'm sure there's some sort of scripting basics tutorial on this site, but I've been unable to find it. If someone could help me to understand where I need to put these things that are clearly so easy to implement, I'll learn a lot faster. It's easier to learn how to drive after you're given the keys, or whatever. Thank you very much in advance.
jens009
QUOTE (NDoerrFans @ Aug 5 2008, 12:37 AM) *
All right, I admit, I'm a complete scripting newbie. I ask for mercy when I make such a horrible request from people who are obviously much more talented than I at the scriptingz, but... hmm. I know this is "plug n' play", but I have no idea where to plug it into -- does it go under the Window_xxx stuff, or under Materials? By itself, or inside a different script? If inside another one, where? I'm sure there's some sort of scripting basics tutorial on this site, but I've been unable to find it. If someone could help me to understand where I need to put these things that are clearly so easy to implement, I'll learn a lot faster. It's easier to learn how to drive after you're given the keys, or whatever. Thank you very much in advance.

Lol. It's fine if you don't no anythingabout scripting.
Right click below materials, then press new script.
An empty window should show at the right.

Copy and paste the code to that huge empty window.
NDoerrFans
QUOTE
Lol. It's fine if you don't no anythingabout scripting.
Right click below materials, then press new script.
An empty window should show at the right.

Copy and paste the code to that huge empty window.


Excellent! I'm glad and I got it working. Heh, of course, the errors were all on my end. I didn't realize test battles wouldn't have the bars show up, but as soon as I booted the actual game it was there. It's a very cool script and you should be proud! Great job!
lahandi

Jens, I wonder if you could made a switch on/off for this feature (with call for script or something). I think it will be usefull for game that want to show the enemies HP bar for random encounter battle but want to hide it when the heroes meet bosses (or vice versa).

Thank you very much. smile.gif
jens009
QUOTE (lahandi @ Aug 5 2008, 09:53 AM) *
Jens, I wonder if you could made a switch on/off for this feature (with call for script or something). I think it will be usefull for game that want to show the enemies HP bar for random encounter battle but want to hide it when the heroes meet bosses (or vice versa).

Thank you very much. smile.gif

Because of this request. I shall. I'll make it able to be activated / deactivated at any point in time with a call script so that there are no in-game switches used.

EDITED: Version 1.1 Posted up.

New Features:

Able to turn off enemy window In-game using either Game Switches or a Script Switch.
lahandi
QUOTE (jens009 @ Aug 6 2008, 01:48 AM) *
Because of this request. I shall. I'll make it able to be activated / deactivated at any point in time with a call script so that there are no in-game switches used.



Respect and big thanks mate. thumbsup.gif

Warder
Cool script. I was wondering ..... is there any way you could add status icons to this? I think that would be a useful feature.
jens009
QUOTE (Fade @ Aug 8 2008, 06:31 AM) *
Cool script. I was wondering ..... is there any way you could add status icons to this? I think that would be a useful feature.

Ah. Show the status icons of the enemies? It's possible. I'll take a look into it when I find the time.
jens009
Update!
Version 1.2 is posted

Here's a little screenie:


If you think it's too clumped no worries. I just maxed it out to see how it would look like. You can disable showing the enemy's states through the config.

New Features:
- Show enemy States
- Change X and Y spacing
- Change amount of Columns
- Option of having No Lag
lahandi

Jens, in your v1.1 script. Do the script able to handle the 'appear half way' (hiding) enemies? I mean if the enemeis still hiding, his HP bar were hidden too; and when the enemy showed up, his HP bar also showed up.

CaptainWinky
Good Script.

Suggestion; Add customization for text size. Being able to have slightly smaller text will improve the overall look of the HUD.
meganew2
Looks good.....
This script can be very useful for me
jens009
QUOTE (lahandi @ Aug 19 2008, 10:25 AM) *
Jens, in your v1.1 script. Do the script able to handle the 'appear half way' (hiding) enemies? I mean if the enemeis still hiding, his HP bar were hidden too; and when the enemy showed up, his HP bar also showed up.

Ah! There we go. I knew I missed something
I have yet to make slight modifications for this. In the next version, sure. =]

QUOTE (CaptainWinky @ Aug 20 2008, 05:39 AM) *
Good Script.
Suggestion; Add customization for text size. Being able to have slightly smaller text will improve the overall look of the HUD.

Very well, this is not at all difficult.

QUOTE (meganew2 @ Aug 20 2008, 05:54 AM) *
Looks good.....
This script can be very useful for me

Great. Glad you like it.
bro
Is possible to turn off number of enemy hp?
jens009
QUOTE
is possible to turn off number of enemy hp?

Yes. I'll be working on that on the next version as well as the appear-half feature.
sogekishu
Hey, i just wondered if you could give me a little hand making the Enemy Info a little smaller. It seems a bit bulky, i have tried to change a few things about testing, but end up making it look really crappy =\.

Any help would be appreciated =).

By the way lovely script and deffinately gonna be a part of my Project and your name will appear in the Credits =).
Twilight27
Jens, have you ever played Zelda: Wind Waker? Do you know that Link can obtain a mask, that when worn, reveals the life bar of his enemies?

I would like to do something like that with your script. Is it possible to do this with a switch or two to reveal the enemies' life bar (BUT just the bar, not the number; like 25 HP)
jens009
QUOTE (sogekishu @ Aug 28 2008, 05:05 AM) *
Hey, i just wondered if you could give me a little hand making the Enemy Info a little smaller. It seems a bit bulky, i have tried to change a few things about testing, but end up making it look really crappy =\.
Any help would be appreciated =).
By the way lovely script and deffinately gonna be a part of my Project and your name will appear in the Credits =).


Ah sure. All of the enemy information is under the class Window_EnemyHP
In version 1.2 I did gave you the option under JCONFIG to customize the enemy HP window:
CODE
  SPACING_X = 90          # X spacing per enemy info
  SPACING_Y = 44          # Y spacing per enemy info
  COLUMNS = 4             # By default, Do 4 Columns.
  SHOW_STATES = true      # true will show enemies states
                          # false will not show states

To make it less bulkier, you can set Show States to false, change the number of columns to a lower number and mess around with the X and Y spacing.
I hope this helps.

IF you still want to modify the enemy hp window further, you have to go under the class and edit it manually, but I think the given config can solve your problem.

QUOTE (Twilight27 @ Aug 28 2008, 07:45 AM) *
Jens, have you ever played Zelda: Wind Waker? Do you know that Link can obtain a mask, that when worn, reveals the life bar of his enemies?
I would like to do something like that with your script. Is it possible to do this with a switch or two to reveal the enemies' life bar (BUT just the bar, not the number; like 25 HP)

This was already implemented in the script.

lookie:
CODE
module JCONFIG
  USE_GSWITCH = false       # Setting it to false will use the script
                            #   switch $game_system.enemy_hp instead.
                            # Setting it to true will use an in-game switch
                            #   using the switch ID below.
  ENEMY_WINDOW_SWITCH = 1 # Switch ID that will be used to check
                          # Enemy Window is only ON, when Switch is ON

By default, you can use Game Switch ID 1 to check if the enemy window is on or not. So essentially, you just have to activate the game switch at the right time.

As for hiding the number, you might want to find the line
CODE
def draw_enemy_hp

and delete the text methods over there.
Twilight27
Thanks very much jen. I love this script now! lol

What about...making the life bar appear only for normal enemies and not bosses (when you have the mask).
This isn't really necessary. I'll just like to see your response to this.
jens009
QUOTE (Twilight27 @ Aug 28 2008, 08:07 PM) *
Thanks very much jen. I love this script now! lol

What about...making the life bar appear only for normal enemies and not bosses (when you have the mask).
This isn't really necessary. I'll just like to see your response to this.

Ah, well it's the same concept really by using the switches.

But there's also another way by modifying the script itself. But I really think is unnecessary.
Twilight27
QUOTE (jens009 @ Aug 28 2008, 11:54 PM) *
QUOTE (Twilight27 @ Aug 28 2008, 08:07 PM) *
Thanks very much jen. I love this script now! lol

What about...making the life bar appear only for normal enemies and not bosses (when you have the mask).
This isn't really necessary. I'll just like to see your response to this.

Ah, well it's the same concept really by using the switches.

But there's also another way by modifying the script itself. But I really think is unnecessary.


I thought you might say that. I just foresaw that If the player DID NOT have the item to reveal the life, the switch would naturally be off, but either way, before the (boss) battle I would take the switch off and then after it, I would put it back on. (The switch would actually be put on without even having the item)

However, that isn't a problem. I believe conditional branches should solve this.
Thanks again!
bro
Is possible to chnge position of Enemy HP Window?
And
Change font size and type for enemy's name aboce hp bars?
acela
Yay finally got the cap I wanted methinks.

Ok to show what I want (IE just an enemy name showing --- it doesn't matter if it doesn't disappear before and after targeting the foe)

General positioning of the party names.

(Yes it's Golden Sun 2 and SHtA. Shh smile.gif )

There general idea across. I hope smile.gif (ie just showing Enemy name rather than hp, and positioning it to where it flushes with each enemy...

the idea is to compensate by moving the name over from the center the more foes are on screen http://www.youtube.com/watch?v=gK3QlHXkovcso it will be flush with the battlers erm... that video though he speeds through should

show you what I mean for when it'd be in battle with numerous battlers :3

Many thanks man biggrin.gif
(yeah just name showing up and it can stay there permanently smile.gif ) No HP or Status shown.

Now off to explain what I mean for battle status biggrin.gif
Skyhunter
Umm, when an enemy is hidden it still shows his name and HP.
jens009
QUOTE (Skyhunter @ Oct 15 2008, 04:42 AM) *
Umm, when an enemy is hidden it still shows his name and HP.

This is one bug I have yet to fix. Expect a new version up on soon
tobster12
awesome! about time someone made one of these scripts! =D
Bleud
Howdy! I was wondering if it's possible to make the script compatible with syvkal's ring bars? Like a patch that will make it more plug and play
Mr. Pyder
Yo, awesome script! Very useful! happy.gif

Just wondering though, since i'm a noob at scripts, but how can I make it use the slanted bar system made by Kylock? I have it now as well as yours and it just displays the normal bar in battle. I'm sure it's possible, just like with Woratana's Neo Gauge system.

Thanks again for the script. happy.gif
hitokiri
Mind if I use it in a commercial? huh.gif
Paper PokéMaster
I love this HP Bar script! I'm using it in my game! Thank you for making it.
KentaAmon
I realize this threads activity is pretty dead but I finally got ahold of this script and Seeing it I love it but when I try to implement it in my game.. Well..

Thanks for the Script biggrin.gif but theres an issue

I get this error when I try to activate it Via Call script



Anyone know why I get that error sad.gif

I am using Kaduki Tatenkai (SP) script =/

I doubt Ill find any help lol
ArdRhys
How exactlly would you do that? I suck at scripting dude.(turn off/on)
GrandMasterTrea
The bar is only shown during a Battletest.
Why is this?
oreick2
Alright, so do you just paste this script in "Materials"? If so, absolutly nothing is showing up -_-
Xeyla
PLEASE use a spoiler tag for scripts. Its very annoying to scroll down a full page of a script to get to the next post.
oreick2
How do i use a spoiler scrpit? =( i trid to find it and i was like wow, thats gotta be reallllly annoying to whoever comes down this page. Sorry about that.
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.