Credit goes to Blizzard, not even sure if he wants me to post his scripts but oh welz
Instructions in the script
#==============================================================================
# Stat Distribution System by Blizzard
# Version: 1.1b
# Date: 25.3.2007
# Date v1.1b: 6.4.2007
#
#
# Compatibility:
#
# 99% compatibility with everything. WILL corrupt your old savegames. Might
# cause problems with custom leveling up systems.
#
#
# Features:
#
# - distribute points between different stats
# - extra scene for point distribution with confirmation window at the end
# - calls the "caller scene" automatically when finished
# - add points by easily pressing RIGHT/LEFT
# - hold Q to add 10 points at once
# - hold W to add 100 points at once
# - a Stat Distribution System that actually works like it should...
#
# new in v1.1b:
#
# - added option to call the Points Scene after a fight with level ups
# - customizable icon position and opactity
#
# Configuration:
#
# Set up the configuration below.
#
# STARTING_POINTS - how many points should the actor have initially at level 1
# POINTS_PER_LEVEL - how many points should the actor gain per level
# DISPLAY_ICON - displays an icon on the map if ANY character in the party
# has points to distribute
# ICON_DATA - some custom options for your icon: [X_POS, Y_POS, OPACITY]
# the default values are [612, 452, 192]
# OWN_ICON - use an own icon for display (the icon has to be in the
# Icons folder and must be named "point_notify")
# EVASION_NAME - the name that should be displayed for "Evasion"
# STR_LIMIT - max possible STR
# DEX_LIMIT - max possible DEX
# AGI_LIMIT - max possible AGI
# INT_LIMIT - max possible INT
# WINDOW_MODE - set to true to have the windows at the left, set to false
# to have them to at the right
# AUTOMATIC_CALL - set to true to have the scene called automatically after
# battles if at least one character got leveled up
#
#
# You can always add stat points yourself by using following syntax:
#
# $game_party.actors[X].add_stat_points(Z)
# $game_actors[Y].add_stat_points(Z)
#
# Or you can remove them (how much sense it does is up to you...):
#
# $game_party.actors[X].remove_stat_points(Z)
# $game_actors[Y].remove_stat_points(Z)
#
# X - position of actor in the party (STARTS FROM ZERO!)
# Y - ID of actor in the database
# Z - value
#
# You can call the Scene by using a "Call script" event command. Type into the
# editor window this text:
#
# $scene = Scene_Points.new
#
#
# Side Note:
# Decreasing the level of an actor won't remove his gained stat points. You
# MUST do it manually.
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr/
# or send me an e-mail:
# boris_blizzard@yahoo.de
#==============================================================================
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
STARTING_POINTS = 0
POINTS_PER_LEVEL = 7
DISPLAY_ICON = true
ICON_DATA = [545, 400, 255]
OWN_ICON = true
EVASION_NAME = "EVA"
STR_LIMIT = 9999
DEX_LIMIT = 9999
AGI_LIMIT = 9999
INT_LIMIT = 9999
WINDOW_MODE = true
AUTOMATIC_CALL = true
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Game_System
#==============================================================================
class Game_System
alias init_sds_later initialize
def initialize
init_sds_later
reset_levels
end
def reset_levels
@old_levels = []
if AUTOMATIC_CALL and $game_actors != nil
for i in 1...$data_actors.size
@old_levels.push($game_actors[i].level)
end
end
end
def test_levelup
for i in 0...@old_levels.size
if @old_levels[i] < $game_actors[i+1].level
reset_levels
return true
end
end
return false
end
end
#==============================================================================
# Game_Party
#==============================================================================
class Game_Party
def any_points?
for actor in @actors
return true if actor.points > 0
end
return false
end
end
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
attr_reader :points
alias setup_sds_later setup
def setup(actor_id)
@points = STARTING_POINTS
setup_sds_later(actor_id)
end
alias exp_sds_later exp=
def exp=(exp)
old_level = @level
exp_sds_later(exp)
add_stat_points((@level - old_level) * POINTS_PER_LEVEL)
end
def add_stat_points(val)
@points += val if val > 0
end
def remove_stat_points(val)
@points -= val
@points = 0 if @points < 0
end
end
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base < Window
def draw_actor_battler(actor, x, y)
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch / 2, bitmap, src_rect)
end
alias draw_actor_parameter_sds_later draw_actor_parameter
def draw_actor_parameter(actor, x, y, type)
if type == 7
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, EVASION_NAME)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, actor.eva.to_s, 2)
else
draw_actor_parameter_sds_later(actor, x, y, type)
end
end
end
#==============================================================================
# Window_Distribution_Status
#==============================================================================
class Window_Distribution_Status < Window_Base
attr_accessor :actor
def initialize(actor)
super(WINDOW_MODE ? 160 : 0, 0, 480, 480)
@actor = actor
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
refresh
end
def refresh
self.contents.clear
unless @actor == nil
draw_actor_battler(@actor, 280, 120)
draw_actor_name(@actor, 4, 0)
draw_actor_class(@actor, 4, 32)
draw_actor_level(@actor, 4, 64)
draw_actor_state(@actor, 4, 96)
self.contents.font.color = system_color
self.contents.draw_text(4, 128, 80, 32, "EXP")
self.contents.draw_text(4, 160, 80, 32, "NEXT")
self.contents.font.color = normal_color
self.contents.draw_text(4, 128, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(4, 160, 84, 32, @actor.next_rest_exp_s, 2)
draw_actor_hp(@actor, 4, 224, 172)
draw_actor_sp(@actor, 4, 256, 172)
draw_actor_parameter(@actor, 4, 320, 0)
draw_actor_parameter(@actor, 4, 352, 1)
draw_actor_parameter(@actor, 4, 384, 2)
draw_actor_parameter(@actor, 4, 416, 7)
self.contents.font.color = system_color
self.contents.draw_text(240, 240, 96, 32, "Equipment")
draw_item_name($data_weapons[@actor.weapon_id], 240, 288)
draw_item_name($data_armors[@actor.armor1_id], 240, 320)
draw_item_name($data_armors[@actor.armor2_id], 240, 352)
draw_item_name($data_armors[@actor.armor3_id], 240, 384)
draw_item_name($data_armors[@actor.armor4_id], 240, 416)
end
end
end
#==============================================================================
# Window_Distribution
#==============================================================================
class Window_Distribution < Window_Selectable
attr_accessor :actor
def initialize(actor)
super(WINDOW_MODE ? 0 : 480, 160, 160, 320)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.active = false
self.index = 0
@item_max = 4
@actor = actor
@str = 0
@dex = 0
@agi = 0
@int = 0
@points = 0
refresh
end
def set_new_attributes
@actor.str += @str
@actor.dex += @dex
@actor.agi += @agi
@actor.int += @int
@actor.remove_stat_points(@points)
end
def actor=(actor)
@actor = actor
@str = @dex = @agi = @int = @points = 0
end
def refresh
self.contents.clear
unless @actor == nil
self.contents.font.color = system_color
self.contents.draw_text(52, 0, 72, 32, "DP left", 2)
self.contents.draw_text(4, 32, 120, 32, $data_system.words.str)
self.contents.draw_text(4, 96, 120, 32, $data_system.words.dex)
self.contents.draw_text(4, 160, 120, 32, $data_system.words.agi)
self.contents.draw_text(4, 224, 120, 32, $data_system.words.int)
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 48, 32, "#{actor.points-@points}", 2)
self.contents.draw_text(36, 64, 56, 32, "#{@actor.str+@str}", 2)
self.contents.draw_text(36, 128, 56, 32, "#{@actor.dex+@dex}", 2)
self.contents.draw_text(36, 192, 56, 32, "#{@actor.agi+@agi}", 2)
self.contents.draw_text(36, 256, 56, 32, "#{@actor.int+@int}", 2)
self.contents.font.size += 8
self.contents.font.bold = true
for i in 0...4
self.contents.draw_text(0, (i + 1) * 64 - 8, 32, 42, "«", 2)
self.contents.draw_text(96, (i + 1) * 64 - 8, 32, 42, "»")
end
self.contents.font.bold = false
self.contents.font.size -= 8
end
end
def any_changes?
return (@points != 0)
end
def add_point
case self.index
when 0
if @points < @actor.points and @actor.str + @str <= STR_LIMIT
@points += 1
@str += 1
return true
end
when 1
if @points < @actor.points and @actor.dex + @dex <= DEX_LIMIT
@points += 1
@dex += 1
return true
end
when 2
if @points < @actor.points and @actor.agi + @agi <= AGI_LIMIT
@points += 1
@agi += 1
return true
end
when 3
if @points < @actor.points and @actor.int + @int <= INT_LIMIT
@points += 1
@int += 1
return true
end
end
return false
end
def remove_point
case self.index
when 0
if @points > 0 and @str > 0
@points -= 1
@str -= 1
return true
end
when 1
if @points > 0 and @dex > 0
@points -= 1
@dex -= 1
return true
end
when 2
if @points > 0 and @agi > 0
@points -= 1
@agi -= 1
return true
end
when 3
if @points > 0 and @int > 0
@points -= 1
@int -= 1
return true
end
end
return false
end
def add_10_points
result = add_point
9.times{add_point} if result
return result
end
def remove_10_points
result = remove_point
9.times{remove_point} if result
return result
end
def add_100_points
result = add_10_points
9.times{add_10_points} if result
return result
end
def remove_100_points
result = remove_10_points
9.times{remove_10_points} if result
return result
end
def update
super
return unless self.active
if Input.press?(Input::R)
if Input.repeat?(Input::RIGHT)
if add_100_points
$game_system.se_play($data_system.cursor_se)
refresh
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
if Input.repeat?(Input::LEFT)
if remove_100_points
$game_system.se_play($data_system.cursor_se)
refresh
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
elsif Input.press?(Input::L)
if Input.repeat?(Input::RIGHT)
if add_10_points
$game_system.se_play($data_system.cursor_se)
refresh
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
if Input.repeat?(Input::LEFT)
if remove_10_points
$game_system.se_play($data_system.cursor_se)
refresh
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
else
if Input.repeat?(Input::RIGHT)
if add_point
$game_system.se_play($data_system.cursor_se)
refresh
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
if Input.repeat?(Input::LEFT)
if remove_point
$game_system.se_play($data_system.cursor_se)
refresh
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
def update_cursor_rect
if @index < 0 or not self.active
self.cursor_rect.empty
else
self.cursor_rect.set(32, (@index+1)*64, 64, 32)
end
end
end
#==============================================================================
# Window_Sure
#==============================================================================
class Window_Sure < Window_Command
attr_accessor :actor
def initialize(width, commands)
commands.push("")
super
@item_max = 3
refresh
end
def refresh
super
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 224, 32, "Are you sure?", 1)
end
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4, 32 * (index+1), self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(32, (@index+1)*32, 160, 32)
end
end
end
#==============================================================================
# Scene_Points
#==============================================================================
class Scene_Points
def initialize
@scene = $scene.class
end
def main
@actor = $game_party.actors[0]
commands = ["Distribute", "Next", "Previous", "Finish"]
@main_command_window = Window_Command.new(160, commands)
@main_command_window.x = WINDOW_MODE ? 0 : 480
@status = Window_Distribution_Status.new(@actor)
@distro_window = Window_Distribution.new(@actor)
commands = ["Cancel", "Accept changes", "Discard changes"]
@sure_window = Window_Sure.new(256, commands)
@sure_window.x = 320 - @sure_window.width / 2
@sure_window.y = 240 - @sure_window.height / 2
@sure_window.z = 500
@sure_window.active = @sure_window.visible = false
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
@main_command_window.dispose
@status.dispose
@distro_window.dispose
@sure_window.dispose
end
def update
@main_command_window.update
@distro_window.update
@sure_window.update
if @main_command_window.active
update_main_command
elsif @distro_window.active
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@main_command_window.active = true
@distro_window.active = false
end
elsif @sure_window.active
update_sure
end
end
def update_main_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if @distro_window.any_changes?
@main_command_window.index = 3
@main_command_window.active = false
@sure_window.active = @sure_window.visible = true
else
$scene = @scene.new
end
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @main_command_window.index
when 0
@main_command_window.active = false
@distro_window.active = true
when 1
if @distro_window.any_changes?
@main_command_window.active = false
@sure_window.active = @sure_window.visible = true
@sure_window.index = 0
else
i = (@actor.index+1) % $game_party.actors.size
@actor = @status.actor = @distro_window.actor = $game_party.actors[i]
@distro_window.refresh
@distro_window.index = 0
@status.refresh
end
when 2
if @distro_window.any_changes?
@main_command_window.active = false
@sure_window.active = @sure_window.visible = true
@sure_window.index = 0
else
i = (@actor.index+$game_party.actors.size-1) % $game_party.actors.size
@actor = @status.actor = @distro_window.actor = $game_party.actors[i]
@distro_window.refresh
@distro_window.index = 0
@status.refresh
end
when 3
if @distro_window.any_changes?
@main_command_window.active = false
@sure_window.active = @sure_window.visible = true
@sure_window.index = 0
else
$scene = @scene.new
end
end
return
end
end
def update_sure
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@main_command_window.active = true
@sure_window.active = @sure_window.visible = false
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @main_command_window.index
when 1
if @sure_window.index > 0
@distro_window.set_new_attributes if @sure_window.index == 1
i = (@actor.index+1) % $game_party.actors.size
@actor = @status.actor = @distro_window.actor = $game_party.actors[i]
@distro_window.refresh
@status.refresh
end
@main_command_window.active = true
@sure_window.active = @sure_window.visible = false
when 2
if @sure_window.index > 0
@distro_window.set_new_attributes if @sure_window.index == 1
i = (@actor.index+$game_party.actors.size-1) % $game_party.actors.size
@actor = @status.actor = @distro_window.actor = $game_party.actors[i]
@distro_window.refresh
@status.refresh
end
@main_command_window.active = true
@sure_window.active = @sure_window.visible = false
when 3
if @sure_window.index > 0
@distro_window.set_new_attributes if @sure_window.index == 1
$scene = @scene.new
end
@main_command_window.active = true
@sure_window.active = @sure_window.visible = false
end
return
end
end
end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
alias main_sds_later main
def main
main_sds_later
$scene = Scene_Points.new if $game_system.test_levelup
end
end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map
alias main_sds_later main
def main
main_sds_later
@notify.dispose if @notify != nil
end
alias upd_sds_later update
def update
check_icon if DISPLAY_ICON
upd_sds_later
$game_system.test_levelup
end
def check_icon
if $game_party.any_points?
if @notify == nil
@notify = RPG::Sprite.new
if OWN_ICON
@notify.bitmap = RPG::Cache.icon("point_notify")
else
@notify.bitmap = Bitmap.new(24, 24)
@notify.bitmap.fill_rect(0, 0, 24, 24, Color.new(255, 255, 255))
@notify.bitmap.fill_rect(22, 1, 2, 23, Color.new(0, 0, 0))
@notify.bitmap.fill_rect(1, 22, 23, 2, Color.new(0, 0, 0))
@notify.bitmap.set_pixel(23, 0, Color.new(0, 0, 0))
@notify.bitmap.set_pixel(0, 23, Color.new(0, 0, 0))
@notify.bitmap.fill_rect(2, 2, 20, 20, Color.new(224, 0, 0))
@notify.bitmap.fill_rect(4, 10, 16, 4, Color.new(255, 255, 255))
@notify.bitmap.fill_rect(10, 4, 4, 16, Color.new(255, 255, 255))
@notify.opacity = ICON_DATA[2]
end
@notify.x = ICON_DATA[0]
@notify.y = ICON_DATA[1]
@notify.z = 5000
end
elsif @notify != nil
@notify.dispose
@notify = nil
end
end
end