Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> Jens009's Enemy HP Window, Show enemy's HP during battle
jens009
post Jul 29 2008, 01:01 AM
Post #1


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




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:


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


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
 
Start new topic
Replies
jens009
post May 2 2010, 02:45 PM
Post #2


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




QUOTE (ZeroManArmy @ May 1 2010, 08:24 PM) *
Is it possible to get this to to work with Syvkal's Menu Bars? Also is there another way to make the word H to HP

CODE
#======================================================
==========
==============
# ** Syvkal's Menu Bars
#------------------------------------------------------------------------------
# by Syvkal
# Version 4.1
# 05-20-08
#==============================================================================
#
# - INTRODUCTION -
#
# This system implements a series of Plug 'N' Play Menu Bars
# The Bars were inspired CogWheel, but all coding was done by me
# ( Except Wortana's 'gradient_fill_rect' Bug Fix )
#
#------------------------------------------------------------------------------
#
# - USAGE -
#
# This system will work as soon as you put it in the Script Editor
# You can edit the script from the Configuration System
# However, it has also been made so you can easily make your own bars
#
# ---------------------------------------------------
#
# To draw a bar use:
# draw_custom_gauge
#
# Followed by:
# (value, max, x, y, color1, color2, width, height, slanted, up)
#
# value : bar calculation value
# max : bar max value
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# color1 : bar gradient color 1 EITHER Color.new(r,g,b,a)
# color2 : bar gradient color 2 OR Numeric Text color
# width : Width
# height : Height
# slanted : draw slanted bar
# vertical : draw bar vertically
#
# ---------------------------------------------------
#
# To draw a ring use:
# draw_custom_ring
#
# Followed by:
# (value, max, x, y, color1, color2, radius, height, amount, start, reverse)

# value : bar calculation value
# max : bar max value
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# color1 : bar gradient color 1
# color2 : bar gradient color 2
# radius : distance from center point
# height : Height
# amount : size of ring - default 360�
# start : start position - max 360�
# reverse : draw ring in reverse
#
#------------------------------------------------------------------------------
#
# - SCRIPTERS USAGE -
#
# I have added a few extra features to allow scripters to easily use the bars
# Seeing as the bars can be drawn Normal, Vertical or in a Ring I've added a
# feature to allow you to turn off the bars when drawing an actors HP, MP etc.
# When drawing an actors HP etc. simply add 'true' on the end. Like this:
# draw_actor_hp(actor, x, y, width, true)
#
# I've also separated the different bars so they're easier to draw
#
# draw_actor_hp_gauge(actor, x, y, width) Will draw a normal bar
# draw_actor_hp_gauge(actor, x, y, width, true) Will draw a vertical bar
# draw_actor_hp_ring(actor, x, y, radius, height, amount, start)
# Will draw a ring
#
#------------------------------------------------------------------------------
#
# - SCRIPT CALLS -
#
# There are no script calls necessary to enable this script
# However, you can change any of the constants in game if you wish
# This can be done by the Script Call Funtion in an event
#
# For example:
# COG::HPMPSLANT = true
#
# Will make the HP and MP bars Slant
# And setting it to false will turn them back to normal
#
#==============================================================================
module BAR
#===================================================#
# ** C O N F I G U R A T I O N S Y S T E M ** #
#===================================================#

# Parameter Max Value
P_MAX = 500
# The system uses a 'rate' feature. It is set when drawing a bar
# The 'rate' is how much the bar is filled as a decimal (max : 1)
# This is used to enable color change as the bar decreased in amount
$rate = 0 # Don't touch this
# The system uses a series of CONSTANTS that can be edited here
# They control the basic gauge colors and the manner the gauge is filled:

# Gauge Border Colors
COLOR1 = Color.new(0, 0, 0, 192) # Outer Border
COLOR2 = Color.new(255, 255, 192, 192) # Inner Border
# Gauge Empty filler
COLOR3 = Color.new(0, 0, 0, 12) # Half of Inner Shading
COLOR4 = Color.new(64, 0, 0, 92) # Half of Inner Shading
# Gauge Settings
EMPTY = false # EMPTY gauge (false - Side : true - Vertical)
FILLER = false # FILLER gauge (false - Side : true - Vertical)
# Border Settings - Applies only to standard bars
CORNER = false # Remove corners?

# The Parameter colors can be text colors taken from the windowskin or
# colors like above. You don't need set your own 'rate' functions
# it does it for you
# Parameter Gauge Color1
ATKCOLOR1 = 2
DEFCOLOR1 = 17
SPICOLOR1 = 30
AGICOLOR1 = 12
# Parameter Gauge Color2
ATKCOLOR2 = 20
DEFCOLOR2 = 21
SPICOLOR2 = 31
AGICOLOR2 = 4

