07-05-2024, 04:59 AM
(This post was last modified: 07-16-2024, 04:52 AM by DerVVulfman.)
DerVV's Increasing Stats
Version: 1.1
Version: 1.1
Introduction
With DerVV's Increasing Stats, you receive Upgrade Points which you may spend with an applicable menu-based script to increase the stats for your party's heroes and/or heroines.
There have been other systems similar, to be sure. But not one like this, for DerVV's Increaing Stats is a skeletal base system from which to build. It grants the spendable Upgrade Points when any actor increases in level, or may grant these same points by scripted commands by the developer. It also defines or generates the stat points that may be applied upon the hero/heroine's own stats.
What sets DerVV's Increasing Stats apart from other scripts of similar nature is its recognition that the hero's/heroine's level may be reduced. And with that, any special stat upgrades that the player had purchased may along with their level.
Features
- Spendable points can be earned for each earned level
- Spendable points may be given by script call
- Points earned may be flat rate and/or random values
- Points may be differentiated by character class
- Able to set maximum caps to spendable points
- Actor stat bonuses are tied to their levels.
- Actors losing levels can lose stat bonuses earned for that level
Screenshots
It's the base engine. Gotta deal with menu interfaces that work with this for screenies.
Script
Part 1 - Instructions
Code:
#==============================================================================
# DerVV's Increasing Stats
# -------------------------------------------------------------------------
# version 1.1
# by DerVVulfman
# 07-09-2024 (MM-DD-YYYY)
# RGSS / RPGMaker XP
#==============================================================================
# > INSTRUCTIONS AND HEADER PAGE <
#==============================================================================
#
# INTRODUCTION:
# =============
#
# With DerVV's Increasing Stats, you receive Upgrade Points which you may
# spend with an applicable menu-based script to increase the stats for your
# party's heroes and/or heroines.
#
# There have been other systems similar, to be sure. But not one like this,
# for DerVV's Increaing Stats is a skeletal base system from which to build.
# It grants the spendable Upgrade Points when any actor increases in level,
# or may grant these same points by scripted commands by the developer. It
# also defines or generates the stat points that may be applied upon the
# hero/heroine's own stats.
#
# What sets DerVV's Increasing Stats apart from other scripts of similar
# nature is its recognition that the hero's/heroine's level may be reduced.
# And with that, any special stat upgrades that the player had purchased may
# along with their level.
#
#
#------------------------------------------------------------------------------
#
# FEATURES:
# =========
#
# * Spendable points can be earned for each earned level
# * Spendable points may be given by script call
# * Points earned may be flat rate and/or random values
# * Points may be differentiated by character class
# * Able to set maximum caps to spendable points
# * Actor stat bonuses are tied to their levels.
# * Actors losing levels can lose stat bonuses earned for that level
#
#
#------------------------------------------------------------------------------
#
# INSTRUCTIONS:
# =============
#
# Paste below Scene Debug and above main. All methods that handle actor stats
# have been aliased (had code attached rather than rewritten), so place below
# any script that may rewrite these methods.
#
# Configure as desired.
#
# This system does not apply bonuses to character stats, so an outside script
# that takes advantage of this system will be required.
#
#
#------------------------------------------------------------------------------
#
# EXTENDING BEYOND THE DEFAULT:
# =============================
#
# One of the goals of DerVV's Increasing Stats was to allow developers to go
# beyond the classic/default stat scores of STR, DEX, AGI and INT. Indeed, the
# manner in which the code has been written almost ensures a simple means to
# add other statistics such as Charisma, Speed, TP points or the like.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# The first thing to note is within the Configuration Page. Along the bottom
# you will find the STAT_ORDER array and the STAT_POINTS collection.
#
# The STAT_ORDER array is a list of the Actor stats that can be upgraded by
# the system, or the abbreviation of these stats to be specific. The order in
# which they are listed within the array is the order in which the stats are
# to be accessed.
#
# And the following STAT_POINTS are hash arrays that match to each value in
# the STAT ORDER array. By that, I mean that each STAT_POINT hash array has a
# key that is identical to one of the values in the STAT_ORDER array.
#
# If you have six values in the STAT_ORDER array, you have six STAT_POINT hash
# arrays, oen for each.
#
# So if you add a "TP" stat, you would add "TP" to your STAT_ORDER array
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# The next thing to note is within the Engine page, the Game_Actor to be spe-
# cific. There are two sections of interest, the first is a list of command
# statements that begin at line number 200. These statements identify methods
# that are altered by way of the 'alias' command. And the second section of
# interest are the methods that are altered with the alias commands, these
# beginning on line 407 and ending at 463.
#
# The first section, as I stated, are a list of command statements using the
# alias method. Most of the time, you need not worry about these. But methods
# that actively alter actor statistics are not actually created by Game_Actor
# but are actually Game_Battler methods redressed for Game_Actor. Because
# of this, the statements that actively alias the actor's statistics methods
# are kept within an if...end block:
#
# if @an_anti_stack_test_value.nil?
# alias the_new_stat_name original_stat_name
# @an_anti_stack_test_value = true
# end
#
# The above example depicts how to prevent F12 Stack errors from occuring,
# errors when one attempts to 'alias' a method inherited from anotehr class.
#
# The second section, as I stated contains the methods that are altered with
# the alias methods. Each method covers a character statistic, and only has
# three lines of note IN the method:
#
#
# def maxhp
# #
# value = game_actor_stat_increase_maxhp # Perform the original method
# value += stat_increase('HP') # Obtain increase for stat
# return value # Return newer value
# #
# end
#
# The above example depicts all the actual required statements for the maxhp
# method. The first statement uses the original statement, renamed with the
# alias method, to get the original Max HP value before it gets changed. The
# next method uses the 'stat_increase' method to add the 'HP' value obtained
# from the configured STAT_POINTS hash. And teh third command merely returns
# the value.
#
# So it deals with an aliased/renamed method, a command that refers to the
# configuration section, and then returns it! That's it!
#
#
#------------------------------------------------------------------------------
#
# SCRIPT CALLS:
# =============
#
# This system has eight script calls. Of these script calls, there are four
# that are applied to an actor based upon its index position within his/her
# party. And the other four are identical versions that function based upon
# his/her position within the Actor's Database.
#
# * Adding spendable points
# -----------------------
# To add spendable points by means other than increaing levels, you may
# use either of the two script calle below:
#
# * add_member_stat_points(member_idx, points)
# * add_actor_stat_points(actor_id, points)
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# * Remove spendable points
# -----------------------
# To erase spendable points by means other than increaing levels, you may
# use either of the two script calle below:
#
# * remove_member_stat_points(member_idx, points)
# * remove_actor_stat_points(actor_id, points)
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# * Get spendable points
# --------------------
# The two script calls merely return how many spendable points for any
# given actor:
#
# * get_member_stat_points(member_idx)
# * get_actor_stat_points(actor_id)
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# * Trigger point spending
# ----------------------
# This sets a flag for a given actor that compatible scripts can access,
# a flag informing said outside scripts that the player may now spend the
# points for stat bonuses:
#
# * trigger_member_stat_points(member_idx)
# * trigger_actor_stat_points(actor_id)
#
#
#==============================================================================
#
# COMPATABILITY:
# ==============
#
# Designed for RPGMaker XP. Requires an outside script to apply stat bonuses.
#
#
#==============================================================================
#
# TERMS and CONDITIONS:
# =====================
#
# Free for use, even in commercial scripts. Due credit to all involved is
# the only requirement.
#
#
#==============================================================================
Part 2 - Configuration Page
Code:
#==============================================================================
# DerVV's Increasing Stats
# -------------------------------------------------------------------------
# version 1.1
# by DerVVulfman
# 07-09-2024 (MM-DD-YYYY)
# RGSS / RPGMaker XP
#==============================================================================
# > CONFIGURATION PAGE <
#==============================================================================
#==============================================================================
# ** DVV_Stat_Increase
#------------------------------------------------------------------------------
# This module is the configuration module. Please perform changes only within
# this page unless you are an experienced scripter.
#==============================================================================
module DVV_Stat_Increase
#--------------------------------------------------------------------------
STAT_POINTS = {} # Do Not Touch
#--------------------------------------------------------------------------
# POINT SYSTEM TEST
# =================
# Returns an error message at start unless values correctly defined. This
# section also contains the actual texts for the error message, this for
# non-English users who may wish to adapt it for other languages.
# -------------------------------------------------------------------------
#
TEST = true
# -----------------------------------------------------------------------
MSG1 = "Warning:"
MSG2 = "n\nThe CLASS_USE setting is incorrectly set." +
" It must be set to either true or false."
MSG3 = "n\nThe ONE_TIME_STAT_GEN setting is incorrectly set"+
" It must be set to either true or false."
MSG4 = "\n\nA match error exists between the Stat Order and Stat points."
MSG5 = "\n\nThe Class system is engaged. You have too few classes for" +
" usage if you define random values for upgrade/stat points."
MSG6 = "\n\nThere are issues with the Level Points configurable."
MSG7 = "\n\nThe Level Points Cap was assigned invalid data."
MSG8 = "\n\nThere are issues with the following Stat Points:\n"
# CLASS ARRAY USAGE
# =================
# This feature allows the system to have individual point assignements to
# each actor by their character class. Fot it to function, the defined stat
# within the configuration page must have as many parameters/values as the
# project has character classes within the database. If engaged, the system
# will still allow flat-rate and 1 & 2 parameter arrays for variable random
# point generation.
# -------------------------------------------------------------------------
#
CLASS_USE = true
# ONE-TIME STAT BONUS GENERATION
# ==============================
# By design, the points which an actor may receive for any stat may be ran-
# domly generated each time they level. Or the actors may have their bonus
# points randomly generated at game start, the point awarded fixed then-on.
# This assumes you are allowing stat bonuses to be randomized.
# -------------------------------------------------------------------------
#
ONE_TIME_STAT_GEN = true # Random stats generate once?
# LEVEL INCREASE POINTS
# =====================
# Points earned per level gained. Points equal number of increases possible
# Non-Array values are flat-rate. Single value arrays are simply randomized
# values. And two-parameter arrays are min-max range arrays.
# -------------------------------------------------------------------------
#
LEVEL_POINTS = [5,25,5,5,5,5,5,5] # Points per level
# LEVEL POINTS CAP
# ================
# This is a simple value that sets the maximum number of points any actor
# may gain before having to spend them. Once this maximum value has been
# reached, no further points will be received. Do know that a value below 1
# disables the maximum capacity feature.
# -------------------------------------------------------------------------
#
LEVEL_POINTS_CAPS = 10 # Maximum number of points
# STAT ORDER
# ==========
# Essentially, this is a list of the keys for the below statistics in the
# order in which they are normally presented. This should be a mimic to any
# order presented within the additional point-distribution system.
# -------------------------------------------------------------------------
#
STAT_ORDER = [ 'HP', 'SP', 'STR', "DEX", 'AGI', 'INT']
# INDIVIDUAL STAT POINTS
# ======================
# Points applied to a statistic. Each entry is for its own stat, so HP may
# increase higher than SP, or DEX faster than STR. The points defined use
# same standard as LEVEL INCREASE POINTS in regards of flat-rate and random
# value generation.
# -------------------------------------------------------------------------
#
STAT_POINTS['HP'] = [[20],25,20,15,10,10,10,5] # Hit Points per class
STAT_POINTS['SP'] = 20 # Skill Points (flat 20 pts)
STAT_POINTS['STR'] = [5] # Stremgth (random from 1-5 pts)
STAT_POINTS['DEX'] = [25] # Dexterity (random from 1-25 pts)
STAT_POINTS['AGI'] = [5, 10] # Agility (random from 5-10 pts)
STAT_POINTS['INT'] = 4 # Intelligence (flat 4 pts)
end
Part 3 - The Engine
Code:
#==============================================================================
# DerVV's Increasing Stats
# -------------------------------------------------------------------------
# version 1.1
# by DerVVulfman
# 07-09-2024 (MM-DD-YYYY)
# RGSS / RPGMaker XP
#==============================================================================
# > ENGINE <
#==============================================================================
#==============================================================================
# ** DVV_Stat_Increase
#------------------------------------------------------------------------------
# This module performs tests upon the data supplied within the configuration
# page. It verifies the size and connectivity between the STAT_ORDER and the
# STAT_POINTS arrays, and that properly defined values have been created.
#==============================================================================
module DVV_Stat_Increase
#--------------------------------------------------------------------------
module_function # Permit following to be executable methods
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Test subject value if flat value, or if either 1 or 2 param array
# value : tested value
#--------------------------------------------------------------------------
def test_values
#
# Tests
evaluation1 = test_stat_boolean(CLASS_USE)
evaluation2 = test_stat_boolean(ONE_TIME_STAT_GEN)
evaluation3 = test_stat_keys
evaluation4 = test_stat_classes_size
evaluation5 = test_stat_values(LEVEL_POINTS)
evaluation6 = test_integer(LEVEL_POINTS_CAPS)
if evaluation6
evaluation6 = false if LEVEL_POINTS_CAPS < 0
end
evaluation7 = []
# Show not functioning if any stat point entries fail
for key in STAT_ORDER
next unless STAT_POINTS.has_key?(key)
next if test_stat_values(STAT_POINTS[key])
evaluation7.push(key)
end
#
# Set warning header while assuming no issues
text_display = false
text = MSG1
#
# Apply warnings for each failed tests
unless evaluation1
text += MSG2
text_display = true
end
# Apply warnings for each failed tests
unless evaluation2
text += MSG3
text_display = true
end
# Apply warnings for each failed tests
unless evaluation3
text += MSG4
text_display = true
end
unless evaluation4
text += MSG5
text_display = true
end
unless evaluation5
text += MSG6
text_display = true
end
unless evaluation6
text += MSG7
text_display = true
end
if evaluation7.size > 0
text_display = true
text += MSG8
for i in 0...evaluation7.size
text += evaluation7[i] + " "
end
end
#
# Exit if no warning
return unless text_display
#
# Display the error
print text
#
end
#--------------------------------------------------------------------------
# * Determine if a valid boolean value
#--------------------------------------------------------------------------
def test_stat_boolean(value)
return true if value.is_a?(TrueClass)
return true if value.is_a?(FalseClass)
return false
end
#--------------------------------------------------------------------------
# * Test comparison between ORDER array and POINTS hash
#--------------------------------------------------------------------------
def test_stat_keys
#
keys = STAT_POINTS.keys
size1 = keys.size
size2 = STAT_ORDER.size
return false unless size1 == size2
for key in keys
return false unless STAT_ORDER.include?(key)
end
return true
#
end
#--------------------------------------------------------------------------
# * Test to ensure-suggest no fewer than 3 classes when Class Use engaged
#--------------------------------------------------------------------------
def test_stat_classes_size
#
return true unless CLASS_USE
$data_classes = load_data("Data/Classes.rxdata")
class_size = $data_classes.size - 1
return true if class_size > 3
return false
#
end
#--------------------------------------------------------------------------
# * Test to ensure no issues with configurable values
# value : tested value
#--------------------------------------------------------------------------
def test_stat_values(value)
#
# Basic test if not using class system
return test_flat_random(value) unless CLASS_USE
#
# Acquire number of classes
$data_classes = load_data("Data/Classes.rxdata")
class_size = $data_classes.size - 1
#
# Basic test as value not prepped for class system
return test_flat_random(value) unless value.size == class_size
#
#
effective = true
for i in 1..class_size
subval = value[i-1]
effective = false if test_flat_random(subval) == false
end
#
return effective
#
end
#--------------------------------------------------------------------------
# * Test subject value if flat value, or if either 1 or 2 param array
# value : tested value
#--------------------------------------------------------------------------
def test_flat_random(value)
#
return true if test_integer(value)
return false unless value.is_a?(Array)
test_size = value.size
if test_size == 1
return true if test_integer(value[0])
end
if test_size == 2
return false unless test_integer(value[0])
return false unless test_integer(value[1])
return false unless value[1] > value[0]
return true
end
return false
#
end
#--------------------------------------------------------------------------
# * Test subject value to ensure valid integer
# value : tested value
#--------------------------------------------------------------------------
def test_integer(value)
#
return false if value.nil?
return false if value.is_a?(String)
return true if value.is_a?(Integer)
#
end
end
#----------------------------------------------------------------------------
# * Trigger execution of system test at start if defined
#----------------------------------------------------------------------------
DVV_Stat_Increase.test_values if DVV_Stat_Increase::TEST
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :upgrade_trigger # Flag giving menu access
attr_accessor :upgrade_points # Number of stats able to be raised
attr_accessor :upgrade_stats # Stat changes per level attained
attr_accessor :stored_stats # Available changes at the time
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias game_actor_stat_increase_setup setup
alias game_actor_stat_increase_exp exp=
# -- Following: One for each stat --
# -- Each method a child of Game_Battler --
# -- So requires Anti-Stack protection --
if @anti_stack_game_actor_stat_increase.nil?
alias game_actor_stat_increase_maxhp maxhp
alias game_actor_stat_increase_maxsp maxsp
alias game_actor_stat_increase_str base_str
alias game_actor_stat_increase_dex base_dex
alias game_actor_stat_increase_agi base_agi
alias game_actor_stat_increase_int base_int
@anti_stack_game_actor_stat_increase = true
end
#--------------------------------------------------------------------------
# * Aliased Methods
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Setup
# actor_id : actor ID
#--------------------------------------------------------------------------
def setup(actor_id)
#
game_actor_stat_increase_setup(actor_id) # Perform the original method
stat_increase_setup(actor_id) # Setup new stat values
#
end
#--------------------------------------------------------------------------
# * Change EXP
# exp : new EXP
#--------------------------------------------------------------------------
def exp=(exp)
#
test_level = @level # Set the test level
#
game_actor_stat_increase_exp(exp) # Perform the original method
#
return if test_level == @level # Exit if no level change
if test_level < @level # If increase found,
return stat_level_increase(test_level) # run level increase
end
stat_level_decrease(test_level) # Else, Run level decrease
#
end
#--------------------------------------------------------------------------
# * New Content
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Determine if using a class-based array stat
# value : value to be tested
#--------------------------------------------------------------------------
def stat_class_test(value)
return false unless DVV_Stat_Increase::CLASS_USE == true
return true if value.size == @class_size
return false
end
#--------------------------------------------------------------------------
# * Setup Stats for Value Increase
# actor_id : actor ID
#--------------------------------------------------------------------------
def stat_increase_setup(actor_id)
#
# Define number of classes for test
$data_classes = load_data("Data/Classes.rxdata")
@class_size = $data_classes.size - 1
#
# Additional variable content
@upgrade_trigger = false
@upgrade_points = 0
@upgrade_stats = {}
@stored_stats = []
#
# Cycle through all stats and set defaults
for key in DVV_Stat_Increase::STAT_POINTS.keys
@upgrade_stats[key] = [0]
@stored_stats.push(0)
end
#
end
#--------------------------------------------------------------------------
# * Increase Stat Point Size per Level
# test_level : difference between levels
#--------------------------------------------------------------------------
def stat_level_increase(test_level)
#
levels = @level - test_level # Calculate level change
#
# Cycle through levels attained
for i in 0...levels
#
@upgrade_points += stat_level_upgrade_points # Add points per level
# Cycle through all stats
for key in DVV_Stat_Increase::STAT_POINTS.keys
#
index = @upgrade_stats[key].size # Get array size
value = @upgrade_stats[key][index-1] # Get last value
@upgrade_stats[key].push(value) # Push as placeholder
#
end
#
end
#
store_upgrade_stat_points # Create stored points
@upgrade_trigger = true # Set flag allowing upgrades
#
# Acquire max points capacity, or exit
max_points = DVV_Stat_Increase::LEVEL_POINTS_CAPS
return if max_points < 1
#
# Keep points within capacity range
if @upgrade_points > max_points
@upgrade_points = max_points
end
#
end
#--------------------------------------------------------------------------
# * Decrease Stat points per Level
# test_level : difference between levels
#--------------------------------------------------------------------------
def stat_level_decrease(test_level)
#
# Cycle through all stats
for key in DVV_Stat_Increase::STAT_POINTS
index = @upgrade_stats[key].size # Get current size
next if index == 1 # Skip if at level 1
next if index <= @level # Skip if below current level
temp_array = @upgrade_stats[key] # Get stats leveled array
temp_array = temp_array[0,@level] # Get proper array size
@upgrade_stats[key] = temp_array # Re-assign
end
#
end
#--------------------------------------------------------------------------
# * Get level upgrade points
#--------------------------------------------------------------------------
def stat_level_upgrade_points
#
id = @class_id - 1 # Get Class ID
value = DVV_Stat_Increase::LEVEL_POINTS # Get Configured level points
value = value[id] if stat_class_test(value) # Acquire if Class ID used
return stat_increase_flat_random(value) # Return calculated value
#
end
#--------------------------------------------------------------------------
# * Generate upgrade stat points
#--------------------------------------------------------------------------
def store_upgrade_stat_points
#
id = @class_id - 1 # Get Class ID
#
@stored_stats = [] # Make the stored stat array
#
# Cycle through all stats by 'stat order'
# and push current values into stat-value array
stat_size = DVV_Stat_Increase::STAT_ORDER.size
for i in 0...stat_size
#
key = DVV_Stat_Increase::STAT_ORDER[i] # Get Key from order array
value = DVV_Stat_Increase::STAT_POINTS[key] # Get proper Points value
value = value[id] if stat_class_test(value) # Acquire if Class ID used
value = stat_increase_flat_random(value) # Calculate stat points
@stored_stats.push(value) # Store points for use
#
end
#
end
#--------------------------------------------------------------------------
# * Get returned stat value if either flat or random
#--------------------------------------------------------------------------
def stat_increase_flat_random(value)
#
return value unless value.is_a?(Array) # Return value if an integer
array_size = value.size # Get array size
if array_size == 1 # If single param array
return (rand(value[0]) + 1) # Randomize value
else
min = value[0] # Get min - flat rate to add
max = value[1] - min # Get randomized value
return (rand(max) + 1 + min) # Randomize for range
end
#
end
#--------------------------------------------------------------------------
# * Get calculated increase for applied statistic
# stat_id : stat ID
#--------------------------------------------------------------------------
def stat_increase(stat_id)
#
return 0 if @upgrade_stats.nil? # Exit with 0 if invalid
return 0 if @upgrade_stats[stat_id].nil? # Exit with 0 if invalid stat
index = @upgrade_stats[stat_id].size # Get size of array
value = @upgrade_stats[stat_id][index-1] # Get last increase from index
return value # Return with last increase
#
end
#--------------------------------------------------------------------------
# * Aliased Stat Methods (Ensure F12 protection as inherits from Battler)
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Get Maximum HP
#--------------------------------------------------------------------------
def maxhp
#
value = game_actor_stat_increase_maxhp # Perform the original method
value += stat_increase('HP') # Obtain increase for stat
return value # Return newer value
#
end
#--------------------------------------------------------------------------
# * Get Maximum SP
#--------------------------------------------------------------------------
def maxsp
#
value = game_actor_stat_increase_maxsp # Perform the original method
value += stat_increase('SP') # Obtain increase for stat
return value # Return newer value
#
end
#--------------------------------------------------------------------------
# * Get Maximum HP
#--------------------------------------------------------------------------
def base_str
#
value = game_actor_stat_increase_str # Perform the original method
value += stat_increase('STR') # Obtain increase for stat
return value # Return newer value
#
end
#--------------------------------------------------------------------------
# * Get Basic Dexterity
#--------------------------------------------------------------------------
def base_dex
#
value = game_actor_stat_increase_dex # Perform the original method
value += stat_increase('DEX') # Obtain increase for stat
return value # Return newer value
#
end
#--------------------------------------------------------------------------
# * Get Basic Agility
#--------------------------------------------------------------------------
def base_agi
#
value = game_actor_stat_increase_agi # Perform the original method
value += stat_increase('AGI') # Obtain increase for stat
return value # Return newer value
#
end
#--------------------------------------------------------------------------
# * Get Basic Intelligence
#--------------------------------------------------------------------------
def base_int
#
value = game_actor_stat_increase_int # Perform the original method
value += stat_increase('INT') # Obtain increase for stat
return value # Return newer value
#
end
end
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Add points to target member
# member_idx : party member by index
# points : points to add
#--------------------------------------------------------------------------
def add_member_stat_points(member_idx, points)
max_points = DVV_Stat_Increase::LEVEL_POINTS_CAPS
current_points = $game_party.actors[member_idx].upgrade_points
current_points += points
if max_points > 0
current_points = max_points if current_points > max_points
end
return if max_points < 1
$game_party.actors[member_idx].upgrade_points = current_points
end
#--------------------------------------------------------------------------
# * Remove points from target member
# member : party member by index
# points : points to remove
#--------------------------------------------------------------------------
def remove_member_stat_points(member_idx, amount)
add_member_stat_points(member_idx, -amount)
end
#--------------------------------------------------------------------------
# * Return target member points
#--------------------------------------------------------------------------
def get_member_stat_points(member_idx)
return $game_party.actors[member_idx].upgrade_points
end
#--------------------------------------------------------------------------
# * Trigger point usage for target member
#--------------------------------------------------------------------------
def trigger_member_stat_points(member_idx)
$game_party.actors[member_idx].upgrade_trigger = true
$game_party.actors[member_idx].store_upgrade_stat_points
end
#--------------------------------------------------------------------------
# * Add points to database actor
# actor_id : database actor by ID
# points : points to add
#--------------------------------------------------------------------------
def add_actor_stat_points(actor_id, points)
max_points = DVV_Stat_Increase::LEVEL_POINTS_CAPS
current_points = $game_actors[actor_id].upgrade_points
current_points += points
if max_points > 0
current_points = max_points if current_points > max_points
end
return if max_points < 1
$game_actors[actor_id].upgrade_points = current_points
end
#--------------------------------------------------------------------------
# * Remove points from database actor
# actor_id : database actor by ID
# points : points to remove
#--------------------------------------------------------------------------
def remove_actor_stat_points(actor_id, amount)
add_actor_stat_points(actor_id, -amount)
end
#--------------------------------------------------------------------------
# * Return database actor points
# actor_id : database actor by ID
#--------------------------------------------------------------------------
def get_actor_stat_points(actor_id)
return $game_actors[actor_id].upgrade_points
end
#--------------------------------------------------------------------------
# * Trigger point usage for database actor
# actor_id : database actor by ID
#--------------------------------------------------------------------------
def trigger_actor_stat_points(actor_id)
$game_actors[actor_id].upgrade_trigger = true
$game_actors[actor_id].store_upgrade_stat_points
end
end
Instructions
Paste below Scene Debug and above main. All methods that handle actor stats have been aliased (had code attached rather than rewritten), so place below any script that may rewrite these methods.
Known Demos with D.I.S in Use
Compatibility
Designed for RPGMaker XP. Requires an outside script to apply stat bonuses.
Terms of Use
Free for use, even in commercial scripts. Due credit to all involved is the only requirement.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
![[Image: QrnbKlx.jpg]](https://i.imgur.com/QrnbKlx.jpg)
![[Image: sj0H81z.png]](https://i.imgur.com/sj0H81z.png)
![[Image: BwtNdKw.png%5B]](https://i.imgur.com/BwtNdKw.png%5B)
Above are clickable links
![[Image: QrnbKlx.jpg]](https://i.imgur.com/QrnbKlx.jpg)
![[Image: sGz1ErF.png]](https://i.imgur.com/sGz1ErF.png)
![[Image: liM4ikn.png]](https://i.imgur.com/liM4ikn.png)
![[Image: fdzKgZA.png]](https://i.imgur.com/fdzKgZA.png)
![[Image: sj0H81z.png]](https://i.imgur.com/sj0H81z.png)
![[Image: QL7oRau.png]](https://i.imgur.com/QL7oRau.png)
![[Image: uSqjY09.png]](https://i.imgur.com/uSqjY09.png)
![[Image: GAA3qE9.png]](https://i.imgur.com/GAA3qE9.png)
![[Image: 2Hmnx1G.png]](https://i.imgur.com/2Hmnx1G.png)
![[Image: BwtNdKw.png%5B]](https://i.imgur.com/BwtNdKw.png%5B)
Above are clickable links