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.

New stat sets

Set own parameters:

I was wanting a script that could completely change the way the parameters are set. I was wanting one that would allow me to set HP, MP, Attack (for defining weapon damage), Defense (for defense against weapons) Magic (for defining damage from spell attacks), Resistance (for defense against magic attacks) Speed (the faster char. gets to go first.) Evasion (Percent of Chance of evading an attack.)

And the parameters aren't set by player, but by classes. That would be great! Thanks in advance.
 
I swear I could fill a third of this request forum with scripts I have already done. lol

[rgss]#==============================================================================
# ** Class Based Stats
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 2
# 2007-02-19
# SDK : Version 2.0+, Part I
#------------------------------------------------------------------------------
# * Version History :
#
#   Version 1 ---------------------------------------------------- (2006-08-27)
#   Version 2 ---------------------------------------------------- (2007-02-19)
#    - Update : Rescripted System
#------------------------------------------------------------------------------
# * Requirements :
#
#   Method & Class Library 2.1+
#------------------------------------------------------------------------------
# * Description :
#
#   This script was designed to give actors stat boost based off their class.
#   It allows you to customize each level's value for each stat through
#   starting, finishing and inflation values. If you wanted, you could set the
#   actors stats in the database to 0 and use these settings instead. You may
#   use any formula from the Curver Generator module.
#------------------------------------------------------------------------------
# * Instructions :
#
#   Place The Script Below the SDK and Above Main.
#   To Customize your clas stats, refer to the customization instructions.
#------------------------------------------------------------------------------
# * Customization :
#
#   Bonus_Type = {class_id => {<stat_name> => [<generator_values>], ...}, ...}
#
#   Stat Names : 'maxhp', 'maxsp', 'str', 'dex', 'agi', 'int', 'atk',
#                'pdef',  'mdef',  'eva', 'hit'
#
#   Generator Values : generator_type, *args
#
#   ** Refer to Curve Generator System for type and args specification.
#--------------------------------------------------------------------------
# * Syntax :
#
#   Retrieving Class Bonuses at specific level
#    - Class_Based_Stats.get_stat_base(class_id, stat_name, level, direct)
#
#   Stat Names : 'maxhp', 'maxsp', 'str', 'dex', 'agi', 'int', 'atk',
#                'pdef',  'mdef',  'eva', 'hit'
#==============================================================================
 
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Class Based Stats', 'SephirothSpawn', 2, '2007-02-19')
SDK.check_requirements(2.0, [], {'Method & Class Library' => 2.1})
 
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.enabled?('Class Based Stats')
 
#==============================================================================
# ** Class_Based_Stats
#==============================================================================
 
module Class_Based_Stats
  #--------------------------------------------------------------------------
  # * Saved Class Curves
  #
  #  ~ Cache = { class_id => { stat_name => <stats>, ... }, ... }
  #--------------------------------------------------------------------------
  @cache_d, @cache_p = {}, {}
  #--------------------------------------------------------------------------
  # * Bonuses
  #
  #  ~ class_id => { <stat_name> => [ generator_type, *args ], ... }
  #
  #  Stat Names : 'maxhp', 'maxsp', 'str', 'dex', 'agi', 'int', 'atk',
  #               'pdef',  'mdef',  'eva', 'hit'
  #
  #  ** Refer to Curve Generator System for type and args specification.
  #--------------------------------------------------------------------------
  Direct_Bonuses = {}
  Percent_Bonuses = {}
  #--------------------------------------------------------------------------
  # * Get Base Stat
  #--------------------------------------------------------------------------
  def self.get_stat_base(class_id, stat_name, level, direct = true)
    # If Direct
    if direct
      # If Curve Already Generated
      if @cache_d.has_key?(class_id)
        if @cache_d[class_id].has_key?(stat_name)
          return @cache_d[class_id][stat_name][level]
        end
      end
      # If class has been defined
      if Direct_Bonuses.has_key?(class_id)
        # If Stat kind has been defined
        if Direct_Bonuses[class_id].has_key?(class_id)
          # Creates Table
          args = Direct_Bonuses[class_id][class_id]
          table = Curve_Generator.generate_curve(*args)
          # Save Table Data
          @cache_d[class_id][stat_name] = table
          # Return Level Value
          return table[level]
        end
      end
    # If Percents
    else
      # If Curve Already Generated
      if @cache_p.has_key?(class_id)
        if @cache_p[class_id].has_key?(stat_name)
          return @cache_p[class_id][stat_name][level]
        end
      end
      # If class has been defined
      if Percent_Bonuses.has_key?(class_id)
        # If Stat kind has been defined
        if Percent_Bonuses[class_id].has_key?(class_id)
          # Creates Table
          args = Percent_Bonuses[class_id][class_id]
          table = Curve_Generator.generate_curve(*args)
          # Save Table Data
          @cache_p[class_id][stat_name] = table
          # Return Level Value
          return table[level]
        end
      end
    end
    # Return 0
    return 0
  end
