Relative Basic Stats

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
578
Reaction score
219
First Language
English
Primarily Uses
RMVXA
Relative Basic Stats
by: Rinobi

Adjusts a battler's HP, MP, and TP values to remain relative to respective maximum values when modified by buffs, states, equipment, and levels.

For Example:

Normally This Happens
Actor's HP = 800 / 1000
Buff MHP +50%
Actor's HP 800 / 1500

Although the actor's maximum HP was increased, allowing the potential for greater Health values, the actor's health percentage actually drops from 80% to 53%. The modification itself has no immediate advantage.

With This Script
Actor's HP = 800 / 1000
Buff MHP +50%
Actor's HP 1200 / 1500

Because 80% of 1500 is 1200
When the actor's maximum HP is increased, their HP value is adjusted to remain at the 80% it began with. This keeps the actor's overall condition exactly the same while providing an immediate health advantage.

The Opposite Is Also True:

Normally This Happens
Actor's HP = 800 / 1000
Debuff MHP -15%
Actor's HP = 800 / 850

By default, this has little to no effect depending on when the modification happens, and the actor's Health percentage actually increases from 80% to 94%. The Health bar will deceptively imply that the actor's condition improved.

With This Script
Actor's HP = 800 / 1000
Debuff MHP -15%
Actor's HP = 680 / 850

Because 80% of 850 is 680
The actor will also loose the equivalent health.​


  • [05/28/2017] 1.00 Public Release
  • [08/17/2017] 1.10 Included missing Buffs/Debuffs
  • [09/04/2017] 1.30 Settings added. Restriction fix.
  • Plug & Play, functions as advertised.
Code:
module RINOBI module RBS # DO NOT MODIFY
#==============================================================================
# # RELATIVE BASIC STATS
# -----------------------------------------------------------------------------
# 1.0 [06/06/2016] Completed
# 1.1 [08/14/2017] Also affects buffs and debuffs.
# 1.3 [09/03/2017] Settings added. Restriction fix.
#-
# Basic stats are HP, MP, and TP values.
#
# Adjusts a battler's HP, MP, and TP values to remain relative to maximum
# values when modified by buffs, states, equipment, and levels. This basically
# means that if a basic stat such as MAX HP is reduced or increased, the HP
# value will instantly adjust to the same percentage value.
#==============================================================================
# # SCRIPT CALLS
#------------------------------------------------------------------------------
# rbs_levels      Adjust basic stats on level up/down.
# rbs_classes     Adjust basic stats on class change.
# rbs_equipment   Adjust basic stats on equipment change.
# rbs_buffs       Adjust basic stats on buff/debuff.
# rbs_states      Adjust basic stats on state add/remove.
#-------------------------------------------
# $game_actors[1].rbs_levels = true
# $game_party.members[2].rbs_classes = false
# $game_troop.members[4].rbs_buffs = true
# a.rbs_states = false
# b.rbs_buffs = true
#==============================================================================
# # TERMS OF USE
#------------------------------------------------------------------------------
# 1. Preserve this header.
# 2. Do not re-upload this script.
# 3. Do not claim this script as your own work.
# 4. Do not release modified versions of this script.
# 5. You may use this script within commercial project.
#==============================================================================
# # SETTINGS
# -----------------------------------------------------------------------------
# Adjust the below settings to your liking.

    #======================================================================
    # >> RBS Levels
    # ---------------------------------------------------------------------
    # Basic Stat values adjusted on level up/down.
    #======================================================================
      RBS_Levels = true
    
    #======================================================================
    # >> RBS Class
    # ---------------------------------------------------------------------
    # Basic Stat values adjusted on class change.
    #======================================================================
      RBS_Classes = true
    
    #======================================================================
    # >> RBS Equipment
    # ---------------------------------------------------------------------
    # Basic Stat values adjusted on equipment change/removal.
    #======================================================================
      RBS_Equipment = true
    
    #======================================================================
    # >> RBS Buffs
    # ---------------------------------------------------------------------
    # Basic Stat values adjusted on buff/debuff.
    #======================================================================
      RBS_Buffs = true
    
    #======================================================================
    # >> RBS States
    # ---------------------------------------------------------------------
    # Basic Stat values adjusted on add/remove state.
    #======================================================================
      RBS_States = true