# The system has been made to use a series of SWITCHES that can be edited here
# They control whether certain Bars are Normal or Slanted:

HPMPSLANT = false # Slanted HP and MP Bars?
EXPSLANT = false # Slanted Exp Bars?
PARSLANT = false # Slanted Parameter Bars?
DVVLBSLANT = true # Slanted Limit Break Bars?

#===================================================#
# ** C O M P L E X C O N F I G U R A T I O N ** #
#===================================================#

# The system allows you to edit the main gauge colous from here
# Functions had to be used instead of Constants so the $rate feature still works
# Edit only if you know what you're doing:

def self::hpcolor1 # HP Guage Color1
return Color.new(80 - 24 * $rate, 80 * $rate, 14 * $rate, 192)
end
def self::hpcolor2 # HP Guage Color2
return Color.new(240 - 72 * $rate, 240 * $rate, 62 * $rate, 192)
end
def self::mpcolor1 # MP Guage Color1
return Color.new(14 * $rate, 80 - 24 * $rate, 80 * $rate, 192)
end
def self::mpcolor2 # MP Guage Color2
return Color.new(62 * $rate, 240 - 72 * $rate, 240 * $rate, 192)
end
def self::expcolor1 # EXP Guage Color1
Color.new(80 * $rate, 80 - 80 * $rate ** 2, 80 - 80 * $rate, 192)
end
def self::expcolor2 # EXP Guage Color2
Color.new(240 * $rate, 240 - 240 * $rate ** 2, 240 - 240 * $rate, 192)
end
#===================================================#
# ** E N D C O N F I G U R A T I O N ** #
#===================================================#
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# Added EXP and Next Level EXP for numeric for calculations
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Get EXP - numeric for calculations
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get Next Level EXP - numeric for calculations
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# Added the 'Draw' functions for each gauge
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Includes The BAR Module
#--------------------------------------------------------------------------
include BAR
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias draw_actor_parameter_original draw_actor_parameter
#--------------------------------------------------------------------------
# * Draw HP gauge
# vertical : draw bar vertically
#--------------------------------------------------------------------------
def draw_actor_hp_gauge(actor, x, y, width = 120, vertical = false)
$rate = actor.hp.to_f / actor.maxhp
gw = width * actor.hp / actor.maxhp
w = vertical ? 6 : width; h = vertical ? width : 6
HPMPSLANT ? self.contents.cogwheel_fill_slant(x, y + WLH - 8, gw, w, h, BAR::hpcolor1, BAR::hpcolor2, vertical) :
self.contents.cogwheel_fill_rect(x, y + WLH - 8, gw, w, h, BAR::hpcolor1, BAR::hpcolor2, vertical)
end
#--------------------------------------------------------------------------
# * Draw MP gauge
# vertical : draw bar vertically
#--------------------------------------------------------------------------
def draw_actor_mp_gauge(actor, x, y, width = 120, vertical = false)
$rate = actor.mp.to_f / [actor.maxmp, 1].max
gw = width * actor.mp / [actor.maxmp, 1].max
w = vertical ? 6 : width; h = vertical ? width : 6
HPMPSLANT ? self.contents.cogwheel_fill_slant(x, y + WLH - 8, gw, w, h, BAR::mpcolor1, BAR::mpcolor2, vertical) :
self.contents.cogwheel_fill_rect(x, y + WLH - 8, gw, w, h, BAR::mpcolor1, BAR::mpcolor2, vertical)
end
#--------------------------------------------------------------------------
# * Draw Exp gauge
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : Width
# vertical : draw bar vertically
#--------------------------------------------------------------------------
def draw_actor_exp_gauge(actor, x, y, width = 170, vertical = false)
$rate = actor.now_exp.to_f / [actor.next_exp, 1].max
gw = width * actor.now_exp / [actor.next_exp, 1].max
w = vertical ? 6 : width; h = vertical ? width : 6
EXPSLANT ? self.contents.cogwheel_fill_slant(x, y + WLH - 8, gw, w, h, BAR::expcolor1, BAR::expcolor2, vertical) :
self.contents.cogwheel_fill_rect(x, y + WLH - 8, gw, w, h, BAR::expcolor1, BAR::expcolor2, vertical)
end
#--------------------------------------------------------------------------
# * Draw Parameters
# hide_bar : draw Parameters without gauge
#--------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type, hide_bar = false)
hide_bar ? nil : draw_actor_parameter_gauge(actor, x, y, type)
draw_actor_parameter_original(actor, x, y, type)
end
#--------------------------------------------------------------------------
# * Draw Parameters gauge
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : Type of parameters (0-3)
# width : Width
# vertical : draw bar vertically
#--------------------------------------------------------------------------
def draw_actor_parameter_gauge(actor, x, y, type, width = 160, vertical = false)
case type
when 0
e1 = actor.atk
gc1 = ATKCOLOR1.is_a?(Integer) ? text_color(ATKCOLOR1) : ATKCOLOR1
gc2 = ATKCOLOR2.is_a?(Integer) ? text_color(ATKCOLOR2) : ATKCOLOR2
when 1
e1 = actor.def
gc1 = DEFCOLOR1.is_a?(Integer) ? text_color(DEFCOLOR1) : DEFCOLOR1
gc2 = DEFCOLOR2.is_a?(Integer) ? text_color(DEFCOLOR2) : DEFCOLOR2
when 2
e1 = actor.spi
gc1 = SPICOLOR1.is_a?(Integer) ? text_color(SPICOLOR1) : SPICOLOR1
gc2 = SPICOLOR2.is_a?(Integer) ? text_color(SPICOLOR2) : SPICOLOR2
when 3
e1 = actor.agi
gc1 = AGICOLOR1.is_a?(Integer) ? text_color(AGICOLOR1) : AGICOLOR1
gc2 = AGICOLOR2.is_a?(Integer) ? text_color(AGICOLOR2) : AGICOLOR2
end
e2 = P_MAX
rate = [e1.to_f / e2.to_f, 1].min
gw = width * [e1.to_f / e2.to_f, 1].min
r = gc2.red * rate
g = (gc2.green - 72) * rate
b = gc2.blue * rate
a = gc2.alpha
w = vertical ? 6 : width; h = vertical ? width : 6
PARSLANT ? self.contents.cogwheel_fill_slant(x, y + WLH - 8, gw, w, h, gc1, Color.new(r, g, b, a), vertical) :
self.contents.cogwheel_fill_rect(x, y + WLH - 8, gw, w, h, gc1, Color.new(r, g, b, a), vertical)
end
#--------------------------------------------------------------------------
# * Draw Custom gauge
# value : bar calculation value
# max : bar max value
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# color1 : bar gradient color 1
# color2 : bar gradient color 2
# width : Width
# height : Height
# slanted : draw slanted bar
# vertical : draw bar vertically
#--------------------------------------------------------------------------
def draw_custom_gauge(value, max, x, y, color1, color2, width=120, height=6, slanted = false, vertical = false)
rate = [value.to_f / max.to_f, 1].min
gw = width * [value.to_f / max.to_f, 1].min
gc1 = color1.is_a?(Integer) ? text_color(color1) : color1
gc2 = color2.is_a?(Integer) ? text_color(color2) : color2
r = gc2.red * rate
g = (gc2.green - 72) * rate
b = gc2.blue * rate
a = gc2.alpha
w = vertical ? 6 : width; h = vertical ? width : 6
slanted ? self.contents.cogwheel_fill_slant(x, y + WLH - 8, gw, w, h, gc1, Color.new(r, g, b, a), vertical) :
self.contents.cogwheel_fill_rect(x, y + WLH - 8, gw, w, h, gc1, Color.new(r, g, b, a), vertical)
end
#--------------------------------------------------------------------------
# * Draw Limit Break gauge
# vertical : draw bar vertically
#--------------------------------------------------------------------------
def draw_actor_lb(actor, x, y, width = 120, vertical = false)
return unless actor.lb_gauge_visible?
st1 = lb_gauge_normal_start_color; st2 = lb_gauge_max_start_color
ed1 = lb_gauge_normal_end_color; ed2 = lb_gauge_max_end_color
rate = actor.limitbreak.to_f / [LB_MAX, 1].max
gw = width * actor.limitbreak / LB_MAX
gc1 = (gw == width ? st2 : Color.new(st1.red,st1.green-(10*rate),st1.blue-(10*rate), 192))
gc2 = (gw == width ? ed2 : Color.new(ed1.red,ed1.green-(10*rate),ed1.blue-(10*rate), 192))
w = vertical ? 6 : width; h = vertical ? width : 6
DVVLBSLANT ? self.contents.cogwheel_fill_slant(x, y + WLH - 8, gw, w, h, gc1, gc2, vertical) :
self.contents.cogwheel_fill_rect(x, y + WLH - 8, gw, w, h, gc1, gc2, vertical)
end
#--------------------------------------------------------------------------
# * Draw HP gauge ring
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# radius : distance from center point
# height : Height
# amount : size of ring - default 360�
# start : start position - max 360�
# reverse : draw ring in reverse
#--------------------------------------------------------------------------
def draw_actor_hp_ring(actor, x, y, radius, height, amount = 360, start = 0, reverse = false)
$rate = actor.hp.to_f / actor.maxhp
gw = amount * actor.hp / actor.maxhp
self.contents.cogwheel_fill_ring(x, y, gw, radius, height, BAR::hpcolor1, BAR::hpcolor2, amount, start, reverse)
end
#--------------------------------------------------------------------------
# * Draw MP gauge ring
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# radius : distance from center point
# height : Height
# amount : size of ring - default 360�
# start : start position - max 360�
# reverse : draw ring in reverse
#--------------------------------------------------------------------------
def draw_actor_mp_ring(actor, x, y, radius, height, amount = 360, start = 0, reverse = false)
$rate = actor.mp.to_f / [actor.maxmp, 1].max
gw = amount * actor.mp / [actor.maxmp, 1].max
self.contents.cogwheel_fill_ring(x, y, gw, radius, height, BAR::mpcolor1, BAR::mpcolor2, amount, start, reverse)
end
#--------------------------------------------------------------------------
# * Draw Exp gauge ring
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# radius : distance from center point
# height : Height
# amount : size of ring - default 360�
# start : start position - max 360�
# reverse : draw ring in reverse
#--------------------------------------------------------------------------
def draw_actor_exp_ring(actor, x, y, radius, height, amount = 360, start = 0, reverse = false)
$rate = actor.now_exp.to_f / [actor.next_exp, 1].max
gw = amount * actor.now_exp / [actor.next_exp, 1].max
self.contents.cogwheel_fill_ring(x, y, gw, radius, height, BAR::expcolor1, BAR::expcolor2, amount, start, reverse)
end
#--------------------------------------------------------------------------
# * Draw Custom gauge ring
# value : bar calculation value
# max : bar max value
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# color1 : bar gradient color 1
# color2 : bar gradient color 2
# radius : distance from center point
# height : Height
# amount : size of ring - default 360�
# start : start position - max 360�
# reverse : draw ring in reverse
#--------------------------------------------------------------------------
def draw_custom_ring(value, max, x, y, color1, color2, radius, height, amount = 360, start = 0, reverse = false)
rate = [value.to_f / max.to_f, 1].min
gw = amount * [value.to_f / max.to_f, 1].min
gc1 = color1.is_a?(Integer) ? text_color(color1) : color1
gc2 = color2.is_a?(Integer) ? text_color(color2) : color2
r = gc2.red * rate
g = (gc2.green - 72) * rate
b = gc2.blue * rate
a = gc2.alpha
self.contents.cogwheel_fill_ring(x, y, gw, radius, height, gc1, Color.new(r, g, b, a), amount, start, reverse)
end
#--------------------------------------------------------------------------
# * Draw HP
# hide_bar : draw Parameters without gauge
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 120, hide_bar = false)
hide_bar ? nil : draw_actor_hp_gauge(actor, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a)
self.contents.font.color = hp_color(actor)
last_font_size = self.contents.font.size
xr = x + width
if width < 120
self.contents.draw_text(xr - 44, y, 44, WLH, actor.hp, 2)
else
self.contents.draw_text(xr - 99, y, 44, WLH, actor.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, actor.maxhp, 2)
end
end
#--------------------------------------------------------------------------
# * Draw MP
# hide_bar : draw Parameters without gauge
#--------------------------------------------------------------------------
def draw_actor_mp(actor, x, y, width = 120, hide_bar = false)
hide_bar ? nil : draw_actor_mp_gauge(actor, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, WLH, Vocab::mp_a)
self.contents.font.color = mp_color(actor)
last_font_size = self.contents.font.size
xr = x + width
if width < 120
self.contents.draw_text(xr - 44, y, 44, WLH, actor.mp, 2)
else
self.contents.draw_text(xr - 99, y, 44, WLH, actor.mp, 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, actor.maxmp, 2)
end
end
#--------------------------------------------------------------------------
# * Draw Exp
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : Width
# hide_bar : draw Parameters without gauge
#--------------------------------------------------------------------------
def draw_actor_exp(actor, x, y, width = 170, hide_bar = false)
hide_bar ? nil : draw_actor_exp_gauge(actor, x, y, width)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 45, WLH, "Exp")
self.contents.font.color = normal_color
xr = x + width
if width < 170
self.contents.draw_text(xr - 60, y, 60, WLH, actor.next_rest_exp_s, 2)
else
self.contents.draw_text(xr - 131, y, 60, WLH, actor.exp_s, 2)
self.contents.draw_text(xr - 71, y, 11, WLH, "/", 2)
self.contents.draw_text(xr - 60, y, 60, WLH, actor.next_exp_s, 2)
end
end
end
#==============================================================================
# ** Window_SkillStatus
#------------------------------------------------------------------------------
# Edited so te Bars don't cut off
#==============================================================================
class Window_SkillStatus < Window_Base
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 140, 0)
draw_actor_hp(@actor, 238, 0)
draw_actor_mp(@actor, 390, 0)
end
end
#==============================================================================
# ** Bitmap
#------------------------------------------------------------------------------
# Added gauge Calculations
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# * Includes The BAR Module
#--------------------------------------------------------------------------
include BAR
#--------------------------------------------------------------------------
# * Wortana's 'gradient_fill_rect' Bug Fix
#--------------------------------------------------------------------------
alias gradient_original gradient_fill_rect unless method_defined?('gradient_original')
def gradient_fill_rect(*args)
args.pop if !args.last if args.size == 4 || 7 and !args.last
gradient_original(*args)
end
#--------------------------------------------------------------------------
# * CogWheel Style Fill of Rect
#--------------------------------------------------------------------------
def cogwheel_fill_rect(x, y, gw, width, height, gc1, gc2, up = false)
rect_border(x-2, y-2, width+4, height+4, COLOR1, CORNER)
rect_border(x-1, y-1, width+2, height+2, COLOR2, CORNER)
gradient_fill_rect(x, y, width, height, COLOR3, COLOR4, EMPTY)
gradient_fill_rect(x, y, up ? width : gw, up ? gw : height, gc1, gc2, FILLER)
end
#--------------------------------------------------------------------------
# * CogWheel Style Fill of Slanted Rect
#--------------------------------------------------------------------------
def cogwheel_fill_slant(x, y, gw, width, height, gc1, gc2, up = false)
bgx = up ? 2 : 4; bdx = up ? 1 : 2
bgy = up ? 4 : 2; bdy = up ? 2 : 1
bgw = up ? 4 : 8; bdw = up ? 2 : 4
bgh = up ? 8 : 4; bdh = up ? 4 : 2
slant_border(x-bgx, y-bgy, width+bgw, height+bgh, COLOR1, up)
slant_border(x-bdx, y-bdy, width+bdw, height+bdh, COLOR2, up)
gradient_fill_slant(x, y, width, height, COLOR3, COLOR4, EMPTY, up)
gradient_fill_slant(x, y,up ? width : gw,up ? gw : height, gc1, gc2, FILLER, up)
end
#--------------------------------------------------------------------------
# * CogWheel Style Fill of Ring
#--------------------------------------------------------------------------
def cogwheel_fill_ring(x, y, gw, radius, height, gc1, gc2, amount = 360, start = 0, reverse = false)
fill_ring(x-2, y-2, radius, height+4, COLOR1, amount, start, reverse)
fill_ring(x-1, y-1, radius, height+2, COLOR2, amount, start, reverse)
if amount >= 220
gradient_fill_ring(x, y, radius, height, COLOR3, COLOR4, [amount/2, 180].min, start, reverse)
gradient_fill_ring(x, y, radius, height, COLOR4, COLOR3, [amount/2, 180].min, start+(amount/2), reverse)
else
gradient_fill_ring(x, y, radius, height, COLOR3, COLOR4, [amount, 360].min, start, reverse)
end
if gw >= 220
gw1 = amount/2; gw2 = gw / 2
gradient_fill_ring(x, y, radius, height, gc1, gc2, gw1, start, reverse)
gradient_fill_ring(x, y, radius, height, gc2, gc1, gw2, start +(amount/2), reverse)
else
gradient_fill_ring(x, y, radius, height, gc1, gc2, gw, start, reverse)
end
end
#--------------------------------------------------------------------------
# * Fill of Border
#--------------------------------------------------------------------------
def rect_border(x, y, width, height, gc1, edge = false)
fill_rect(x + (edge ? 1 : 0), y, width - (edge ? 2 : 0), 2, gc1)
fill_rect(x + (edge ? 1 : 0), y+(height-2), width - (edge ? 2 : 0), 2, gc1)
fill_rect(x, y+1, 2, height-2, gc1)
fill_rect(x +(width-2), y+1, 2, height-2, gc1)
end
#--------------------------------------------------------------------------
# * Gradient Fill of Slanted Rect
#--------------------------------------------------------------------------
def gradient_fill_slant(x, y, width, height, gc1, gc2, vertical = false, up = false)
if up
for i in 1..width
if vertical
gradient_fill_rect(x + width - i, y+i+1, 1, (height-2)-width, gc1, gc2, vertical)
else
color = get_gradient_pixel(gc1, gc2, width, i)
fill_rect(x + width - i, y+i+1, 1, (height-2)-width, color)
end
end
else
for i in 1..height
if vertical
color = get_gradient_pixel(gc1, gc2, height, i)
fill_rect(x+i+1, y + height - i, (width-2)-height, 1, color)
else
gradient_fill_rect(x+i+1, y + height - i, (width-2)-height, 1, gc1, gc2)
end
end
end
end
#--------------------------------------------------------------------------
# * Fill of Slanted Rect
#--------------------------------------------------------------------------
def fill_slant(x, y, width, height, gc1, up = false)
oh = up ? width : height
for i in 1..oh
if up
fill_rect(x + width -i, y+i, 1, height-width, gc1)
else
fill_rect(x+i, y + height -i, width-height, 1, gc1)
end
end
end
#--------------------------------------------------------------------------
# * Fill of Slanted Border
#--------------------------------------------------------------------------
def slant_border(x, y, width, height, gc1, up = false)
oh = up ? width : height
for i in 1..oh-2
if up
fill_rect(x + width-1 -i, y+((height-1)-width)+i, 1, 2, gc1)
fill_rect(x + width-1 -i, y+1+i, 1, 2, gc1)
fill_rect(x + width-1, y+1, 1, height-width, gc1)
fill_rect(x, y+width, 1, height-width, gc1)
else
fill_rect(x+((width-1)-height)+i, y + height-1 -i, 2, 1, gc1)
fill_rect(x+1+i, y + height-1 -i, 2, 1, gc1)
fill_rect(x+1, y + height -1, width-height, 1, gc1)
fill_rect(x+height, y, width-height, 1, gc1)
end
end
end
#--------------------------------------------------------------------------
# * Fill of Ring
#--------------------------------------------------------------------------
def fill_ring(ox, oy, radius, height, gc1, amount = 360, start = 0, reverse = false)
d = 2.0 * Math:tongue.gifI / 360
for i in 1..[amount, 360].min
s = i + start
if reverse
x = ox + ( radius * Math.sin( d * s ) ).to_i
y = oy - ( radius * Math.cos( d * s ) ).to_i
else
x = ox - ( radius * Math.cos( d * s ) ).to_i
y = oy + ( radius * Math.sin( d * s ) ).to_i
end
fill_rect(x, y, height, height, gc1)
end
end
#--------------------------------------------------------------------------
# * Gradient Fill of Ring
#--------------------------------------------------------------------------
def gradient_fill_ring(ox, oy, radius, height, gc1, gc2, amount = 360, start = 0, reverse = false)
d = 2.0 * Math:tongue.gifI / 360
for i in 1..amount
s = i + start
if reverse
x = ox + ( radius * Math.sin( d * s ) ).to_i
y = oy - ( radius * Math.cos( d * s ) ).to_i
else
x = ox - ( radius * Math.cos( d * s ) ).to_i
y = oy + ( radius * Math.sin( d * s ) ).to_i
end
color = get_gradient_pixel(gc1, gc2, amount, i)
fill_rect(x, y, height, height, color)
end
end
#--------------------------------------------------------------------------
# * Get Pixel Color for Gradient Fill
#--------------------------------------------------------------------------
def get_gradient_pixel(gc1, gc2, amount, i)
red = gc1.red * (amount - i) / amount + gc2.red * i / amount
green = gc1.green * (amount - i) / amount + gc2.green * i / amount
blue = gc1.blue * (amount - i) / amount + gc2.blue * i / amount
alpha = gc1.alpha * (amount - i) / amount + gc2.alpha * i / amount
return Color.new(red, green, blue, alpha)
end
end