end
 
#==============================================================================
# ** Game_Actor
#==============================================================================
 
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :seph_classbasestats_dmhpb,         :direct_maxhp_bonus
  alias_method :seph_classbasestats_dmspb,         :direct_maxsp_bonus
  alias_method :seph_classbasestats_dstrb,         :direct_str_bonus
  alias_method :seph_classbasestats_ddexb,         :direct_dex_bonus
  alias_method :seph_classbasestats_dagib,         :direct_agi_bonus
  alias_method :seph_classbasestats_dintb,         :direct_int_bonus
  alias_method :seph_classbasestats_datkb,         :direct_atk_bonus
  alias_method :seph_classbasestats_devab,         :direct_eva_bonus
  alias_method :seph_classbasestats_dhitb,         :direct_hit_bonus
  alias_method :seph_classbasestats_dpdefb,        :direct_pdef_bonus
  alias_method :seph_classbasestats_dmdefb,        :direct_mdef_bonus
  alias_method :seph_classbasestats_pmhpb,         :percent_maxhp_bonus
  alias_method :seph_classbasestats_pmspb,         :percent_maxsp_bonus
  alias_method :seph_classbasestats_pstrb,         :percent_str_bonus
  alias_method :seph_classbasestats_pdexb,         :percent_dex_bonus
  alias_method :seph_classbasestats_pagib,         :percent_agi_bonus
  alias_method :seph_classbasestats_pintb,         :percent_int_bonus
  alias_method :seph_classbasestats_patkb,         :percent_atk_bonus
  alias_method :seph_classbasestats_pevab,         :percent_eva_bonus
  alias_method :seph_classbasestats_phitb,         :percent_hit_bonus
  alias_method :seph_classbasestats_ppdefb,        :percent_pdef_bonus
  alias_method :seph_classbasestats_pmdefb,        :percent_mdef_bonus
  alias_method :seph_classbasestats_gmactr_er,     :element_rate
  alias_method :seph_classbasestats_gmactr_sr,     :state_ranks
  alias_method :seph_classbasestats_gmactr_exp=,   :exp=
  #--------------------------------------------------------------------------
  # * Get Maximum HP
  #--------------------------------------------------------------------------
  def direct_maxhp_bonus
    n = seph_classbasestats_dmhpb
    n += Class_Based_Stats.get_stat_base(@class_id, 'maxhp', level)
    return n
  end
  def percent_maxhp_bonus
    n = seph_classbasestats_pmhpb
    n += Class_Based_Stats.get_stat_base(@class_id, 'maxhp', level, false)
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Maximum SP
  #--------------------------------------------------------------------------
  def direct_maxsp_bonus
    n = seph_classbasestats_dmspb
    n += Class_Based_Stats.get_stat_base(@class_id, 'maxsp', level)
    return n
  end
  def percent_maxsp_bonus
    n = seph_classbasestats_pmspb
    n += Class_Based_Stats.get_stat_base(@class_id, 'maxsp', level, false)
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Strength
  #--------------------------------------------------------------------------
  def direct_str_bonus
    n = seph_classbasestats_dstrb
    n += Class_Based_Stats.get_stat_base(@class_id, 'str', level)
    return n
  end
  def percent_str_bonus
    n = seph_classbasestats_pstrb
    n += Class_Based_Stats.get_stat_base(@class_id, 'str', level, false)
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Dexterity
  #--------------------------------------------------------------------------
  def direct_dex_bonus
    n = seph_classbasestats_ddexb
    n += Class_Based_Stats.get_stat_base(@class_id, 'dex', level)
    return n
  end
  def percent_dex_bonus
    n = seph_classbasestats_pdexb
    n += Class_Based_Stats.get_stat_base(@class_id, 'dex', level, false)
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Agility
  #--------------------------------------------------------------------------
  def direct_agi_bonus
    n = seph_classbasestats_dagib
    n += Class_Based_Stats.get_stat_base(@class_id, 'agi', level)
    return n
  end
  def percent_agi_bonus
    n = seph_classbasestats_pagib
    n += Class_Based_Stats.get_stat_base(@class_id, 'agi', level, false)
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Intelligence
  #--------------------------------------------------------------------------
  def direct_int_bonus
    n = seph_classbasestats_dintb
    n += Class_Based_Stats.get_stat_base(@class_id, 'int', level)
    return n
  end
  def percent_int_bonus
    n = seph_classbasestats_pintb
    n += Class_Based_Stats.get_stat_base(@class_id, 'int', level, false)
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Attack Power
  #--------------------------------------------------------------------------
  def direct_atk_bonus
    n = seph_classbasestats_datkb
    n += Class_Based_Stats.get_stat_base(@class_id, 'atk', level)
    return n
  end
  def percent_atk_bonus
    n = seph_classbasestats_patkb
    n += Class_Based_Stats.get_stat_base(@class_id, 'atk', level, false)
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Physical Defense
  #--------------------------------------------------------------------------
  def direct_pdef_bonus
    n = seph_classbasestats_dpdefb
    n += Class_Based_Stats.get_stat_base(@class_id, 'pdef', level)
    return n
  end
  def percent_pdef_bonus
    n = seph_classbasestats_ppdefb
    n += Class_Based_Stats.get_stat_base(@class_id, 'pdef', level, false)
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Magic Defense
  #--------------------------------------------------------------------------
  def direct_mdef_bonus
    n = seph_classbasestats_dmdefb
    n += Class_Based_Stats.get_stat_base(@class_id, 'mdef', level)
    return n
  end
  def percent_mdef_bonus
    n = seph_classbasestats_pmdefb
    n += Class_Based_Stats.get_stat_base(@class_id, 'mdef', level, false)
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Evasion Correction
  #--------------------------------------------------------------------------
  def direct_eva_bonus
    n = seph_classbasestats_devab
    n += Class_Based_Stats.get_stat_base(@class_id, 'eva', level)
    return n
  end
  def percent_eva_bonus
    n = seph_classbasestats_pevab
    n += Class_Based_Stats.get_stat_base(@class_id, 'eva', level, false)
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Hit Correction
  #--------------------------------------------------------------------------
  def direct_hit_bonus
    n = seph_classbasestats_dhitb
    n += Class_Based_Stats.get_stat_base(@class_id, 'hit', level)
    return n
  end
  def percent_hit_bonus
    n = seph_classbasestats_phitb
    n += Class_Based_Stats.get_stat_base(@class_id, 'hit', level, false)
    return n
  end
end
 
#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end
[/rgss]

It uses the MACL 2.1 or greater (or Curve Generator module with the Actor Stat Bonus system). I should probably update this with the new attributes system I made.

If you want them based off only the class, just set your actor's stats to 0 and setup the Direct_Bonuses constant. It may be kinda hard for a beginner, so let me know if you need any help.
 
All right, thanks allot!

Edit:: One thing I forgot to mention is that items you can equip can change those things, so they aren't limited to what vx lets you chose what stats they change.
 
Sorry for taking so long. Ok this script needs a few to make it work. First, insert the Curve Generator below materials:
[rgss]#==============================================================================
# ** Modules.Curve Generator Module (4.01)        By Trickster & SephirothSpawn
#------------------------------------------------------------------------------
# * Description :
#
#   This script was designed to generate a curve of numbers given certain
#   values. As of now, their are 3 formulas for you to choose from : Point-
#   slope; Early & Late; Early / Steady / Late + Curves.
#------------------------------------------------------------------------------
# * Syntax :
#
#   Generating Curve :
#    - curve = Curve_Generator.generate_curve(type, <args>)
#
#   Type : 0 - Point Slope
#          1 - Early / Late
#          2 - Early / Steady / Late + Curves
#
#   Args :
#
#    Type 0 : min_level, max_level, start value, inflation
#    Type 1 : min_level, max_level, min_value, max_value, early, late
#    Type 2 : min level, mid_level, max level, min value, mid_value,
#             max value, early, late, steady, curve 1, curve 2, integer
#
#   This will return a hash : { level => value, ... }
#==============================================================================
 
#==============================================================================
# ** Curve_Generator
#==============================================================================
 
module Curve_Generator
  #--------------------------------------------------------------------------
  # * Generate Curve
  #
  #   Type : 0 - Point Slope
  #          1 - Early / Late
  #          2 - Early / Steady / Late + Curves
  #
  #   Args :
  #
  #    Type 0 : min_level, max_level, start value, inflation
  #    Type 1 : min_level, max_level, min_value, max_value, early, late
  #    Type 2 : min level, mid_level, max level, min value, mid_value,
  #             max value, early, late, steady, curve 1, curve 2, integer
  #--------------------------------------------------------------------------
  def self.generate_curve(type, *args)
    # Collects Saved Tables
    tables = self.load_tables
    # Check for Previously Generated Table
    if tables.has_key?(type) && tables[type].has_key?(args)
      # Return Previously Generated Table
      return tables[type][args]
    end
    # Branch Point By Type
    case type
    when 0 # Point Slope
      table = Point_Slope.generate_curve(*args)
    when 1 # Early / Late
      table = Early_Late.generate_curve(*args)
    when 2 # Early / Stead / Late + Curves
      table = ESL_Curves.generate_curve(*args)
    end
    # Set 0 Defaults
    table.default = 0
    # Saves Table Information
    self.save_table(type, args, table)
    # Return Curve Information
    return table
  end
  #-------------------------------------------------------------------------
  # * Save Table
  #-------------------------------------------------------------------------
  def self.save_table(type, args, table)
    # Collects Saved Tables
    tables = self.load_tables
    # Creates Hash of Type (If non present)
    tables[type] = {} unless tables.has_key?(type)
    # Saves Table Data
    tables[type][args] = table
    # Resaves Tables to File
    save_data(tables, 'Data/Curve Generator.rvdata')    
  end
  #-------------------------------------------------------------------------
  # * Load Tables
  #-------------------------------------------------------------------------
  def self.load_tables
    # Test For Saved Table File
    unless FileTest.exist?('Data/Curve Generator.rvdata')
      # Creates Curve Generator Rxdata File
      save_data({}, 'Data/Curve Generator.rvdata')
    end
    # Returns Saved Tables
    return load_data('Data/Curve Generator.rvdata')
  end  
 
  #============================================================================
  # ** Point Slope
  #============================================================================
 
  module Point_Slope
    #------------------------------------------------------------------------
    # * Generate Curve
    #
    #   Args : min_level, max_level, start value, inflation
    #------------------------------------------------------------------------
    def self.generate_curve(min_l, max_l, start_value, inflation)
      # Creates Table
      table = {}
      # Fills Table
      for level in min_l..max_l
        table[level] = start_value + inflation * level
      end
      # Return Table
      return table
    end
  end
 
  #============================================================================
  # ** Early Late
  #============================================================================
 
  module Early_Late
    #------------------------------------------------------------------------
    # * Generate Curve
    #------------------------------------------------------------------------
    def self.generate_curve(min_l, max_l, min_v, max_v, e = 1.0, l = 1.0)
      # Creates Table
      table = {}
      # Fills Table
      for i in min_l..max_l
        # Assigns Value
        table = self.calculate_value(i, min_l.to_f, max_l.to_f,
                   min_v.to_f, max_v.to_f, e.to_f, l.to_f)
      end
      # Return Table
      return table
    end
    #------------------------------------------------------------------------
    # * Late Curve
    #------------------------------------------------------------------------
    def self.late_curve(level, min_level, max_level, min, max)
      diff = min_level - max_level
      stat = min - max
      num = stat * level ** 2 - 2 * min_level * stat * level + min_level ** 2 *
            max - 2 * min_level * max_level * min + min * min_level ** 2
      denom = diff ** 2
      return num / denom
    end
    #------------------------------------------------------------------------
    # * Early Curve
    #------------------------------------------------------------------------
    def self.early_curve(level, min_level, max_level, min, max)
      diff = max_level - min_level
      stat = max - @min
      num = -stat * level ** 2 + 2 * max_level * stat * level + min_level **
            2 * max - 2 * min_level * max_level * max + min * max_level ** 2
      denom = diff ** 2
      return num / denom    
    end
    #------------------------------------------------------------------------
    # * Steady Curve
    #------------------------------------------------------------------------
    def self.steady_curve(level, min_level, max_level, min, max)
      ch_level = max_level - min_level
      ch_stat = max - min
      base = ch_stat / ch_level * level
      mod = max * min_level - min * max_level
      base2 = mod / ch_level
      return base - base2
    end
    #------------------------------------------------------------------------
    # * Calculate Value
    #------------------------------------------------------------------------
    def self.calculate_value(level, min_level, max_level, min, max, e, l)
      return min if level < min_level
      return max if max_level < level
      if e == l
        stat = self.steady_curve(level, min_level, max_level, min, max)
      else
        early_ = self.early_curve(level, min_level, max_level, min, max)
        late_ = self.late_curve(level, min_level, max_level, min, max)
        stat = (e * early_ + l * late_) / (e + l)
      end
      stat = Integer([[stat, min].max, max].min)
      return stat
    end
  end
     
  #============================================================================
  # ** ESL_Curves
  #============================================================================
 
  module ESL_Curves
    #------------------------------------------------------------------------
    # * Generate Curve
    #------------------------------------------------------------------------
    def self.generate_curve(mn_v, md_v, mx_v, mn_l, md_l, mx_l, e = 0, l = 0,
                            s = 0, c1 = 0, c2 = 0, i = true)
      # Saves Values
      @min_value, @mid_value, @max_value = mn_v, md_v, mx_v
      @min_level, @mid_level, @max_level = mn_l, md_l, mx_l
      @early    , @late     , @steady    = e   , l   , s
      @curve1   , @curve2   , @integer   = c1  , c2  , i
      # Error Checking
      self.error_checking
      # Calculate constants
      self.calculate_constants
      # Returns Table
      return self.generate_table
    end
    #-----------------------------------------------------------------------
    # * Error Checking
    #-----------------------------------------------------------------------
    def self.error_checking
      if @late + @early + @steady + @curve1 + @curve2 == 0
        raise(StandardError, "No Influences Have Been Defined")
      elsif @min_level == @mid_level || @min_level == @max_level ||
            @mid_level == @max_level
        raise(StandardError, "Can't Use Same Level for Min, Mid, or Max Level")
      end
    end
    #-----------------------------------------------------------------------
    # * Calculate Constants
    #-----------------------------------------------------------------------
    def self.calculate_constants
      # Calculate "infi" and "inmi"
      @inmi = (@mid_value - @min_value) / (@mid_level - @min_level)
      @infi = (@max_value - @min_value) / (@max_level - @min_level)
      # Calculate "infimi"
      @infimi = (@infi - @inmi) / (@max_level - @mid_level)
    end
    #-----------------------------------------------------------------------
    # * Generate Table
    #-----------------------------------------------------------------------
    def self.generate_table
      # Create Hash table
      table = {}
      # Run Through Each Level
      self.each {|level, value| table[level] = value}
      # Return Created Table
      return table
    end
    #-----------------------------------------------------------------------
    # * Each Interator
    #-----------------------------------------------------------------------
    def self.each
      # Get Minimum level and Maximum Level
      minimum, maximum = @min_level.to_i, @max_level.to_i
      # Run Through Minimum and Maximum and Yield Level and Value
      (minimum..maximum).each {|level| yield(level, self.get_stat(level))}
    end
    #-----------------------------------------------------------------------
    # * Get Stat
    #-----------------------------------------------------------------------
    def self.get_stat(level)
      return @integer ? @min_value.to_i : @min_value if level <= @min_level
      return @integer ? @max_value.to_i : @max_value if level >= @max_level
      # Setup Total
      total = 0
      # Get Values for Every Stat if greater than 0
      total += @early  * self.early_curve(level)      if @early > 0
      total += @late   * self.late_curve(level)       if @late > 0
      total += @steady * self.steady_curve(level)     if @steady > 0
      total += @curve1 * self.early_late_curve(level) if @curve1 > 0
      total += @curve2 * self.late_early_curve(level) if @curve2 > 0
      # Get Average
      total /= @late + @early + @steady + @curve1 + @curve2
      # Limit Value
      total = level < @mid_level ?
        [total, @mid_value].min : [total, @mid_value].max
      # Further Limit Value
      total = [[total, @min_value].max, @max_value].min
      # Return Value
      return @integer ? total.to_i : total
    end
    #-----------------------------------------------------------------------
    # * Late Curve
    #-----------------------------------------------------------------------
    def self.late_curve(level)
      # Calculate "A"
      a_num = @infimi * (3 * @min_level + @mid_level) + @inmi
      a_den = (@max_level - @min_level) * (@mid_level - @min_level)
      a = - a_num / a_den
      # Return Value
      return curve(a, level)
    end
    #-----------------------------------------------------------------------
    # * Early Curve
    #-----------------------------------------------------------------------
    def self.early_curve(level)
      # Calculate "A"
      a_num = @infimi * (2 * @max_level + @min_level + @mid_level) + @inmi
      a_den = (@max_level - @mid_level) * (@max_level - @min_level)
      a = - a_num / a_den
      # Return Value
      return curve(a, level)
    end
    #-----------------------------------------------------------------------
    # * Early Late Curve
    #-----------------------------------------------------------------------
    def self.early_late_curve(level)
      # Calculate "A"
      a = @infimi / (@max_level + @min_level - 2 * @mid_level)
      # Return Value
      return curve(a, level)
    end
    #-----------------------------------------------------------------------
    # * Late Early Curve
    #-----------------------------------------------------------------------
    def self.late_early_curve(level)
      # If Less than Mid Level
      if level < @mid_level
        # Return Late Curve for level
        return late_curve(level)
      # If Greater than Mid Level
      elsif level > @mid_level
        # Return Early Curve for Level
        return early_curve(level)
      # If at Mid Level
      elsif level == @mid_level
        # Return Mid Value
        return @mid_value
      end
    end
    #-----------------------------------------------------------------------
    # * Steady Curve
    #-----------------------------------------------------------------------
    def self.steady_curve(level)
      ch_level = @max_level - @min_level
      ch_stat = @max_value - @min_value
      base = ch_stat / ch_level * level
      mod = @max_value * @min_level - @min_level * @max_level
      base2 = mod / ch_level
      return base - base2
    end
    #-----------------------------------------------------------------------
    # * Curve
    #-----------------------------------------------------------------------
    def self.curve(a, level)
      # Calculate "B"
      b = @infimi - a * (@min_level + @mid_level + @max_level)
      # Calculate "C"
      c = @inmi - a * (@mid_level ** 2 + @min_level * @mid_level +
          @min_level ** 2) - b * (@mid_level + @min_level)
      # Calculate "D"
      d = @min_value - (a * @min_level ** 3 + b * @min_level ** 2 + c *
          @min_level)
      # Calculate Stat
      stat = a * level ** 3 + b * level ** 2 + c * level + d
      # Return Stat
      return stat
    end
  end
end
[/rgss]

Now, insert the Stat Bonus Base System below that:
[rgss]#==============================================================================
# ** Stat Bonus Base (VX)
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.0
# 2009-02-11 (Year-Month-Day)
#------------------------------------------------------------------------------
# * Version History:
#
#   Version 1.0 -------------------------------------------------- (2009-02-11)
#------------------------------------------------------------------------------
# * Description:
#
#   This script was designed to provide a base for giving stats direct and
#   percent bonuses (as to prevent giving bonuses from script a, then b
#   resulting in a higher bonus).
#------------------------------------------------------------------------------
# * Instructions:
#
#   Place the script anywhere above Main and any scripts that use it.
#------------------------------------------------------------------------------
# * Terms & Conditions:
#
#   Copyright (C) 2009 SephirothSpawn (Timothy Hoffman)
#   Free for non-commercial & commercial use.
#   Any modifications to the system are not to be re-distributed without my
#   consent.
#==============================================================================
 
#==============================================================================
# ** Stat_Bonus_Base
#==============================================================================
 
module Stat_Bonus_Base
  Battler_Stat_Bonuses = ['maxhp', 'maxmp', 'atk', 'def', 'spi', 'agi']
  Actor_Stat_Bonuses   = ['hit', 'eva', 'cri']
  Enemy_Stat_Bonuses   = ['hit', 'eva', 'cri']
  # Do not modify
  Stat_Bonuses = Battler_Stat_Bonuses | Actor_Stat_Bonuses | Enemy_Stat_Bonuses
end
 
#==============================================================================
# ** Game_Battler
#==============================================================================
 
class Game_Battler
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias_method :seph_statbonusbase_gmbtlr_init, :initialize
  def initialize
    # Original Initialization
    seph_statbonusbase_gmbtlr_init
    # Create Direct & Percent Stat Bonuses
    @direct_stat_bonus, @percent_stat_bonus = {}, {}
    for s in Stat_Bonus_Base::Stat_Bonuses
      @direct_stat_bonus, @percent_stat_bonus = 0, 0
    end
  end
  #--------------------------------------------------------------------------
  # * Automatic Method Modification
  #--------------------------------------------------------------------------
  for stat in Stat_Bonus_Base::Battler_Stat_Bonuses
    s  = "alias_method :seph_statbonusbase_gmbtlr_#{stat}, :#{stat};"
    s += "def #{stat};"
    s += "  n = seph_statbonusbase_gmbtlr_#{stat};"
    s += "  n += direct_#{stat}_bonus;"
    s += "  n = Integer(n * (percent_#{stat}_bonus + 100) / 100.0);"
    s += '  return n;'
    s += 'end;'
    eval s
  end
  for stat in Stat_Bonus_Base::Stat_Bonuses
    s  = "def direct_#{stat}_bonus;"
    s += "  return @direct_stat_bonus['#{stat}'];"
    s += 'end;'
    s += "def direct_#{stat}_bonus=(n);"
    s += "  @direct_stat_bonus['#{stat}'] = n;"
    s += 'end;'
    s += "def percent_#{stat}_bonus;"
    s += "  return @percent_stat_bonus['#{stat}'];"
    s += 'end;'
    s += "def percent_#{stat}_bonus=(n);"
    s += "  @percent_stat_bonus['#{stat}'] = n;"
    s += 'end;'
    eval s
  end
end
 
#==============================================================================
# ** Game_Actor
#==============================================================================
 
class Game_Actor
  #--------------------------------------------------------------------------
  # * Automatic Method Modification
  #--------------------------------------------------------------------------
  for stat in Stat_Bonus_Base::Actor_Stat_Bonuses
    s  = "alias_method :seph_statbonusbase_gmactr_#{stat}, :#{stat};"
    s += "def #{stat};"
    s += "  n = seph_statbonusbase_gmactr_#{stat};"
    s += "  n += direct_#{stat}_bonus;"
    s += "  n = Integer(n * (percent_#{stat}_bonus + 100) / 100.0);"
    s += '  return n;'
    s += 'end;'
    eval s
  end
end
   
#==============================================================================
# ** Game_Enemy
#==============================================================================
 
class Game_Enemy
  #--------------------------------------------------------------------------
  # * Automatic Method Modification
  #--------------------------------------------------------------------------
  for stat in Stat_Bonus_Base::Enemy_Stat_Bonuses
    s  = "alias_method :seph_statbonusbase_gmenmy_#{stat}, :#{stat};"
    s += "def #{stat};"
    s += "  n = seph_statbonusbase_gmenmy_#{stat};"
    s += "  n += direct_#{stat}_bonus;"
    s += "  n = Integer(n * (percent_#{stat}_bonus + 100) / 100.0);"
    s += '  return n;'
    s += 'end;'
    eval s
  end
end
[/rgss]

And finally, insert the Class Based Stats below that:
[rgss]#==============================================================================
# ** Class Based Stats (VX)
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.0
# 2009-02-11 (Year-Month-Day)
#------------------------------------------------------------------------------
# * Version History:
#
#   Version 1.0 -------------------------------------------------- (2009-02-11)
#------------------------------------------------------------------------------
# * Description:
#
#   This script was designed to all classes to give bonuses to default
#   stats. This can replace making stats by determined by actors by simply
#   setting all stats to 0 in the Actors tab.
#------------------------------------------------------------------------------
# * Requirements:
#
#   Requires Curve Generator Module (VX) & Stat Bonus Base (VX)
#------------------------------------------------------------------------------
# * Instructions:
#
#   Place the script&#058;
#    - Below Curve_Generator & Stat Bonus Base Scripts
#    - Above Main
#------------------------------------------------------------------------------
# * Setting up Class Stats:
#
#   For each class and each stat of each class, you need to add a new line
#   after Direct_Bonuses = {}/Percent_Bonuses = {} with the following format:
#
#     Direct_Bonuses[[class_id, 'stat_name']] = [generator_args]
#      - or -
#     Percent_Bonuses[[class_id, 'stat_name']] = [generator_args]
#
#   *** See Curve Generator heading for generator_args setup.
#------------------------------------------------------------------------------
# * Terms & Conditions:
#
#   Copyright (C) 2009 SephirothSpawn (Timothy Hoffman)
#   Free for non-commercial & commercial use.
#   Any modifications to the system are not to be re-distributed without my
#   consent.
#==============================================================================
 