#==============================================================================
#                             END OF SETTINGS
#==============================================================================
end end # DO NOT MODIFY
#==============================================================================
# ** IMPORT SCRIPT
#------------------------------------------------------------------------------
$imported = {} if $imported.nil?
$imported[:RIN_RBS] = true
#==============================================================================
# ** Game_BattlerBase
#------------------------------------------------------------------------------
#  This base class handles battlers. It mainly contains methods for calculating
# parameters. It is used as a super class of the Game_Battler class.
#==============================================================================
class Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Alias: Object Initialization
  #--------------------------------------------------------------------------
  alias :rbs_initialize :initialize
  def initialize
    rbs_initialize
    rbs_default_settings
  end
  #--------------------------------------------------------------------------
  # * Set Relative Default Settings
  #--------------------------------------------------------------------------
  def rbs_default_settings
    @rbs_levels = RINOBI::RBS::RBS_Levels
    @rbs_classes = RINOBI::RBS::RBS_Classes
    @rbs_equipment = RINOBI::RBS::RBS_Equipment
    @rbs_buffs = RINOBI::RBS::RBS_Buffs
    @rbs_states = RINOBI::RBS::RBS_States
  end
  #--------------------------------------------------------------------------
  # * Get Relative Settings
  #--------------------------------------------------------------------------
  def rbs_levels; @rbs_levels end
  def rbs_classes; @rbs_classes end
  def rbs_equipment; @rbs_equipment end
  def rbs_buffs; @rbs_buffs end
  def rbs_states; @rbs_states end
  #--------------------------------------------------------------------------
  # * Alias: Erase States
  #--------------------------------------------------------------------------
  alias :rbs_erase_state :erase_state
  def erase_state(state_id)
    get_relative_values if rbs_states
    rbs_erase_state(state_id)
    set_relative_values if rbs_states
  end
  #--------------------------------------------------------------------------
  # * Get Rate Values
  #--------------------------------------------------------------------------
  def get_relative_values
    @ohp_rate = hp_rate
    @omp_rate = mp_rate
    @otp_rate = tp_rate
  end
  #--------------------------------------------------------------------------
  # * Set Relative Values
  #--------------------------------------------------------------------------
  def set_relative_values
    @hp = [mhp * @ohp_rate, 0].max.round.to_i
    @mp = [mmp * @omp_rate, 0].max.round.to_i
    @tp = [max_tp * @otp_rate, 0].max.round.to_i
  end
end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  A battler class with methods for sprites and actions added. This class
# is used as a super class of the Game_Actor class and Game_Enemy class.
#==============================================================================
class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :rbs_levels
  attr_accessor :rbs_classes
  attr_accessor :rbs_equipment
  attr_accessor :rbs_buffs
  attr_accessor :rbs_states
  #--------------------------------------------------------------------------
  # * Inherit Relative Values
  #--------------------------------------------------------------------------
  def rbs_levels; super end
  def rbs_classes; super end
  def rbs_equipment; super end
  def rbs_buffs; super end
  def rbs_states; super end
  def get_relative_values; super end
  def set_relative_values; super end
  #--------------------------------------------------------------------------
  # * Overwrite: Add New State
  #--------------------------------------------------------------------------
  def add_new_state(state_id)
    die if state_id == death_state_id
    get_relative_values if rbs_states
    @states.push(state_id)
    set_relative_values if rbs_states
    on_restrict if restriction > 0
    sort_states
    refresh
  end
  #--------------------------------------------------------------------------
  # * Alias: Add Buff
  #--------------------------------------------------------------------------
  alias :rbs_add_buff :add_buff
  def add_buff(param_id, turns)
    get_relative_values if rbs_buffs
    rbs_add_buff(param_id, turns)
    set_relative_values if rbs_buffs
  end
  #--------------------------------------------------------------------------
  # * Alias: Add Debuff
  #--------------------------------------------------------------------------
  alias :rbs_add_debuff :add_debuff
  def add_debuff(param_id, turns)
    get_relative_values if rbs_buffs
    rbs_add_debuff(param_id, turns)
    set_relative_values if rbs_buffs
  end
  #--------------------------------------------------------------------------
  # * Alias: Erase Buff/Debuff
  #--------------------------------------------------------------------------
  alias :rbs_erase_buff :erase_buff
  def erase_buff(param_id)
    get_relative_values if rbs_buffs
    rbs_erase_buff(param_id)
    set_relative_values if rbs_buffs
  end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It is used within the Game_Actors class