Yeap. If I remember correctly, Syvkal's scripts have different types of bars you can use. All you have to edit is the gauge section:
CODE
  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

The calculations are already done, you just have to implement Syvkal's bars here.


QUOTE (SlyCooperFan1 @ May 2 2010, 02:45 PM) *
Oh...where is the script? I searched here but couldn't find it.

I just looked at the RGSS2 Scripting List. Here you go:
http://www.rpgrevolution.com/forums/index....showtopic=12014

Paste the script above my enemy HP window.


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   

Posts in this topic
- jens009   Jens009's Enemy HP Window   Jul 29 2008, 01:01 AM
- - Grandhoug   since im most likey first to try i'll give u f...   Jul 29 2008, 01:05 AM
|- - Grandhoug   works just fine from wat i can tell but im not 100...   Jul 29 2008, 01:28 AM
|- - jens009   QUOTE (Grandhoug @ Jul 29 2008, 01:50 AM)...   Jul 29 2008, 01:29 AM
|- - Grandhoug   QUOTE (jens009 @ Jul 29 2008, 04:51 AM) Q...   Jul 29 2008, 09:13 AM
- - link245   Thanks a lot jens009 for this script I've been...   Jul 29 2008, 09:26 AM
- - jens009   QUOTE (Grandhoug @ Jul 29 2008, 09:35 AM)...   Jul 29 2008, 09:32 AM
- - Rikufan12   This is great and I have no idea why this isn...   Jul 29 2008, 01:09 PM
|- - jens009   QUOTE (Rikufan12 @ Jul 29 2008, 01:31 PM)...   Jul 29 2008, 02:48 PM
|- - RisingPhoenix   QUOTE (jens009 @ Jul 29 2008, 03:10 PM) Q...   Jul 29 2008, 06:22 PM
|- - jens009   QUOTE (RisingPhoenix @ Jul 29 2008, 06:44...   Jul 29 2008, 08:26 PM
- - andani   Very neat script. I was wondering when this kind o...   Jul 30 2008, 10:14 PM
|- - jens009   QUOTE (andani @ Jul 30 2008, 10:36 PM) Ve...   Jul 30 2008, 11:31 PM
- - andani   Dude, you are the greatest. Thanks so much for wor...   Aug 1 2008, 04:38 PM
- - NDoerrFans   All right, I admit, I'm a complete scripting n...   Aug 5 2008, 12:15 AM
|- - jens009   QUOTE (NDoerrFans @ Aug 5 2008, 12:37 AM)...   Aug 5 2008, 12:16 AM
- - NDoerrFans   QUOTE Lol. It's fine if you don't no anyth...   Aug 5 2008, 12:30 AM
- - lahandi   Jens, I wonder if you could made a switch on/off f...   Aug 5 2008, 09:31 AM
|- - jens009   QUOTE (lahandi @ Aug 5 2008, 09:53 AM) Je...   Aug 5 2008, 11:26 AM
- - lahandi   QUOTE (jens009 @ Aug 6 2008, 01:48 AM) Be...   Aug 7 2008, 11:05 PM
|- - acela   Yay finally got the cap I wanted methinks. Ok to...   Oct 3 2008, 08:12 PM
|- - ArdRhys   How exactlly would you do that? I suck at scripti...   Jun 2 2009, 02:50 PM
- - Fade   Cool script. I was wondering ..... is there any w...   Aug 8 2008, 06:09 AM
|- - jens009   QUOTE (Fade @ Aug 8 2008, 06:31 AM) Cool ...   Aug 8 2008, 10:26 AM
- - jens009   Update! Version 1.2 is posted Here's a li...   Aug 8 2008, 06:13 PM
- - lahandi   Jens, in your v1.1 script. Do the script able to h...   Aug 19 2008, 10:03 AM
- - CaptainWinky   Good Script. Suggestion; Add customization for te...   Aug 20 2008, 05:17 AM
- - meganew2   Looks good..... This script can be very useful for...   Aug 20 2008, 05:32 AM
- - jens009   QUOTE (lahandi @ Aug 19 2008, 10:25 AM) J...   Aug 20 2008, 10:21 PM
- - bro   Is possible to turn off number of enemy hp?   Aug 27 2008, 12:19 PM
- - jens009   QUOTE is possible to turn off number of enemy hp? ...   Aug 27 2008, 07:06 PM
- - sogekishu   Hey, i just wondered if you could give me a little...   Aug 28 2008, 04:43 AM
- - Twilight27   Jens, have you ever played Zelda: Wind Waker? Do y...   Aug 28 2008, 07:23 AM
- - jens009   QUOTE (sogekishu @ Aug 28 2008, 05:05 AM)...   Aug 28 2008, 06:07 PM
- - Twilight27   Thanks very much jen. I love this script now! ...   Aug 28 2008, 07:45 PM
|- - jens009   QUOTE (Twilight27 @ Aug 28 2008, 08:07 PM...   Aug 28 2008, 08:32 PM
|- - Twilight27   QUOTE (jens009 @ Aug 28 2008, 11:54 PM) Q...   Aug 29 2008, 06:33 AM
- - bro   Is possible to chnge position of Enemy HP Window? ...   Aug 31 2008, 01:58 PM
- - Skyhunter   Umm, when an enemy is hidden it still shows his na...   Oct 15 2008, 03:42 AM
|- - jens009   QUOTE (Skyhunter @ Oct 15 2008, 04:42 AM)...   Oct 16 2008, 05:21 PM
- - tobster12   awesome! about time someone made one of these ...   Oct 20 2008, 08:17 AM
- - Bleud   Howdy! I was wondering if it's possible to...   Apr 19 2009, 09:47 AM
- - Mr. Pyder   Yo, awesome script! Very useful! Jus...   Apr 25 2009, 02:19 PM
- - hitokiri   Mind if I use it in a commercial?   May 5 2009, 06:46 PM
- - Paper PokéMaster   I love this HP Bar script! I'm using it in...   May 10 2009, 01:42 PM
- - KentaAmon   I realize this threads activity is pretty dead but...   Jun 1 2009, 09:06 PM
- - GrandMasterTrea   The bar is only shown during a Battletest. Why is ...   Jul 1 2009, 06:42 AM
|- - oreick2   QUOTE (GrandMasterTrea @ Jul 1 2009, 06:4...   Jul 23 2009, 08:35 AM
- - oreick2   Alright, so do you just paste this script in ...   Jul 12 2009, 06:31 PM
- - xeyla   PLEASE use a spoiler tag for scripts. Its very ann...   Jul 13 2009, 01:59 AM
- - oreick2   How do i use a spoiler scrpit? =( i trid to find i...   Jul 13 2009, 03:06 PM
- - xeyla   How to use a spoiler: You can use either circled ...   Jul 15 2009, 02:18 AM
- - oreick2   Thanks Xeyla, sorry about that massive script i pu...   Jul 17 2009, 07:46 AM
- - DLuna3   Okay, I had this script for a long time. Athough o...   Jul 23 2009, 08:35 AM
- - cyrtii   Is it possible to make the bar appear under the mo...   Aug 19 2009, 08:50 AM
|- - jens009   QUOTE (cyrtii @ Aug 19 2009, 09:50 AM) Is...   Aug 19 2009, 09:13 PM
- - cyrtii   @jens009 it gives an error: "undifined method...   Aug 20 2009, 09:53 AM
|- - jens009   QUOTE (cyrtii @ Aug 20 2009, 10:53 AM) @j...   Aug 20 2009, 10:52 PM
|- - cyrtii   QUOTE (jens009 @ Aug 21 2009, 08:52 AM) Q...   Aug 21 2009, 01:17 AM
- - platipus   can you make one only for boss hp? x]   Aug 20 2009, 10:14 AM
- - cyrtii   You can do that by using the Switch option, it onl...   Aug 20 2009, 10:24 AM
- - platipus   @cyrtii ok kool, i'll try that :]   Aug 20 2009, 11:01 AM
- - asherty   Where am I suppsoe to paste this I am a noob scrip...   Oct 10 2009, 05:41 AM
- - Xzygon   Plug and Play usually means Materials. You should ...   Oct 10 2009, 08:54 PM
- - Locke   Nice script may as well copy the script and paste ...   Oct 17 2009, 10:28 AM
- - new   is it possible to just show the window when you pr...   Oct 19 2009, 06:38 PM
- - ZeroManArmy   Can some one just post it so all i have to do is p...   Oct 29 2009, 06:35 PM
- - matrox89   finally! ive been looking for this evry where...   Nov 20 2009, 10:14 AM
- - mmwsfz   Hey Jens, I love this script very much. But is it ...   Apr 20 2010, 05:54 AM
- - SlyCooperFan1   I don't get what I'm doing wrong. I put th...   May 1 2010, 10:59 AM
|- - jens009   QUOTE Hey Jens, I love this script very much. But ...   May 1 2010, 04:44 PM
|- - SlyCooperFan1   QUOTE (jens009 @ May 1 2010, 08:44 PM) QU...   May 2 2010, 01:45 PM
- - ZeroManArmy   RE: Jens009's Enemy HP Window   May 1 2010, 07:24 PM
- - jens009   RE: Jens009's Enemy HP Window   May 2 2010, 02:45 PM
- - ZeroManArmy   How do I add the bars in? Im newbie script person.   May 4 2010, 02:11 PM
- - SlyCooperFan1   Okay, I'm seriously lost. The patch is in the ...   May 5 2010, 07:35 PM
- - new   is it possible that the Enemy HP would only be sho...   Jun 17 2010, 11:19 PM
- - Akroona_Shadow_of_Death   I was wondering if there is a way to remove the me...   Jul 27 2010, 03:39 PM
- - Haku   Hello, how do I put the hp bars below each other a...   Dec 7 2010, 07:50 AM
- - anythingmasterz   Where does the neo health bar extra go in? after a...   Feb 20 2011, 11:32 AM
- - Kread-EX   In a new section after the Enemy HP script.   Feb 20 2011, 12:13 PM
- - darcangel   I know it been 8 months but does enyono know how t...   Oct 7 2011, 01:42 PM
- - TigerPrascire   Code doesn't work, when run all I get is a syn...   Dec 27 2012, 11:06 AM
- - amerk   Please don't necropost, and read the rules bef...   Dec 27 2012, 12:05 PM


Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 24th May 2013 - 09:10 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker