#==============================================================================
# Custom Stat Growing System (CSGS) by Blizzard
# version 1.31b
# Date: 20.5.2006
# Date v1.1: 24.5.2006
# Date v1.3b: 26.5.2006
# Date v1.31b: 27.6.2006
#
# RTAB Adaption (quick stab at it)
# (12-30-2006)
#
# Special Thanks:
# Viviatus - for requesting this script =D
#
# IMPORTANT NOTE:
# This script will disable the feature of leveling up. Please be sure to use
# a Custom Skill Learning System or have an appropriate script.
#
# SDK compatibilty:
# This script was NOT tested with SDK, altough there is only a 3% chance, that
# it will not work with SDK. WILL corrupt your old savegames
#
# Description:
# This script disables the ability to gain levels, altough EXP are still being
# received and can be used for another purpose. It also will allow to raise
# the character stats by other meanings than level ups.
#
# Explanation:
# - max HP will be raised if the character loses an ammount of HP, that is
# equal to a specific (and configurable) percentage of the max HP
# - max SP will be raised if the character uses an ammount of SP, that is
# equal to a specific (and configurable) percentage of the max SP
# - also it is possible to set up the succes chance of raising max HP and/or SP
# - STR will be raised if the character attacks often.
# - DEX will be raised if the character lands a critical hit or evade a status
# change.
# - INT will be raised if the character uses magic based skills, but not if
# skills are only STR, DEX and/or AGI based!
# - AGI will be raised if the character manages to evades a physical attack or
# is the very first character to act during a round.
#
# This script has a preconfiguration, but I highly recommend to configure it to
# your suits. Press CTRL+F and type CONFIGURATION to find the part, that may be
# configured.
#
# v1.1:
# Fixed bug, where dead actors gained stats.
#
# v1.3b:
# Added additional "Stat, that were raised" window.
#
#==============================================================================
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
attr_accessor :dmghp
attr_accessor :usesp
attr_accessor :xstr
attr_accessor :xdex
attr_accessor :xint
attr_accessor :xagi
alias setup_csgs_later setup
def setup(actor_id)
setup_csgs_later(actor_id)
@dmghp = 0
@usesp = 0
@xstr = 0
@xdex = 0
@xint = 0
@xagi = 0
end
def exp=(exp) # disabling level up
@exp = [[exp, 9999999].min, 0].max
# Correction if exceeding current max HP and max SP
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
end
#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler
alias attack_effect_csgs_later attack_effect
def attack_effect(attacker)
# saving old ammount of HP
last_hp = self.hp
saving = attack_effect_csgs_later(attacker)
# Is the actor the one being attacked?
if self.is_a?(Game_Actor)
# Has the actor taken damage?
if last_hp > self.hp
self.dmghp += (last_hp - self.hp)
end
if self.damage[attacker] == "Miss"
self.xagi += 1
end
end
# Is the actor the attacker?
if attacker.is_a?(Game_Actor)
# Has the actor dealt damage?
if last_hp > self.hp
attacker.xstr += 1
end
# Is the damage dealt by the actor critical?
if self.critical == true
attacker.xdex += 1
end
end
return saving
end
alias skill_effect_csgs_later skill_effect
def skill_effect(user, skill)
# saving old ammount of HP and SP
last_hp = self.hp
last_sp = user.sp
saving = skill_effect_csgs_later(user, skill)
if self.is_a?(Game_Actor)
# Has the actor taken damage?
if last_hp > self.hp
self.dmghp += (last_hp - self.hp)
end
if @state_changed == false
self.xdex += 1
end
end
if user.is_a?(Game_Actor)
# Has the actor used skill points?
if last_sp > user.sp
user.usesp += (last_sp - user.sp)
end
# Is the skill magical?
if skill.int_f != 0
user.xint += 1
end
end
return saving
end
alias slip_damage_effect_csgs_later slip_damage_effect
def slip_damage_effect
# saving old ammount of HP
last_hp = self.hp
saving = slip_damage_effect_csgs_later
if self.is_a?(Game_Actor)
# Has the actor taken damage?
if last_hp > self.hp
self.dmghp += (last_hp - self.hp)
end
end
return saving
end
end
#==============================================================================
# Window_StatsUp
#==============================================================================
class Window_StatsUp < Window_Base
attr_accessor :statups
def initialize(actor, i)
@oldhp = actor.maxhp
@oldsp = actor.maxsp
@oldstr = actor.str
@olddex = actor.dex
@oldint = actor.int
@oldagi = actor.agi
@statups = false
@index = i
super(0, 80, 160, 240)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
self.x = i * 160
self.visible = false
end
def refresh(actor)
self.contents.clear
x = 0
y = 0
self.contents.font.color = system_color
self.contents.draw_text(x, y, 64, 32, $data_system.words.hp)
self.contents.draw_text(x, y + 32, 64, 32, $data_system.words.sp)
self.contents.draw_text(x, y + 64, 96, 32, $data_system.words.str)
self.contents.draw_text(x, y + 96, 96, 32, $data_system.words.dex)
self.contents.draw_text(x, y + 128, 96, 32, $data_system.words.int)
self.contents.draw_text(x, y + 160, 96, 32, $data_system.words.agi)
self.contents.font.color = normal_color
if actor.maxhp != @oldhp
new = actor.maxhp - @oldhp
self.contents.draw_text(x, y, width - 32, 32, " + " + new.to_s, 2)
@statups = true
end
if actor.maxsp != @oldsp
new = actor.maxsp - @oldsp
self.contents.draw_text(x, y + 32, width - 32, 32, " + " + new.to_s, 2)
@statups = true
end
if actor.str != @oldstr
new = actor.str - @oldstr
self.contents.draw_text(x, y + 64, width - 32, 32, " + " + new.to_s, 2)
@statups = true
end
if actor.dex != @olddex
new = actor.dex - @olddex
self.contents.draw_text(x, y + 96, width - 32, 32, " + " + new.to_s, 2)
@statups = true
end
if actor.int != @oldint
new = actor.int - @oldint
self.contents.draw_text(x, y + 128, width - 32, 32, " + " + new.to_s, 2)
@statups = true
end
if actor.agi != @oldagi
new = actor.agi - @oldagi
self.contents.draw_text(x, y + 160, width - 32, 32, " + " + new.to_s, 2)
@statups = true
end
end
end
#==============================================================================
# Window_BattleStatus
#==============================================================================
class Window_DetailsStatus < Window_Base
def refresh(actor, level_up_flags = false)
self.contents.clear
case @status_id
when 0
draw_actor_name(actor, 4, 0)
when 1
draw_actor_hp(actor, 4, 0, 120)
when 2
draw_actor_sp(actor, 4, 0, 120)
when 3
if level_up_flags and not actor.dead?
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, "STATS UP!")
else
draw_actor_state(actor, 4, 0)
end
when 4
draw_actor_atg(actor, 4, 0, 120)
end
end
end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
alias main_csgs_later main
def main
#---------------------#
# BEGIN CONFIGURATION #
#---------------------#
@hpchance = 90 # % chance of HP raising if 50% of max HP value were lost
@spchance = 90 # % chance of SP raising if 50% of max SP value were used
@hplost = 5 # how much % of max HP must be lost, that max HP increase
@spused = 5 # how much % of max SP must be used, that max SP increase
@hprate = 100 # how much additional HP
@sprate = 100 # how much additional SP
@strchance = 70 # % chance of STR raising
@dexchance = 70 # % chance of DEX raising
@intchance = 70 # % chance of INT raising
@agichance = 70 # % chance of AGI raising
@strrate = 7 # how much additional STR points
@dexrate = 7 # how much additional DEX points
@intrate = 7 # how much additional INT points
@agirate = 7 # how much additional AGI points
@strrate_min = 1 # min xstr needed to raise STR
@dexrate_min = 1 # min xstr needed to raise DEX
@intrate_min = 1 # min xstr needed to raise INT
@agirate_min = 1 # min xstr needed to raise AGI
# In the part below you can activate or deactivate the RBB - "Reset Before
# Battle" feature, that will reset the "counters", that are counting how
# many times a stat was stimulated. Only activate this if you want that
# counters ARE RESETED TO ZERO before every fight. This will have the
# effect, that not MANY battles will raise the stats, but LONG battles.
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
actor.dmghp = 0
actor.usesp = 0
#actor.xstr = 0 # remove the # at the beginning to activate "RBB" for STR
#actor.xdex = 0 # remove the # at the beginning to activate "RBB" for DEX
#actor.xint = 0 # remove the # at the beginning to activate "RBB" for INT
#actor.xagi = 0 # remove the # at the beginning to activate "RBB" for AGI
end
#-------------------#
# END CONFIGURATION #
#-------------------#
main_csgs_later
if @statsup_windows != nil
for i in @statsup_windows
i.dispose
end
end
end
alias start_phase5_csgs_later start_phase5
def start_phase5
start_phase5_csgs_later
# Raising stats
@statsup_windows = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
@statsup_windows.push(Window_StatsUp.new(actor, i))
unless actor.dead?
# Lost enough HP to raise?
if actor.dmghp >= actor.maxhp * @hplost / 100
if rand(100) <= @hpchance
actor.maxhp += @hprate
@status_window.level_up(i)
end
end
# Lost enough SP to raise?
if actor.usesp >= actor.maxsp * @spused / 100
if rand(100) <= @spchance
actor.maxsp += @sprate
@status_window.level_up(i)
end
end
# Enough xstr gained to raise str?
if actor.xstr >= @strrate_min
if rand(100) <= @strchance
actor.str += @strrate
actor.xstr = 0
@status_window.level_up(i)
end
end
# Enough xdex gained to raise dex?
if actor.xdex >= @dexrate_min
if rand(100) <= @dexchance
actor.dex += @dexrate
actor.xdex = 0
@status_window.level_up(i)
end
end
# Enough xint gained to raise int?
if actor.xint >= @intrate_min
if rand(100) <= @intchance
actor.int += @intrate
actor.xint = 0
@status_window.level_up(i)
end
end
# Enough xagi gained to raise agi?
if actor.xagi >= @agirate_min
if rand(100) <= @agichance
actor.agi += @agirate
actor.xagi = 0
@status_window.level_up(i)
end
end
@statsup_windows[i].refresh(actor)
end
end
end
alias battle_end_csgs_later battle_end
def battle_end(result)
if result == 0
flag = true
for i in @statsup_windows
if i.statups
i.visible = true
flag = false
end
end
@result_window.visible = false
loop do
Graphics.update
Input.update
if flag
break
end
if Input.trigger?(Input::C)
break
end
end
end
battle_end_csgs_later(result)
end
alias make_action_orders_csgs_later make_action_orders
def make_action_orders
make_action_orders_csgs_later
if @action_battlers[0].is_a?(Game_Actor)
@action_battlers[0].xagi += 1
end
end
end