# ($game_actors) and is also referenced from the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Alias: Change Class
  #     keep_exp:  Keep EXP
  #--------------------------------------------------------------------------
  alias :rbs_change_class :change_class
  def change_class(class_id, keep_exp = false)
    get_relative_values if rbs_classes
    rbs_change_class(class_id, keep_exp = false)
    set_relative_values if rbs_classes
  end
  #--------------------------------------------------------------------------
  # * Alias: Change Equipment
  #     slot_id:  Equipment slot ID
  #     item:    Weapon/armor (remove equipment if nil)
  #--------------------------------------------------------------------------
  alias :rbs_change_equip :change_equip
  def change_equip(slot_id, item)
    get_relative_values if rbs_equipment
    rbs_change_equip(slot_id, item)
    set_relative_values if rbs_equipment
  end
  #--------------------------------------------------------------------------
  # * Alias: Forcibly Change Equipment
  #     slot_id:  Equipment slot ID
  #     item:     Weapon/armor (remove equipment if nil)
  #--------------------------------------------------------------------------
  alias :rbs_force_equip :force_change_equip
  def force_change_equip(slot_id, item)
    get_relative_values if rbs_equipment
    rbs_force_equip(slot_id, item)
    set_relative_values if rbs_equipment
  end
  #--------------------------------------------------------------------------
  # * Alias: Level Up
  #--------------------------------------------------------------------------
  alias :rbs_level_up :level_up
  def level_up
    get_relative_values if rbs_levels
    rbs_level_up
    set_relative_values if rbs_levels
  end
  #--------------------------------------------------------------------------
  # * Alias: Level Down
  #--------------------------------------------------------------------------
  alias :rbs_level_down :level_down
  def level_down
    get_relative_values if rbs_levels
    rbs_level_down
    set_relative_values if rbs_levels
  end
  #--------------------------------------------------------------------------
  # * Alias: Change Level
  #     show : Level up display flag
  #--------------------------------------------------------------------------
  alias :rbs_change_level :change_level
  def change_level(level, show)
    get_relative_values if rbs_levels
    rbs_change_level(level, show)
    set_relative_values if rbs_levels
  end
end
 

Attachments

Last edited:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,224
Reaction score
13,766
First Language
English
Primarily Uses
RMVXA
Hello. The script looks good, but can you add something on whether the script is free to use commercially, or if it is only free to use in non-commercial projects?
 

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
578
Reaction score
219
First Language
English
Primarily Uses
RMVXA
As of this post, the More Options... selection isn't working for me. I will update the file download when I'm able.
However, the pasted code has been updated; free for commercial use with given credit.
 

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
578
Reaction score
219
First Language
English
Primarily Uses
RMVXA
Updated.

The script also affects standard MHP and MMP buffs now...
I somehow forgot to write that into the code.
 
  • Like
Reactions: Kes

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,113
Reaction score
11,463
First Language
English
Primarily Uses
RMVXA
This makes such a lot of sense. The default has always irritated me.
Thank you.
 

Aoi Ninami

Veteran
Veteran
Joined
Sep 22, 2015
Messages
413
Reaction score
512
First Language
English
Primarily Uses
RMVXA
Great idea! But, can you tweak it so it works for equipment and level-ups, but not for buffs? I'm worried that a buff + refill skill would be overpowered, so I'd like to have that as an option.
 

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
578
Reaction score
219
First Language
English
Primarily Uses
RMVXA
@Aoi Ninami I could create some options to allow certain features to be disabled... though I would like to clarify that this script doesn't "refill" anything. It keeps values at the exact same percentage that they began with after a buff or state is added or removed.
 

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
578
Reaction score
219
First Language
English
Primarily Uses
RMVXA
Updated.

Added settings and script calls to allow certain features to be enable/disable both initially and in-game.

Fixed a bug where states removed by restriction would interfere with added states, causing them not to update properly.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I spoke with hudell and many programmer about the Window_BattleLog class and we all just agreed to pretend this class just doesn't exists lol
I haven't been able to solidify a cohesive plot so dropped out of a game jam but, on a fun note, I pre-ordered MZ today! :LZSwink:
So I just spent the weekend...playing my own game. The one I released last year. Yep you heard that right.
Goal for MZ? None... I'm still curious how to finish my VXA project and how it looks like when it actually finished. Which will take at least another two years. Coming late again to the party.

Forum statistics

Threads
100,657
Messages
978,136
Members
132,268
Latest member
janetjoradan
Top