Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Compatibility

Requesting compatibility for 3 battle system addons. (for VX if you didn't see the tag):
Sorry I'll have to double post due to word limit.
Code:
#===============================================================================
# Battle Backgrounds - RMVX
#===============================================================================
# Written by Synthesize
# January 20, 2008
# Version 1.00A
#===============================================================================
#					   * This script is untested. *
#===============================================================================
module SynBattleB
  # Place your battle backgrounds in the 'Pictures' folder (Graphics/Pictures)
  # Format = {map_id => Battleback Name}
  Battle_background = 
  {
  9 => "008-Snowfield01",
  21 => "045-Cave03",
  23 => "008-Snowfield01",
  24 => "043-Cave01",
  25 => "043-Cave01",
  26 => "043-Cave01",
  28 => "008-Snowfield01",
  29 => "008-Snowfield01",
  32 => "039-Tower01",
  40 => "040-Tower02",
  45 => "040-Tower02"
  }
  #-----------------------------------------------------------------------------
  # Create the battlefloor?
  Create_battlefloor = false
  #-----------------------------------------------------------------------------
  # This was being requested on quite a fe forums now, so I threw a quick script
  # together. It is nice and simple, and does what it is suppsoed to do. Once
  # RMVX is released in English, then I will add additional features into this.
  #-----------------------------------------------------------------------------
end
#-------------------------------------------------------------------------------
# Spriteset_Battle
#-------------------------------------------------------------------------------
class Spriteset_Battle
  alias syn_create_battlefloor create_battlefloor
  #-----------------------------------------------------------------------------
  # Create Battleback
  #-----------------------------------------------------------------------------
  def create_battleback
	image = SynBattleB::Battle_background[$game_map.map_id]
	@battleback_sprite = Sprite.new(@viewport1)
	@battleback_sprite.bitmap = Cache.picture(image)
  end
  def create_battlefloor
	@battlefloor_sprite = Sprite.new(@viewport1)
	syn_create_battlefloor if SynBattleB::Create_battlefloor == true
  end
end
#===============================================================================
#						* This script is untested *
#===============================================================================  
# Version 1.00A
# January 20, 2008
# Written by Synthesize
#===============================================================================
# Battle Backgrounds - RMVX
#===============================================================================
 
Code:
#==============================================================================
# ** Actor Battler Graphics
#------------------------------------------------------------------------------
#    by DerVVulfman
#    version 1.0
#    03-01-2008
#    RGSS2
#------------------------------------------------------------------------------
#
#  INTRODUCTION:
#
#  This system permits you to include 'Actor Battler' graphics that were not
#  included in the RPGMaker VX system.   This script mimics many of the lost
#  features, and includes a new one:  Actor Battler Centering.
#  
#------------------------------------------------------------------------------
#
#  USAGE:
#
#  --Positioning--
#   A nice feature to this system  is the ability to adjust the left/right & 
#   up/down position of your battlers.
#
#   Actually, the vertical up/down position  can be adjusted by changing the
#   value of the SCREEN_Y variable.   The left/right positioning is a little
#   different.
#
#   The CENTER_X value is a true/false value  that sets whether the battlers
#   line up from the left and space themselves out  in the manner of the de-
#   fault RPGMaker XP  or whether the system calculates and centers them ac-
#   ross the screen.
#
#   The DEFAULT_X value establishes  how many actors  are typically shown in
#   the battlefield. While this is the default value, the maximum value used
#   can be changed with a script call.
#
#   Finally,  the TRANSPARENT value is another true/false value that you can
#   use to make the battlers lightly transparent until they're about to per-
#   form an attack.  Another feature from RPGMaker XP.
#
#  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
#
#  --The Actor List--
#  This system DOES require you to edit the configuration system to list all
#  of the 'actor' battlers  that you  are using.   It is assumed  that these
#  battlers will be in the  'Graphics\Battlers'  folder with the rest of the
#  enemy battlers.
#
#  Each value in the ACTOR array holds two values:   filename and hue.  This 
#  not only allows you to add battle graphics  for your heroes,  but adjusts
#  the character's hue as well.  If you do not include the hue setting, it
#  goes to the default setting of '0'.
#
#------------------------------------------------------------------------------
#
#  SCRIPT CALLS:
#
#  There's only two script calls that you need to know.
#
#  --Changing Battlers--
#  Given that this system allows you to use 'Actor' battlers, you may find a
#  need to 'change' the battler in-game.  Unfortunately, this cannot be done
#  with a pre-rendered map event, so I had to make a script call:
#
#           $game_actors[ID].set_battler("filename", hue)
#  
#  By using this call, you can change the graphic and hue of a battler while
#  the game is running.  
#
#  As an example:  $game_actors[1].set_battler("Ylva")
#  
#  ...would set actor #1's battler to use "Ylva.png" as the graphic desired.
#  You may note that the 'hue' was not included  in this call.   The default 
#  value of '0' was used.
#
#  NOTE:  Just calling $game_actors[2].set_battler() would erase the battler
#         from actor #2, rendering it invisible on the battlefield.
#
#  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
#
#  --Changing Position Value--
#  This script allows you to have the battlers centered in the battlefield
#  and spaced out evenly.  Under most circumstances, you have four members
#  in your party.  But what if you want to increase the number of members
#  to 5 or 6?
#
#  Now, this system does not increase the number of members in your party,
#  but it is already set up to adjust the spacing of your members in the
#  battlefield.  With a simple script call:
#
#           $game_system.actorbattler_max = 7
#
#  You can make the system space the battlers on the field with the under-
#  standing that up to 7 members are in the party.
#
#------------------------------------------------------------------------------
#
#  EDITS AND MODIFICATIONS:
#  
#  This system Aliases the following methods:
#  * initialize                     (RPG::Actor)
#  * initialize                     (Game_Temp)
#  * initialize                     (Game_System)
#  * initialize                     (Game_Actor)
#  * update                         (Sprite_Battler)
#  * start                          (Scene_Battle)
#  * start_party_command_selection  (Scene_Battle)
#  * process_victory                (Scene_Battle)
#  * execute_action                 (Scene_Battle)
#
#  This system redefines the following methods:
#  * use_sprite?                    (Game_Actor)
#  * create_actors                  (Spriteset_Battle)
#  * update_actors                  (Spriteset_Battle)
#  
#
#------------------------------------------------------------------------------
#
#  TERMS AND CONDITIONS:
#
#  Free to use, even in commercial projects.  Just note that I need some form
#  of due credit... even a mere mention in some end titles.
#
#==============================================================================



#==============================================================================
# ** Actor_Battler Module
#------------------------------------------------------------------------------
#  A module containing configurable data for the Actor Battler Graphic system.
#==============================================================================

module Actor_Battler
  # Actor battler array
  ACTOR = Array.new  # Do not touch -_^

   #========================================================================
   #  **  C  O  N  F  I  G  U  R  A  T  I  O  N      S  Y  S  T  E  M  **  #
   #========================================================================  
  
  # --Positioning-- 
  # Actor Battler positioning system
  #
    CENTER_X    = true    # If true, centers actors rather than default lineup.
    DEFAULT_X   = 4       # Default party Max
    SCREEN_Y    = 435     # Vertical height of battlers
    TRANSPARENT = true    # If true, makes lightly transparent until attacking.
  
    
  # --Actor List--
  # Add your actor battlers here
  #
  # Actor#      Filename,   Hue (optional)
    ACTOR[1] = ["Mick"]
    ACTOR[2] = ["Slime"]
    ACTOR[3] = ["Slime"]
    ACTOR[4] = ["Slime",     0]
    ACTOR[5] = ["Slime", 0]
    ACTOR[6] = ["Slime",    0]
    ACTOR[7] = ["Lock",     0]
    ACTOR[8] = ["Slime",    0]

    
   #========================================================================
   #  **  E  N  D     O  F     C  O  N  F  I  G  U  R  A  T  I  O  N   **  #
   #========================================================================  
end



#==============================================================================
# ** RPG Module
#------------------------------------------------------------------------------
#  A module containing RPGVX Data Structures.
#==============================================================================
module RPG
  #============================================================================
  # ** Actor
  #----------------------------------------------------------------------------
  #  Data class for actors
  #============================================================================  
  class Actor
    #------------------------------------------------------------------------
    # * Alias Listings
    #------------------------------------------------------------------------  
    alias actorbattler_init initialize
    #------------------------------------------------------------------------
    # * Object Initialization
    #------------------------------------------------------------------------  
    def initialize
      # Perform the original call
      actorbattler_init
      @battler_name = ""
      @battler_hue = 0
    end
  end
end



#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
# The instance of this class is referenced by $game_temp.
#==============================================================================

class Game_Temp
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :battle_main_phase        # battle flag: main phase
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------   
  alias actorbattler_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Perform the original call
    actorbattler_initialize
    # Set the main phase flag to false
    @battle_main_phase = false
  end
end



#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :actorbattler_max         # Max. size for centered battlers
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------   
  alias actorbattler_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Perform the original call
    actorbattler_initialize
    # Set 'Centered' battler max to 4 (default)
    @actorbattler_max = Actor_Battler::DEFAULT_X
  end
end



#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------  
  attr_accessor :screen_x                 # battle screen X coordinate
  attr_accessor :screen_y                 # battle screen Y coordinate
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------  
  alias actorbattler_init initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def initialize(actor_id)
    # Perform the original call
    actorbattler_init(actor_id)
    # Apply battler graphic
    @battler_name = Actor_Battler::ACTOR[actor_id][0]
    # Apply battler hue if exists, else default of '0'
    if Actor_Battler::ACTOR[actor_id][1] != nil
      @battler_hue  = Actor_Battler::ACTOR[actor_id][1]
    else
      @battler_hue  = 0
    end
  end
  #--------------------------------------------------------------------------
  # * Change Battler
  #     battler_name  : new battler graphic filename
  #     battler_hue   : new battler hue setting (default = 0)
  #--------------------------------------------------------------------------
  def set_battler(battler_name = "", battler_hue = 0)
    @battler_name = battler_name
    @battler_hue = battler_hue
  end  
  #--------------------------------------------------------------------------
  # * Use Sprites?
  #--------------------------------------------------------------------------
  def use_sprite?
    return true
  end  
  #--------------------------------------------------------------------------
  # * Get Battle Screen X-Coordinate
  #--------------------------------------------------------------------------
  def screen_x
    if self.index != nil
      if Actor_Battler::CENTER_X
        # Return after calculating x-coords of centered party members
        return self.index * (544 / $game_system.actorbattler_max) + 
              ($game_system.actorbattler_max - $game_party.members.size) * 
              (272 / $game_system.actorbattler_max) + 
              (272 / $game_system.actorbattler_max)
      else
        # Return after calculating x-coords of default-aligned party members
        return self.index * 136 + 68
      end
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # * Get Battle Screen Y-Coordinate
  #--------------------------------------------------------------------------
  def screen_y
    return Actor_Battler::SCREEN_Y
  end  
  #--------------------------------------------------------------------------
  # * Get Battle Screen Z-Coordinate
  #--------------------------------------------------------------------------
  def screen_z
    # Return after calculating z-coordinate by order of members in party
    if self.index != nil
      return $game_party.members.size - self.index
    else
      return 0
    end
  end
end



#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
#  This sprite is used to display battlers. It observes a instance of the
# Game_Battler class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Battler < Sprite_Base
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------  
  alias actorbattler_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Perform the original call
    actorbattler_update
    # If the actor battlers are lightly transparent until they act
    if Actor_Battler::TRANSPARENT == true
      # If the battler is a visible actor battler
      if @battler.is_a?(Game_Actor) and @battler_visible
        # Bring opacity level down a bit when not in main phase
        if $game_temp.battle_main_phase
          self.opacity += 3 if self.opacity < 255
        else
          self.opacity -= 3 if self.opacity > 207
        end
      end    
    end
  end
end



#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
#  This class brings together battle screen sprites. It's used within the
# Scene_Battle class.
#==============================================================================

class Spriteset_Battle
  #--------------------------------------------------------------------------
  # * Create Actor Sprite
  #    Removes the 'empty' battler image used by the default system and 
  #    replaces it.  It also observes the actual size of the party and 
  #    not a predetermined 4-party limit.
  #--------------------------------------------------------------------------
  def create_actors
    @actor_sprites = []
    for actor in $game_party.members.reverse
      @actor_sprites.push(Sprite_Battler.new(@viewport2, actor))
    end
  end  
  #--------------------------------------------------------------------------
  # * Update Actor Sprite
  #--------------------------------------------------------------------------
  def update_actors
    # Reset actor battler sprites if party size increases
    if $game_party.members.size > @actor_sprites.size
      dispose_actors
      create_actors
    end
    for sprite in @actor_sprites
      sprite.update
    end
  end  
end



#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias Listings
  #-------------------------------------------------------------------------- 
  alias actorbattler_s start
  alias actorbattler_spcs start_party_command_selection 
  alias actorbattler_pv process_victory
  alias actorbattler_ea execute_action
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    actorbattler_s
    $game_temp.battle_main_phase = false
  end
  #--------------------------------------------------------------------------
  # * Start party command selection
  #--------------------------------------------------------------------------
  def start_party_command_selection
    actorbattler_spcs    
    if $game_temp.in_battle
      $game_temp.battle_main_phase = false
    end
  end
  #--------------------------------------------------------------------------
  # * Victory Processing
  #--------------------------------------------------------------------------
  def process_victory
    $game_temp.battle_main_phase = false
    actorbattler_pv
  end
  #--------------------------------------------------------------------------
  # * Start Execution of Battle Processing
  #--------------------------------------------------------------------------
  def execute_action
    actorbattler_ea
    $game_temp.battle_main_phase = true
  end
end
 
Code:
#==============================================================================
# ** Damage Pop VX
#------------------------------------------------------------------------------
#    by DerVVulfman
#    version 3.1
#    05-20-2008
#    RGSS2
#============================================================================== 
#
#  INTRODUCTION:
#
#  This script is a script that reintroduces the classic 'pop-up' display for
#  damage results. Unlike the original RPGMaker XP system, this also displays
#  a damage pop for MP (Mana Point) damage, absorbtion and recovery.
#
#------------------------------------------------------------------------------
#
#  THE CONFIGURABLES:
#
#  There are  five basic sections  in this script's  configuration section:
#  Fonts, Text, Color, Style and Default settings.
#
#  Fonts
#  =====
#  This section controls the lettering style of the damage pop-up.  You can
#  set the name of the font,  the size of the regular damage on the screen,
#  the size of the 'Critical Hit' message that appears, whether the text is
#  shown in boldface print or if it is italicized.  That's really it.
#
#  Text
#  =====
#  In this section, you set the text that appears for messages like 'Miss',
#  'Critical!' and the like.   It kinda helps to have it in a configuration
#  section than having it hardwired like some other scripts. It also allows
#  you to insert and change the prefix for any health or mana hits applied.
#
#  Color
#  =====
#  This section  allows you to define the color  of the damage pop-ups that
#  are shown with this script.   They are created through the classic r/g/b
#  style of the Color.new command.   You have six color sequences  you have
#  to work with:  Regular,  Recovery,  Absorb,  MP Damage,  MP Recovery and
#  MP Absorb.
#
#  Style
#  =====
#  This section controls the way the damage pop-up is displayed.  The names
#  of these editable values  are a little harder  to understand,  so I will
#  present you a list of each one and their purpose:
#
#  DAMAGE_DBLBOUNCE:  This is a true/false switch.   If you have it  set to
#                     true, the damage popup can permit the popup to bounce
#                     twice rather than once like RMXP's default system. It
#                     is dependant on the value  held in 'DAMAGE_POP_DIR_Y'
#                     for how high the pop-up bounces.
#
#  DAMAGE_POP_DELAY:  This gauges how long (in frames)  that the damage pop
#                     up is shown on the screen.   A moderate value of '60'
#                     would keep  the popup  on the screen  for one second. 
#                     You must have a value of 10 or higher.   Values below
#                     10 will result in an error.
#
#  DAMAGE_POP_DIR_X:  This determines  the direction  and speed  the damage
#                     pop will move on the screen.  Any positive value here
#                     will move  the popup  to the right  and any  negative 
#                     value here will move the popup to the left.  The lar-
#                     ger the value, the more the value will shift.  And a
#                     value of  '0'  will just keep the pop-up from moving.
#                     However...  If the value is set to 'nil',  the damage
#                     pop will randomly move to the left or right.
#                     
#  DAMAGE_POP_DIR_Y:  Like DAMAGE_POP_DIR_X, this determines the direction
#                     and speed the pop will move on the screen...  but in
#                     vertical direction.    Positive values make the pop-
#                     up raise  and then drop in a bouncing manner,  while 
#                     negative values lower  and then raise the popup in a
#                     sweeping wave pattern.   The larger  the value,  the 
#                     more  the value  will shift.   And if  you have  the 
#                     DAMAGE_DBLBOUNCE value set to true,  then the damage
#                     pop will bounce 'twice' based on this set value.
#  
#  Default
#  =======
#  This final section controls the placement of the damage pop-ups for your
#  actors if you do not use any system to add 'actor battler' graphics.  In
#  cases where you have actor battlers,  these values are overwritten.  But
#  if this system is being used alone, this positions where the damage pops
#  will show on the screen.  The following describes the last three values:
#
#  DAMAGE_POP_CENTER:  This value is a  true/false value  that sets whether
#                      the battlers line up  from the left  and space them-
#                      selves out  in the manner of the default RPGMaker XP
#                      or whether  the system  calculates  and centers them 
#                      across the screen.
#
#  DAMAGE_POP_PARTY:   This value establishes how many actors are typically
#                      shown in the battlefield.  While this is the default
#                      value,  the maximum value used can be changed with a
#                      script call.
#
#  DAMAGE_POP_Y_POS:   Finally, the vertical up/down position of the popups
#                      can be adjusted by changing the value of this value.
#
#
#------------------------------------------------------------------------------
#
#  SCRIPT CALLS:
#
#  There's only one script call that you need to know:
#
#  cases where you have actor battlers,  these values are overwritten.  But
#  This script lets you have the damage popups spaced out evenly across the
#  screen.   Under most circumstances, you have four members in your party,
#  but this allows you to permit it to space the popups evenly  if you have
#  5, 6 or even 10 battlers in your battleparty.
#
#  Now, this system does not increase the number of members in your party,
#  but it is already set up to adjust the spacing of your members in the
#  battlefield.  With a simple script call:
#
#           $game_system.dpop_party_max = 7
#
#  You can make the system space the battlers on the field with the under-
#  standing that up to 7 members are in the party.
#
#------------------------------------------------------------------------------
#
#  SCRIPT PLACEMENT:
#
#  As a core/re-insertion script, it returns the ability to use damage pops 
#  that many users became used to with other RPG gaming systems. Also, this
#  core script approximates the position of 'actor' battlers if there isn't
#  another script in use to create visible 'actor' battlers.
#
#  If this script is being used with any other script that positions and/or
#  creates 'actor' battlers,  then those scripts will most likely be placed
#  BELOW 'Damage Pop VX' as they will most likely create their own screen_x
#  and screen_y methods for Game_Actor.
#
#------------------------------------------------------------------------------
#
#  EDITS AND MODIFICATIONS:
#  
#  This system Aliases the following methods:
#  * initialize                     (Game_System)
#  * clear_sprite_effects           (Game_Battler)
#  * initialize                     (Sprite_Base)
#  * update                         (Sprite_Base)
#  * setup_new_effect               (Sprite_Battler)
#  * display_hp_damage              (Scene_Battle)
#  * display_mp_damage              (Scene_Battle)
#  * display_evasion                (Scene_Battle)
#  * display_miss                   (Scene_Battle)
#
#  This system redefines the following methods:
#  * use_sprite?                    (Game_Actor)
#
#  This system adds the following methods:
#  * use_sprite?                    (Game_Actor)
#  * screen_x                       (Game_Actor)
#  * screen_y                       (Game_Actor)
#  * screen_z                       (Game_Actor)
#  * damage                         (Sprite_Base)
#  * dispose_damage                 (Sprite_Base)
#
#------------------------------------------------------------------------------
#
#  THANKS:
#
#  To my old pal, Syvkal,  for reminding me that RPGMaker XP's basic DAMAGE
#  system was built into it's Sprite class. It made it easier to implement.
#
#------------------------------------------------------------------------------
#
#  TERMS AND CONDITIONS:
#
#  Free to use, even in commercial projects.  Just note that I'll need some
#  form of due credit for myself and anyone else  involved in this script's 
#  creation... even a mere mention in some end titles.
#
#==============================================================================


   #========================================================================
   #  **  C  O  N  F  I  G  U  R  A  T  I  O  N      S  Y  S  T  E  M  **  #
   #========================================================================  
  
  # ---Font Settings---
  #  
  DAMAGE_POP_FONT   = "Times New Roman"   # Name of font used
  DAMAGE_POP_SIZE   = 32                  # Size of font used
  DAMAGE_POP_SIZE2  = 36                  # Size of critical font
  DAMAGE_POP_BOLD   = false               # If bold text used
  DAMAGE_POP_ITALIC = true                # If italicized text used
    
  # ---Text Settings---
  #  
  DAMAGE_POP_CRIT   = "Critical!"         # Text shown for critical hits
  DAMAGE_POP_MISS   = "Miss"              # Text shown for misses
  DAMAGE_POP_FAILED = "Failed"            # Text shown for failed attacks
  DAMAGE_POP_EVADED = "Evaded"            # Text shown for evaded attacks
  DAMAGE_HP_STRING  = nil                 # Text suffix for HP Damage
  DAMAGE_MP_STRING  = "MP"                # Text suffix for MP Damage
  
  # ---Color Settings---
  #  
  DAMAGE_POP_COLOR1 = Color.new(255, 255, 255) # HP Damage      (White)
  DAMAGE_POP_COLOR2 = Color.new(127, 255, 127) # HP Recovery    (Med Green)
  DAMAGE_POP_COLOR3 = Color.new(196,   0,   0) # HP Absorb      (Dk Red)
  DAMAGE_POP_COLOR4 = Color.new(  0, 196, 255) # MP Damage      (Lt Blue)
  DAMAGE_POP_COLOR5 = Color.new(255, 255,  96) # MP Recovery    (Yellow)
  DAMAGE_POP_COLOR6 = Color.new(255, 156,  55) # MP Absorb      (Orange)
  
  
  # ---Style Settings---
  #  
  DAMAGE_DBLBOUNCE  = false  # If doublebounce feature is on
  DAMAGE_POP_DELAY  = 50    # Duration of Pop (mist be 10 or higher)
  DAMAGE_POP_DIR_X  = nil   # Horizontal direction for pop (or nil for random)
  DAMAGE_POP_DIR_Y  = 1     # Vertical direction & incrementation for pop

  
  # --Default Position-- 
  #
  DAMAGE_POP_CENTER = true    # If true, assumes battler pops are centered
  DAMAGE_POP_PARTY  = 4       # Default party Max
  DAMAGE_POP_Y_POS  = 280     # Vertical position of party's damage pop    
  
  
  
  
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles system-related data. Also manages vehicles and BGM, etc.
# The instance of this class is referenced by $game_system.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :dpop_party_max         # Max. size for centered battlers
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------   
  alias dpop_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Perform the original call
    dpop_initialize
    # Set 'Centered' battler max to 4 (default)
    @dpop_party_max = DAMAGE_POP_PARTY
  end
end



#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------  
  alias dpop_clear_sprite_effects clear_sprite_effects
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :damage                  # damage popup value
  attr_accessor :damage_type             # damage popup type
  #--------------------------------------------------------------------------
  # * Clear Variable Used for Sprite Communication
  #--------------------------------------------------------------------------
  def clear_sprite_effects
    # Perform the original call
    dpop_clear_sprite_effects
    # Clear damage pop
    @damage = 0
  end
end



#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------  
  attr_accessor :screen_x                 # battle screen X coordinate
  attr_accessor :screen_y                 # battle screen Y coordinate
  #--------------------------------------------------------------------------
  # * Use Sprites?
  #--------------------------------------------------------------------------
  def use_sprite?
    return true
  end  
  #--------------------------------------------------------------------------
  # * Get Battle Screen X-Coordinate
  #--------------------------------------------------------------------------
  def screen_x
    if self.index != nil
      if DAMAGE_POP_CENTER
        # Return after calculating x-coords of centered party members
        return self.index * (544 / $game_system.dpop_party_max) + 
              ($game_system.dpop_party_max - $game_party.members.size) * 
              (272 / $game_system.dpop_party_max) +
              (272 / $game_system.dpop_party_max) 
      else
        # Return after calculating x-coords of default-aligned party members
        return self.index * 136 + 68
      end
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # * Get Battle Screen Y-Coordinate
  #--------------------------------------------------------------------------
  def screen_y
    return DAMAGE_POP_Y_POS
  end  
  #--------------------------------------------------------------------------
  # * Get Battle Screen Z-Coordinate
  #--------------------------------------------------------------------------
  def screen_z
    # Return after calculating z-coordinate by order of members in party
    if self.index != nil
      return $game_party.members.size - self.index
    else
      return 0
    end
  end
end

  
  
#==============================================================================
# ** Sprite_Base
#------------------------------------------------------------------------------
#  A sprite class with animation display processing added.
#==============================================================================

class Sprite_Base < Sprite
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias dpop_initialize initialize
  alias dpop_update update
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     viewport : viewport
  #--------------------------------------------------------------------------
  def initialize(viewport = nil)
    dpop_initialize(viewport)   # Perform the original call
    @_damage_duration = 0       # Remaining damage pop time
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------  
  def update
    # Perform the original call
    dpop_update
    # Obtain delay percentages
    p1 = DAMAGE_POP_DELAY
    if DAMAGE_DBLBOUNCE
      p2 = (DAMAGE_POP_DELAY * 8) / 10
      p3 = (DAMAGE_POP_DELAY * 7) / 10
      p4 = (DAMAGE_POP_DELAY * 6) / 10
      p5 = (DAMAGE_POP_DELAY * 5) / 10
      p6 = (DAMAGE_POP_DELAY * 4) / 10
      p7 = (DAMAGE_POP_DELAY * 3) / 10
      p8 = (DAMAGE_POP_DELAY * 2) / 10
      p9 = (DAMAGE_POP_DELAY * 1) / 10    
    else
      p2 = (DAMAGE_POP_DELAY * 8) / 10
      p3 = (DAMAGE_POP_DELAY * 7) / 10
      p4 = (DAMAGE_POP_DELAY * 6) / 10
      p5 = (DAMAGE_POP_DELAY * 5) / 10
    end
    if @_damage_duration > 0
      @_damage_duration -= 1
      @_damage_sprite.x += @_damage_x
      if DAMAGE_DBLBOUNCE
        case @_damage_duration
        when p2..p1
          @_damage_sprite.y -= DAMAGE_POP_DIR_Y * 2
        when p3..p2
          @_damage_sprite.y -= DAMAGE_POP_DIR_Y
        when p4..p3
          @_damage_sprite.y += DAMAGE_POP_DIR_Y
        when p5..p4
          @_damage_sprite.y += DAMAGE_POP_DIR_Y * 4
        when p6..p5
          @_damage_sprite.y -= DAMAGE_POP_DIR_Y 
        when p7..p6
          @_damage_sprite.y -= DAMAGE_POP_DIR_Y
        when p8..p7
          @_damage_sprite.y += DAMAGE_POP_DIR_Y * 2
        when p9..p8
          @_damage_sprite.y += DAMAGE_POP_DIR_Y * 4        
        end
      else
        case @_damage_duration
        when p2..p1
          @_damage_sprite.y -= DAMAGE_POP_DIR_Y * 2
        when p3..p2
          @_damage_sprite.y -= DAMAGE_POP_DIR_Y
        when p4..p3
          @_damage_sprite.y += DAMAGE_POP_DIR_Y
        when p5..p4
          @_damage_sprite.y += DAMAGE_POP_DIR_Y * 2
        end
      end
      @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
      if @_damage_duration == 0
        dispose_damage
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Damage
  #     value : damage value
  #--------------------------------------------------------------------------
  def damage(value, critical, type)
    dispose_damage
    if value.is_a?(Numeric)
      damage_string = value.abs.to_s
    else
      damage_string = value.to_s
    end
    bitmap = Bitmap.new(160, 48)
    bitmap.font.name   = DAMAGE_POP_FONT
    bitmap.font.size   = DAMAGE_POP_SIZE
    bitmap.font.bold   = DAMAGE_POP_BOLD
    bitmap.font.italic = DAMAGE_POP_ITALIC
    bitmap.font.color.set(0, 0, 0)
    # Apply Regular Damage Text
    bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
    bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
    bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
    bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
    # Apply Critical Text
    if critical
      bitmap.font.size = DAMAGE_POP_SIZE2
      bitmap.draw_text(-1, -1, 160, 20, DAMAGE_POP_CRIT, 1)
      bitmap.draw_text(+1, -1, 160, 20, DAMAGE_POP_CRIT, 1)
      bitmap.draw_text(-1, +1, 160, 20, DAMAGE_POP_CRIT, 1)
      bitmap.draw_text(+1, +1, 160, 20, DAMAGE_POP_CRIT, 1)
    end    
     # Set Color Scheme  
    case type
      when 1; bitmap.font.color = DAMAGE_POP_COLOR4
      when 2; bitmap.font.color = DAMAGE_POP_COLOR2
      when 3; bitmap.font.color = DAMAGE_POP_COLOR3
      when 4; bitmap.font.color = DAMAGE_POP_COLOR5
      when 5; bitmap.font.color = DAMAGE_POP_COLOR6
      else;   bitmap.font.color = DAMAGE_POP_COLOR1
    end   
    # Reset basic size  
    bitmap.font.size   = DAMAGE_POP_SIZE  
    bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
    # Draw Critical Text
    if critical
      bitmap.font.size = DAMAGE_POP_SIZE2
      bitmap.draw_text(0, 0, 160, 20, DAMAGE_POP_CRIT, 1)
    end    
    @_damage_sprite = ::Sprite.new(self.viewport)
    @_damage_sprite.bitmap = bitmap
    @_damage_sprite.ox = 80
    @_damage_sprite.oy = 20
    @_damage_sprite.x = self.x
    @_damage_sprite.y = (self.y - self.oy / 2)
    @_damage_sprite.z = 3000
    @_damage_duration = DAMAGE_POP_DELAY
    if DAMAGE_POP_DIR_X == nil
      @_damage_x = rand(3) - 1
    else
      @_damage_x = DAMAGE_POP_DIR_X
    end    
  end
  #--------------------------------------------------------------------------
  # * Dispose of Damage
  #--------------------------------------------------------------------------    
  def dispose_damage
    if @_damage_sprite != nil
      @_damage_sprite.bitmap.dispose
      @_damage_sprite.dispose
      @_damage_sprite = nil
      @_damage_duration = 0
    end
  end
end



#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
#  This sprite is used to display battlers. It observes a instance of the
# Game_Battler class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Battler < Sprite_Base
  #--------------------------------------------------------------------------
  # * Constants
  #--------------------------------------------------------------------------
  DAMAGE = 7
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias dpop_setup_new_effect setup_new_effect
  #--------------------------------------------------------------------------
  # * Set New Effect
  #--------------------------------------------------------------------------  
  def setup_new_effect
    # Adding damage pop effect
    if @battler.damage != 0
      damage(@battler.damage, @battler.critical, @battler.damage_type)
      @effect_type = DAMAGE
      @battler.damage = 0
    end
    # Perform the original call
    dpop_setup_new_effect    
  end
end



#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base  
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------  
  alias dpop_display_hp_damage display_hp_damage
  alias dpop_display_mp_damage display_mp_damage  
  alias dpop_display_evasion display_evasion
  alias dpop_display_miss display_miss
  #--------------------------------------------------------------------------
  # * Show HP Damage
  #     target : Target
  #     obj    : Skill or item
  #--------------------------------------------------------------------------  
  def display_hp_damage(target, obj = nil)
    # Original call
    dpop_display_hp_damage(target, obj)
    critical = false
    critical = true if target.critical
    if target.hp_damage == 0                # No damage
      text = "skip"
    elsif target.absorbed                   # HP Absorb
      text = (target.hp_damage).to_s
      type = 3
    elsif target.hp_damage > 0              # Normal Damage
      text = (target.hp_damage).to_s
      type = 0
    else                                    # HP Recovery
      text = (-target.hp_damage).to_s
      type = 2
    end
    # Apply if no change
    if text != "skip"
      # Apply MP string if applicable
      if DAMAGE_HP_STRING != nil
        text = text + " " + DAMAGE_HP_STRING
      end
      target.damage = text
      target.damage_type = type
    end
  end
  #--------------------------------------------------------------------------
  # * Show MP Damage
  #     target : Target
  #     obj    : Skill or item
  #--------------------------------------------------------------------------
  def display_mp_damage(target, obj = nil)
    # Original call
    dpop_display_mp_damage(target, obj)
    critical = false
    critical = true if target.critical
    # Sort Data
    if target.absorbed                      # MP Absorb
      text = (target.mp_damage).to_s
      type = 5
    elsif target.mp_damage > 0              # MP Damage
      text = (target.mp_damage).to_s
      type = 1
    elsif target.mp_damage < 0              # MP Recovery
      text =  (-target.mp_damage).to_s
      type = 4
    else
      text = "skip"
    end
    # Apply if no change
    if text != "skip"
      # Apply MP string if applicable
      if DAMAGE_MP_STRING != nil
        text = text + " " + DAMAGE_MP_STRING
      end
      target.damage = text
      target.damage_type = type
    end
  end  
  #--------------------------------------------------------------------------
  # * Show Escape
  #     target : Target
  #     obj    : Skill or item
  #--------------------------------------------------------------------------
  def display_evasion(target, obj = nil)
    # Original call
    dpop_display_evasion(target, obj)    
    critical = false
    target.damage = DAMAGE_POP_EVADED
    target.damage_type = 0
  end
  #--------------------------------------------------------------------------
  # * Show Miss
  #     target : Target
  #     obj    : Skill or item
  #--------------------------------------------------------------------------
  def display_miss(target, obj = nil)
    # Original call
    dpop_display_miss(target, obj)    
    critical = false
    if obj == nil or obj.physical_attack
      text = DAMAGE_POP_MISS
    else
      text = DAMAGE_POP_FAILED
    end
    target.damage = text
    target.damage_type = 0
  end
end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top