#==============================================================================
# ** Class_Based_Stats
#==============================================================================
 
module Class_Based_Stats
  #--------------------------------------------------------------------------
  # * Include Stat_Bonus_Base
  #--------------------------------------------------------------------------
  include Stat_Bonus_Base
  #--------------------------------------------------------------------------
  # * Stat Names
  #--------------------------------------------------------------------------
  Stat_Names = Battler_Stat_Bonuses | Actor_Stat_Bonuses
  #--------------------------------------------------------------------------
  # * Stat Bonuses
  #
  #  Direct_Bonuses[[class_id, 'stat_name']] = [generator_type, *args]
  #
  #  Stat Names : maxhp, maxmp, atk, def, spi, agi, hit, eva, cri
  #
  #  ** Refer to Curve Generator System for type and args specification.
  #--------------------------------------------------------------------------
  Direct_Bonuses  = {}
  Percent_Bonuses = {}
 
  # Class 1: maxhp
  #   type: 0, min_level:1, max_level:99, start value:400, inflation:50
  Direct_Bonuses[[1, 'maxhp']] = [0, 1, 99, 400, 50]
  # Class 1: maxmp
  #   type: 0, min_level:1, max_level:99, start value:80, inflation:10
  Direct_Bonuses[[1, 'maxmp']] = [0, 1, 99, 80, 10]
 
  #--------------------------------------------------------------------------
  # * Get Direct Stat Bonus
  #--------------------------------------------------------------------------
  def self.direct_bonus(class_id, stat_name, level)
    return self.stat_bonus(class_id, stat_name, level, Direct_Bonuses)
  end
  #--------------------------------------------------------------------------
  # * Get Percent Stat Bonus
  #--------------------------------------------------------------------------
  def self.percent_bonus(class_id, stat_name, level)
    return self.stat_bonus(class_id, stat_name, level, Percent_Bonuses)
  end
  #--------------------------------------------------------------------------
  # * Get Stat Bonus
  #--------------------------------------------------------------------------
  private
  def self.stat_bonus(class_id, stat_name, level, constant)
    # Gets key
    key = [class_id, stat_name]
    # If class & stat defined
    if constant.has_key?(key)
      # Gets table
      table = Curve_Generator.generate_curve(*constant[key])
      # Return level value
      return table[level]
    end
    # Return 0
    return 0
  end
end
 
#==============================================================================
# ** Game_Actor
#==============================================================================
 
class Game_Actor
  #--------------------------------------------------------------------------
  # * Automatic Method Modification
  #--------------------------------------------------------------------------
  for stat in Class_Based_Stats::Stat_Names
    s  = "alias_method :seph_classstats_d#{stat}, :direct_#{stat}_bonus;"
    s += "def direct_#{stat}_bonus;"
    s += "  n = seph_classstats_d#{stat};"
    s += "  n += Class_Based_Stats.direct_bonus(@class_id, '#{stat}', @level);"
    s += '  return n;'
    s += 'end;'
    s += "alias_method :seph_classstats_p#{stat}, :percent_#{stat}_bonus;"
    s += "def percent_#{stat}_bonus;"
    s += "  n = seph_classstats_p#{stat};"
    s += "  n += Class_Based_Stats.percent_bonus(@class_id, '#{stat}', @level);"
    s += '  return n;'
    s += 'end;'
    eval s
  end
end
[/rgss]

Follow the instructions in the third script heading. Let me know if yu have any questions.
 
Ah, sweet! Thanks a bunch load! :cheers:

I have two questions, is it possible to add a defensive stat that defines defense from magic ("spirit")

And, when I have a player change class his stats are changed to as if he has been that class from the start. Is it possible to make it where when a class change happens the actors current stats are unchanged but the class bonuses do change according to class?
 
OK, its alright, was just wondering. Maybe you could tell how its done, and I could try to figure it out.

Yeah, for example, the actor starts as a soldier Max HP is set to be 500 at level 1 and has an inflation of 42. When he gets to, say, level 10, he would have 920 HP. Then he gets a class change to Paladin, his stats should remain as are, but the inflation of the stats are changed according to class. If that makes anymore sense.
 

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