08-18-2007, 01:00 PM
(This post was last modified: 05-12-2017, 04:08 AM by DerVVulfman.)
Level Up AP System
Skyboar
Aug 18,2007
I know that there are a few scripts that let the player distribute their own stat points when they level up, but I wasn't too happy with the one I downloaded when it conflicted with some other scripts I had. So I decided to script my own level up system. As of the moment, you can change the hero's maxhp, maxsp, str, dex, agi, and int. I am working on how to get around the error that shows up when I try to include atk, pdef, and mdef. Anyways, those 3 last attributes have been commented out from this version of the script, so it should work fine. I have also added instructions on how to implement a pop up window when they enter the status menu asking the player if he/she wants to distribute any remaining AP of the selected hero if and only if the selected hero has remaining AP.
Anyways, here is the script. Just copy both sections of the script and paste it into one script above Main in the script editor.
I have added a lot of commented instructions at the top of the script. Please follow it carefully.
To call the script, use "$scene = Scene_AP_Distribute.new(@actor_index)"
@actor_index being the position of the heroes currently in the party.
So if Arshes was in the first position in party, he would be @actor_index = 0
Report any bugs here if you find them. Anyways, enjoy !!!
Skyboar
Aug 18,2007
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
I know that there are a few scripts that let the player distribute their own stat points when they level up, but I wasn't too happy with the one I downloaded when it conflicted with some other scripts I had. So I decided to script my own level up system. As of the moment, you can change the hero's maxhp, maxsp, str, dex, agi, and int. I am working on how to get around the error that shows up when I try to include atk, pdef, and mdef. Anyways, those 3 last attributes have been commented out from this version of the script, so it should work fine. I have also added instructions on how to implement a pop up window when they enter the status menu asking the player if he/she wants to distribute any remaining AP of the selected hero if and only if the selected hero has remaining AP.
Anyways, here is the script. Just copy both sections of the script and paste it into one script above Main in the script editor.
I have added a lot of commented instructions at the top of the script. Please follow it carefully.
To call the script, use "$scene = Scene_AP_Distribute.new(@actor_index)"
@actor_index being the position of the heroes currently in the party.
So if Arshes was in the first position in party, he would be @actor_index = 0
Report any bugs here if you find them. Anyways, enjoy !!!
AP Distribute Windows
Code:
#==============================================================================
# * Window_AP_RemainAlert #prompts the player asking to distribute remaining AP if and only if they have any remaining.
#------------------------------------------------------------------------------
#==============================================================================
class Window_AP_RemainAlert< Window_Base
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 300, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# - Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(-15, -5, 300, 32, "!!! Alert !!!", 1)
self.contents.font.color = normal_color
self.contents.draw_text(-15, 25, 300, 32, @actor.name + " has " + @actor.stat_points.to_s + " AP remaining.", 1)
self.contents.draw_text(-15, 55, 300, 32, "Distribute the remaining " + @actor.stat_points.to_s + " AP ?", 1)
end
end
#==============================================================================
# * Window_AP_RemainConfirm #prompts the player asking if he/she permanently wants to distribute remaining AP.
#------------------------------------------------------------------------------
#==============================================================================
class Window_AP_RemainConfirm < Window_Selectable
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 200, 55)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@item_max = 2
@row_max = 1
@column_max = 2
@actor = actor
@commands = ["Yes", "No"]
refresh
end
#--------------------------------------------------------------------------
# - Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
t = @commands.size
for i in 0...@commands.size
x = (i % 2) * 100
y = (i / 2) * 32
self.contents.font.color = normal_color
self.contents.draw_text(x - 15, y - 5 , 100, 32, @commands[i], 1)
end
end
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set((@index * 100), -5, 70, 32)
end
end
#--------------------------------------------------------------------------
end
#==============================================================================
# * Window_AP_Warning #prompts the player asking if he/she permanently wants to use the ap they distributed
#------------------------------------------------------------------------------
#==============================================================================
class Window_AP_Warning< Window_Base
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 300, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# - Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(-15, -5, 300, 32, "!!! WARNING !!!", 1)
self.contents.font.color = normal_color
self.contents.draw_text(-15, 25, 300, 32, "AP distributed will be permanently removed", 1)
self.contents.draw_text(-15, 55, 300, 32, "from Hero's Remaining AP count.", 1)
end
end
#==============================================================================
# * Window_AP_WarningConfirm #prompts the player asking if he/she permanently wants to use the ap they distributed
#------------------------------------------------------------------------------
#==============================================================================
class Window_AP_WarningConfirm < Window_Selectable
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 200, 55)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@item_max = 2
@row_max = 1
@column_max = 2
@commands = ["Confirm", "Cancel"]
refresh
end
#--------------------------------------------------------------------------
# - Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
t = @commands.size
for i in 0...@commands.size
x = (i % 2) * 100
y = (i / 2) * 32
self.contents.font.color = normal_color
self.contents.draw_text(x - 15, y - 5 , 100, 32, @commands[i], 1)
end
end
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set((@index * 100), -5, 70, 32)
end
end
#--------------------------------------------------------------------------
end
#==============================================================================
# * Window_AP_HeroFace
#------------------------------------------------------------------------------
#displays the hero's portrait or battler graphic as well as name, lv, class, and remaining AP.
#==============================================================================
class Window_AP_HeroFace < Window_Base
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(50, 40, 160, 300)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@actor = actor
self.z = 10
refresh
end
#======[use this for displaying hero's portrait]===============
def draw_actor_face_portrait(actor, x, y)
bitmap = RPG::Cache.picture(actor.id.to_s)
src_rect = Rect.new(0, 0, 96, 192)
self.contents.blt(28, 0, bitmap, src_rect)
end
#======[use this for displaying hero's battler portrait]===============
def draw_actor_battler(actor, x, y)
bitmap = RPG::Cache.battler(@actor.battler_name, @actor.battler_hue)
src_rect = Rect.new(0, 0, 96, 192)
self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 200, 480))
end
#======================================
#--------------------------------------------------------------------------
# - Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
x = 0
y = 0
draw_actor_battler(@actor,0,0) #used for displaying battler
#draw_actor_face_portrait(@actor, x + 28, y + 0) #used for displaying hero portrait
draw_actor_name(@actor, x + 10, y + 165)
draw_actor_level(@actor, x + 10, y + 190)
draw_actor_class(@actor, x + 10, y + 215)
self.contents.font.color = Color.new(-94, 100, -94, 255)
self.contents.draw_text(x + 10, y + 240, 320, 32, "AP", 0)
if @actor.stat_points > 0
self.contents.font.color = Color.new(255, 200, 0, 255)
self.contents.draw_text(x - 40, y + 240, 160, 32, @actor.stat_points.to_s, 2)
else
self.contents.font.color = Color.new(-100, -100, -100, 255)
self.contents.draw_text(x - 40, y + 240, 160, 32, @actor.stat_points.to_s, 2)
end
end
end
#==============================================================================
# * Window_AP_HeroStatus
#------------------------------------------------------------------------------
# displays the Hero's current status before the AP is distributed and the stat points are changed.
#==============================================================================
class Window_AP_HeroStatus < Window_Base
#--------------------------------------------------------------------------
# - Object initialization
# actor : Actor
#--------------------------------------------------------------------------
def initialize(actor)
super(10, 210, 300, 260)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# - Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(105, -5, 120, 32, "Current Stats", 0)
self.contents.font.color = normal_color
self.contents.draw_text(105, 30, 120, 32, "Max HP", 0)
self.contents.font.color = normal_color
self.contents.draw_text(105, 55, 120, 32, "Max SP", 0)
self.contents.font.color = normal_color
self.contents.draw_text(140, 30, 120, 32, @actor.maxhp.to_s, 2)
self.contents.draw_text(140, 55, 120, 32, @actor.maxsp.to_s, 2)
# draw_actor_parameter(@actor, 105, 105, 0)#char's attack
# draw_actor_parameter(@actor, 105, 130, 1)#char's phy def
# draw_actor_parameter(@actor, 105, 155, 2)#char's mag def
draw_actor_parameter(@actor, 105, 105, 3)#char's Tech
draw_actor_parameter(@actor, 105, 130, 4)#char's Critical
draw_actor_parameter(@actor, 105, 155, 5)#char's Agility
draw_actor_parameter(@actor, 105, 180, 6)#char's Spirit
end
end
#==============================================================================
# * Window_AP_Add
#------------------------------------------------------------------------------
# displays and updates the values of the subtotal and total AP distribution and stat points
#==============================================================================
class Window_AP_Add < Window_Selectable
#--------------------------------------------------------------------------
# - Object initialization
# actor : Actor
#--------------------------------------------------------------------------
def initialize(actor)
super(10, 200, 340, 270)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@item_max = 7
@row_max = 7
@column_max = 1
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# - Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(5, 0, 120, 32, "Added Stats", 0)
#-----[global variables subtotal display]----------------------------------------------------
self.contents.font.color = normal_color
self.contents.draw_text(-65, 35, 120, 32, $subtotal_stat_maxhp.to_s, 2)
self.contents.draw_text(-65, 60, 120, 32, $subtotal_stat_maxsp.to_s, 2)
#self.contents.draw_text(-65, 110, 120, 32, $subtotal_stat_atk.to_s, 2)
#self.contents.draw_text(-65, 135, 120, 32, $subtotal_stat_pdef.to_s, 2)
#self.contents.draw_text(-65, 160, 120, 32, $subtotal_stat_mdef.to_s, 2)
self.contents.draw_text(-65, 110, 120, 32, $subtotal_stat_tech.to_s, 2)
self.contents.draw_text(-65, 135, 120, 32, $subtotal_stat_crit.to_s, 2)
self.contents.draw_text(-65, 160, 120, 32, $subtotal_stat_agi.to_s, 2)
self.contents.draw_text(-65, 185, 120, 32, $subtotal_stat_spr.to_s, 2)
#-----["=" sign display]----------------------------------------------------
self.contents.font.color = normal_color
self.contents.draw_text(22, 35, 120, 32, "=", 2)
self.contents.draw_text(22, 60, 120, 32, "=", 2)
# self.contents.draw_text(22, 110, 120, 32, "=", 2)
# self.contents.draw_text(22, 135, 120, 32, "=", 2)
# self.contents.draw_text(22, 160, 120, 32, "=", 2)
self.contents.draw_text(22, 110, 120, 32, "=", 2)
self.contents.draw_text(22, 135, 120, 32, "=", 2)
self.contents.draw_text(22, 160, 120, 32, "=", 2)
self.contents.draw_text(22, 185, 120, 32, "=", 2)
#-----[global variables total display]----------------------------------------------------
self.contents.font.color = system_color
self.contents.draw_text(125, 0, 120, 32, "New Stats", 2)
self.contents.font.color = normal_color
self.contents.draw_text(125, 35, 120, 32, $total_stat_maxhp.to_s, 2)
self.contents.draw_text(125, 60, 120, 32, $total_stat_maxsp.to_s, 2)
# self.contents.draw_text(125, 110, 120, 32, $total_stat_atk.to_s, 2)
# self.contents.draw_text(125, 135, 120, 32, $total_stat_pdef.to_s, 2)
# self.contents.draw_text(125, 160, 120, 32, $total_stat_mdef.to_s, 2)
self.contents.draw_text(125, 110, 120, 32, $total_stat_tech.to_s, 2)
self.contents.draw_text(125, 135, 120, 32, $total_stat_crit.to_s, 2)
self.contents.draw_text(125, 160, 120, 32, $total_stat_agi.to_s, 2)
self.contents.draw_text(125, 185, 120, 32, $total_stat_spr.to_s, 2)
end
#-----[update of cursor]----------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, (@index * 25) + 35, 280, 28)
end
end
end
#==============================================================================
# * Window_AP_Confirm #gives options for confirming, distribute, and resetting AP.
#------------------------------------------------------------------------------
#==============================================================================
class Window_AP_Confirm < Window_Selectable
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 300, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
@item_max = 3
@row_max = 1
@column_max = 3
@commands = ["Confirm", "Distribute", "Reset"]
refresh
end
#--------------------------------------------------------------------------
# - Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
t = @commands.size
for i in 0...@commands.size
x = (i % 3) * 100
y = (i / 3) * 32
self.contents.font.color = normal_color
self.contents.draw_text(x - 15, y - 5 , 100, 32, @commands[i], 1)
end
end
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set((@index * 100), -5, 70, 32)
end
end
end
AP Distribute Scene
Code:
#==============================================================================
# * Scene_AP_Distribute
#------------------------------------------------------------------------------
# * by Skyboar
# * made August 2007
#
# * updated October 2008
# * Fixed bug with leveling up more than once in a battle gives
# * incorrect amount of AP.
# * All Scripts marked with a (***) have been modified to work with this script.
# * Implemented feature that allows for cycling through the heroes currently in
# * party without having to exit the AP Distribute Menu. Use L/R keys.
#
# * updated December 2007
# * added following fixes
# * added display of Remaining AP in each hero's status window
# * change color of AP text and value to stand out more
# * removed display of attack, pdef, and mdef as these will not be implemented
# * because I have not found a way of changing these values
#
#
# * Script allows the player to freely customize the Hero's stat points
# * including max hp, max sp, technique, critical, agility, and spirit
#
#==============================================================================
# *Instructions on how to use*
#
# Just Insert this script above "Main" in script editor.
#
#------------------------------------------------------------------------------
# Insert the following code in "Scene_Battle 2"
#
# this code: actor.stat_points += $AP * (actor.level - last_level)
#
# under this code: if actor.level > last_level
#------------------------------------------------------------------------------
#
#Insert the following code in "Game_Actor"
#
# this code: attr_accessor :stat_points
#
# under this code: class Game_Actor < Game_Battler
#
#------------------------------------------------------------------------------
#
#Insert the following code in "Game_Actor"
#
# this code: @stat_points = 0
#
# under this code: def setup(actor_id)
# actor = $data_actors[actor_id]
#
# #------------------------------------------------------------------------------
#
# * Instructions on how to implement a pop up window asking the player if he/she would
# * like to distribute any remaining AP that the selected hero has.
#
#------------------------------------------------------------------------------
#
#Insert the following code in "Scene_Status"
#
# this code:
##--------------[Used for Level Up AP System]-----------------------
#
# if @actor.stat_points > 0
# @alert = true
# else
# @alert = false
# end
#
#
# @alert_window = Window_AP_RemainAlert.new(@actor)
# @alert_window.x = 320 - (@alert_window.width / 2)
# @alert_window.y = 120
# @alert_window.z = 10000
#
# if @alert == true
# @alert_window.visible = true
# elsif @alert == false
# @alert_window.visible = false
# end
#
# @alertconfirm_window = Window_AP_RemainConfirm.new(@actor)
# @alertconfirm_window.x = 320 - (@alertconfirm_window.width / 2)
# @alertconfirm_window.y = 230
# @alertconfirm_window.z = 10001
# @alertconfirm_window.index = 0
# if @alert == true
# @alertconfirm_window.visible = true
# @alertconfirm_window.active = true
# elsif @alert == false
# @alertconfirm_window.visible = false
# @alertconfirm_window.active = false
# end
#
#
##--------------[Used for Level Up AP System]-----------------------
#
#
# under this code: def main
# @actor = $game_party.actors[@actor_index]
#
#
#
#------------------------------------------------------------------------------
#
#
#Insert the following code in "Scene_Status"
#
# this code:
#
##--------------[Used for Level Up AP System]-----------------
#
# @alert_window.dispose
# @alertconfirm_window.dispose
#
##--------------[Used for Level Up AP System]-----------------------
#
#
# under this code: Graphics.freeze
#
#
#
#
#------------------------------------------------------------------------------
#
#
#Insert the following code in "Scene_Status"
#
# this code:
#
##--------------[Used for Level Up AP System]-----------------
#@alertconfirm_window.update
# if @alertconfirm_window.active
# update_alertconfirm
# return
# end
##--------------[Used for Level Up AP System]-----------------------
#
# under this code: def update
#
# Insert the following code in "Scene_Status"
# under "def update's 'end' " but before the class's end (the very last 'end' in the scene) "
# code to be inserted into Scene_Status:
##--------------[Used for Level Up AP System]-----------------
#def update_alertconfirm
# if Input.trigger?(Input::B)
# $game_system.se_play($data_system.cancel_se)
# @alert_window.visible = false
# @alertconfirm_window.active = false
# @alertconfirm_window.visible = false
# @alert = false
# return
# end
# if Input.trigger?(Input::C)
# $game_system.se_play($data_system.decision_se)
# case @alertconfirm_window.index
# when 0
# $scene = Scene_AP_Distribute.new(@actor_index)
# when 1
# @alert_window.visible = false
# @alertconfirm_window.active = false
# @alertconfirm_window.visible = false
# @alert = false
# return
# end
#end
#----------------------------------------------------------------------
## To display the Remaining AP of each hero in the status window
## Insert the following chunk of code into Window_Status
## Insert following code under
# def.refresh
# self.contents.clear :
# #--------------------------------------------------------------------------
# #Displays the hero's remaining AP
# #--------------------------------------------------------------------------
# self.contents.font.color = Color.new(180, -94, -94, 255)
# self.contents.draw_text(320, 0, 320, 32, "Remaining AP", 0) #text that says "Remaining AP"
# if @actor.stat_points > 0
# self.contents.font.color = Color.new(255, 200, 0, 255)
# self.contents.draw_text(385, 0 , 100, 32, @actor.stat_points.to_s, 2)
# else
# self.contents.font.color = Color.new(-100, -100, -100, 255)
# self.contents.draw_text(385, 0 , 100, 32, @actor.stat_points.to_s, 2)
# end
#--------------------------------------------------------------------------
#====================================
#--------------------------------------------------------------------------
#--------------[Used for Level Up AP System]-----------------
#------------------------------------------------------------------------------
#
# *Now you are ready to define the variables for the leveling up stats scene
# *You are welcome to freely change the variables instead of using the default
# *that I set up the script up with.
#
# *Enjoy!!!
#
#==============================================================================
#-------------[global variables for leveling up system]--------------------------------
#-------------[Change the VALUES BELOW to your liking]---------------------------
#-------------[global variables for leveling up system]--------------------------------
$AP = 9 #determines how much Attribute Points each hero gets upon Level Up
#change the following values to how much is added to each hero's attribute upon AP distribution
$add_stat_maxhp = 10 #for example value 10 means that 10 will be added to the hero's max hp
$add_stat_maxsp = 3
#$add_stat_atk = 1
#$add_stat_pdef = 1
#$add_stat_mdef = 1
$add_stat_tech = 1
$add_stat_crit = 1
$add_stat_agi = 1
$add_stat_spr = 1
#-------------[global variables for leveling up system]--------------------------------
#-------------[Change the VALUES BELOW to your liking]---------------------------
#-------------[global variables for leveling up system]--------------------------------
#==============================================================================
class Scene_AP_Distribute #this is where all the magic happens
#--------------------------------------------------------------------------
# - Main processing
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
def main
@actor = $game_party.actors[@actor_index]
#-------------[global variables for leveling up system]--------------------------------
#-------------[DO NOT TAMPER WITH THESE VALUES BELOW]-------------------
#-------------[global variables for leveling up system]--------------------------------
@cycle_hero = 0 #1 = cycle left; 2 = cycle right
@old_stat_points = @actor.stat_points #used to keep track of AP amount before distribution
$total_stat_maxhp = @actor.maxhp
$total_stat_maxsp = @actor.maxsp
# $total_stat_atk = @actor.atk
# $total_stat_pdef = @actor.pdef
# $total_stat_mdef = @actor.mdef
$total_stat_tech = @actor.str
$total_stat_crit = @actor.dex
$total_stat_agi = @actor.agi
$total_stat_spr = @actor.int
$subtotal_stat_maxhp = 0
$subtotal_stat_maxsp = 0
# $subtotal_stat_atk = 0
# $subtotal_stat_pdef = 0
# $subtotal_stat_mdef = 0
$subtotal_stat_tech = 0
$subtotal_stat_crit = 0
$subtotal_stat_agi = 0
$subtotal_stat_spr = 0
#-------------[global variables for leveling up system]-------------------------------
#-------------[DO NOT TAMPER WITH THESE VALUES ABOVE]-------------------
#-------------[global variables for leveling up system]--------------------------------
@map_sprite = Spriteset_Map.new
@title_ap = Window_Base.new(0, 5, 640, 60)
@title_ap.contents = Bitmap.new(600, 60)
tstring = "Attribute (AP) Distribution"
@title_ap.contents.font.name = $defaultfonttype
@title_ap.contents.font.size = $defaultfontsize
@title_ap.contents.draw_text(0, 0, 600, 32, tstring, 1)
@title_ap.opacity = 220
@alert_window = Window_AP_Warning.new
@alert_window.x = 320 - (@alert_window.width / 2)
@alert_window.y = 120
@alert_window.z = 100000
@alert_window.opacity = 240
@alert_window.visible = false
@alertconfirm_window = Window_AP_WarningConfirm.new
@alertconfirm_window.x = 320 - (@alertconfirm_window.width / 2)
@alertconfirm_window.y = 230
@alertconfirm_window.z = 100000
@alertconfirm_window.opacity = 240
@alertconfirm_window.active = false
@alertconfirm_window.visible = false
@alertconfirm_window.index = 0
@confirm_window = Window_AP_Confirm.new
@confirm_window.x = 320 - (@confirm_window.width / 2)
@confirm_window.y = 380
@confirm_window.z = 10000
@confirm_window.opacity = 200
@confirm_window.active = true
@confirm_window.index = 1
@hero_window = Window_AP_HeroFace.new(@actor)
@hero_window.x = -10
@hero_window.y = 80
@hero_window.z = 10000
@hero_window.opacity = 200
@herostatus_window = Window_AP_HeroStatus.new(@actor)
@herostatus_window.x = 40
@herostatus_window.y = 90
@herostatus_window.z = 1000
@herostatus_window.opacity = 200
@ap_add_window = Window_AP_Add.new(@actor)
@ap_add_window.x = 330
@ap_add_window.y = 85
@ap_add_window.z = 1000
@ap_add_window.opacity = 200
@ap_add_window.active = false
@ap_add_window.index = -1
# Transition execution
Graphics.transition
# Main loop
loop do
# Renewing the game picture
Graphics.update
# Updating the information of input
Input.update
# Frame renewal
update
# When the picture changes, discontinuing the loop
if $scene != self
break
end
end
# Transition preparation
Graphics.freeze
# Releasing the window
@confirm_window.dispose
@hero_window.dispose
@herostatus_window.dispose
@ap_add_window.dispose
@alert_window.dispose
@alertconfirm_window.dispose
@map_sprite.dispose
@title_ap.dispose
# When it changes to the title picture and it is in
if $scene.is_a?(Scene_Title)
# Fading out picture
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# - Frame renewal
#--------------------------------------------------------------------------
def update
@ap_add_window.update
@confirm_window.update
@alertconfirm_window.update
if @confirm_window.active
update_confirm
return
end
if @ap_add_window.active
update_ap_add
return
end
if @alertconfirm_window.active
update_alertconfirm
return
end
end
# --------------------------------
def update_confirm
if Input.trigger?(Input::R)
# カーソル SE を演奏
if @actor.stat_points != @old_stat_points #checks to see if player has used any of the remaining AP
$game_system.se_play($data_system.buzzer_se)
@alert_window.visible = true
@alertconfirm_window.active = true
@alertconfirm_window.visible = true
@confirm_window.active = false
@confirm_window.index = -1
@cycle_hero = 2
else
$game_system.se_play($data_system.cursor_se)
# 次のアクターへ
@actor_index += 1
@actor_index %= $game_party.actors.size
# 別のステータス画面に切り替え
$scene = Scene_AP_Distribute.new(@actor_index)
end
return
end
# L ボタンが押された場合
if Input.trigger?(Input::L)
if @actor.stat_points != @old_stat_points #checks to see if player has used any of the remaining AP
$game_system.se_play($data_system.buzzer_se)
@alert_window.visible = true
@alertconfirm_window.active = true
@alertconfirm_window.visible = true
@confirm_window.active = false
@confirm_window.index = -1
@cycle_hero = 1
else
# カーソル SE を演奏
$game_system.se_play($data_system.cursor_se)
# 前のアクターへ
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# 別のステータス画面に切り替え
$scene = Scene_AP_Distribute.new(@actor_index)
end
return
end
if Input.trigger?(Input::B) #cancel
$game_system.se_play($data_system.cancel_se)
if @actor.stat_points != @old_stat_points #checks to see if player has used any of the remaining AP
@alert_window.visible = true
@alertconfirm_window.active = true
@alertconfirm_window.visible = true
@confirm_window.active = false
@confirm_window.index = -1
else
$scene = Scene_Status.new(@actor_index)
end
return
end
if Input.trigger?(Input::C) #confirm
case @confirm_window.index
when 0 #confirm distribution of ap
$game_system.se_play($data_system.decision_se)
if @actor.stat_points != @old_stat_points #checks to see if player has used any of the remaining AP
@alert_window.visible = true
@alertconfirm_window.active = true
@alertconfirm_window.visible = true
@confirm_window.active = false
@confirm_window.index = -1
else
$scene = Scene_Status.new(@actor_index)
end
when 1 #distribute ap
$game_system.se_play($data_system.decision_se)
@confirm_window.active = false
@confirm_window.index = -1
@ap_add_window.active = true
@ap_add_window.index = 0
when 2 #reset distributed ap
$game_system.se_play($data_system.decision_se)
$subtotal_stat_maxhp = 0
$subtotal_stat_maxsp = 0
# $subtotal_stat_atk = 0
# $subtotal_stat_pdef = 0
# $subtotal_stat_mdef = 0
$subtotal_stat_tech = 0
$subtotal_stat_crit = 0
$subtotal_stat_agi = 0
$subtotal_stat_spr = 0
$total_stat_maxhp = @actor.maxhp
$total_stat_maxsp = @actor.maxsp
# $total_stat_atk = @actor.atk
# $total_stat_pdef = @actor.pdef
# $total_stat_mdef = @actor.mdef
$total_stat_tech = @actor.str
$total_stat_crit = @actor.dex
$total_stat_agi = @actor.agi
$total_stat_spr = @actor.int
@actor.stat_points = @old_stat_points
@hero_window.refresh
@herostatus_window.refresh
@ap_add_window.refresh
end
return
end
end
# --------------------------------
def update_ap_add #updates the distribution of the AP to hero's attributes
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@ap_add_window.active = false
@ap_add_window.index = -1
@confirm_window.active = true
@confirm_window.index = 1
return
end
if Input.trigger?(Input::A) #resets AP
$game_system.se_play($data_system.decision_se)
$subtotal_stat_maxhp = 0
$subtotal_stat_maxsp = 0
# $subtotal_stat_atk = 0
#$subtotal_stat_pdef = 0
# $subtotal_stat_mdef = 0
$subtotal_stat_tech = 0
$subtotal_stat_crit = 0
$subtotal_stat_agi = 0
$subtotal_stat_spr = 0
$total_stat_maxhp = @actor.maxhp
$total_stat_maxsp = @actor.maxsp
# $total_stat_atk = @actor.atk
# $total_stat_pdef = @actor.pdef
# $total_stat_mdef = @actor.mdef
$total_stat_tech = @actor.str
$total_stat_crit = @actor.dex
$total_stat_agi = @actor.agi
$total_stat_spr = @actor.int
@actor.stat_points = @old_stat_points
@hero_window.refresh
@herostatus_window.refresh
@ap_add_window.refresh
return
end
if Input.repeat?(Input::LEFT) #subtract AP
$game_system.se_play($data_system.cursor_se)
case @ap_add_window.index
when 0 #subtract from maxhp
if$subtotal_stat_maxhp > 0
@actor.stat_points += 1
$subtotal_stat_maxhp = $subtotal_stat_maxhp - $add_stat_maxhp #update subtotal
$total_stat_maxhp = $total_stat_maxhp - $add_stat_maxhp #update total
else
$game_system.se_play($data_system.buzzer_se)
end
when 1 #subtract from maxsp
if$subtotal_stat_maxsp > 0
@actor.stat_points += 1
$subtotal_stat_maxsp = $subtotal_stat_maxsp - $add_stat_maxsp
$total_stat_maxsp = $total_stat_maxsp - $add_stat_maxsp #update total
else
$game_system.se_play($data_system.buzzer_se)
end
# when 3 #subtract from atk
# if$subtotal_stat_atk > 0
# @actor.stat_points += 1
# $subtotal_stat_atk = $subtotal_stat_atk - $add_stat_atk
# $total_stat_atk = $total_stat_atk - $add_stat_atk #update total
# else
# $game_system.se_play($data_system.buzzer_se)
# end
# when 4 #subtract from pdef
# if$subtotal_stat_pdef > 0
# @actor.stat_points += 1
# $subtotal_stat_pdef = $subtotal_stat_pdef - $add_stat_pdef
# $total_stat_pdef = $total_stat_pdef - $add_stat_pdef #update total
# else
# $game_system.se_play($data_system.buzzer_se)
# end
# when 5 #subtract from mdef
# if$subtotal_stat_mdef > 0
# @actor.stat_points += 1
# $subtotal_stat_mdef = $subtotal_stat_mdef - $add_stat_mdef
# $total_stat_mdef = $total_stat_mdef - $add_stat_mdef #update total
# else
# $game_system.se_play($data_system.buzzer_se)
# end
when 3 #subtract from tech
if$subtotal_stat_tech > 0
@actor.stat_points += 1
$subtotal_stat_tech = $subtotal_stat_tech - $add_stat_tech
$total_stat_tech = $total_stat_tech - $add_stat_tech #update total
else
$game_system.se_play($data_system.buzzer_se)
end
when 4 #subtract from crit
if$subtotal_stat_crit > 0
@actor.stat_points += 1
$subtotal_stat_crit = $subtotal_stat_crit - $add_stat_crit
$total_stat_crit = $total_stat_crit - $add_stat_crit #update total
else
$game_system.se_play($data_system.buzzer_se)
end
when 5 #subtract from agi
if$subtotal_stat_agi > 0
@actor.stat_points += 1
$subtotal_stat_agi = $subtotal_stat_agi - $add_stat_agi
$total_stat_agi = $total_stat_agi - $add_stat_agi #update total
else
$game_system.se_play($data_system.buzzer_se)
end
when 6 #subtract from spr
if$subtotal_stat_spr > 0
@actor.stat_points += 1
$subtotal_stat_spr = $subtotal_stat_spr - $add_stat_spr
$total_stat_spr = $total_stat_spr - $add_stat_spr #update total
else
$game_system.se_play($data_system.buzzer_se)
end
end
@hero_window.refresh
@herostatus_window.refresh
@ap_add_window.refresh
return
end
if Input.repeat?(Input::RIGHT) #add AP
if @actor.stat_points > 0
$game_system.se_play($data_system.cursor_se)
case @ap_add_window.index
when 0 #add to maxhp
@actor.stat_points -= 1
$subtotal_stat_maxhp = $subtotal_stat_maxhp + $add_stat_maxhp #update subtotal
$total_stat_maxhp = $total_stat_maxhp + $add_stat_maxhp #update total
when 1 #add to maxsp
@actor.stat_points -= 1
$subtotal_stat_maxsp = $subtotal_stat_maxsp + $add_stat_maxsp
$total_stat_maxsp = $total_stat_maxsp + $add_stat_maxsp
#when 3 #add to atk
# @actor.stat_points -= 1
# $subtotal_stat_atk = $subtotal_stat_atk + $add_stat_atk
# $total_stat_atk = $total_stat_atk + $add_stat_atk
# when 4 #add to pdef
# @actor.stat_points -= 1
# $subtotal_stat_pdef = $subtotal_stat_pdef + $add_stat_pdef
# $total_stat_pdef = $total_stat_pdef + $add_stat_pdef
# when 5 #add to mdef
# @actor.stat_points -= 1
# $subtotal_stat_mdef = $subtotal_stat_mdef + $add_stat_mdef
# $total_stat_mdef = $total_stat_mdef + $add_stat_mdef
when 3 #add to tech
@actor.stat_points -= 1
$subtotal_stat_tech = $subtotal_stat_tech + $add_stat_tech
$total_stat_tech = $total_stat_tech + $add_stat_tech
when 4 #add to crit
@actor.stat_points -= 1
$subtotal_stat_crit = $subtotal_stat_crit + $add_stat_crit
$total_stat_crit = $total_stat_crit + $add_stat_crit
when 5 #add to agi
@actor.stat_points -= 1
$subtotal_stat_agi = $subtotal_stat_agi + $add_stat_agi
$total_stat_agi = $total_stat_agi + $add_stat_agi
when 6 #add to spr
@actor.stat_points -= 1
$subtotal_stat_spr = $subtotal_stat_spr + $add_stat_spr
$total_stat_spr = $total_stat_spr + $add_stat_spr
end
@hero_window.refresh
@herostatus_window.refresh
@ap_add_window.refresh
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
# --------------------------------
def update_alertconfirm
if Input.trigger?(Input::B) #cancel
$game_system.se_play($data_system.cancel_se)
@alert_window.visible = false
@alertconfirm_window.active = false
@alertconfirm_window.visible = false
@confirm_window.active = true
@confirm_window.index = 0
return
end
if Input.trigger?(Input::C)
case @alertconfirm_window.index
when 0 #when confirm adds distributed AP to stats permanently
$game_system.se_play($data_system.decision_se)
@actor.maxhp = $total_stat_maxhp
@actor.maxsp = $total_stat_maxsp
@actor.hp = @actor.maxhp #restores the hero's hp to max
@actor.sp = @actor.maxsp #restores the hero's sp to max
#@actor.base_atk = $total_stat_atk
#@actor.base_pdef = $total_stat_pdef
#@actor.base_mdef = $total_stat_mdef
@actor.str = $total_stat_tech
@actor.dex = $total_stat_crit
@actor.agi = $total_stat_agi
@actor.int = $total_stat_spr
#--------------------------------------------
case @cycle_hero
when 0 #no cycling through heroes
$scene = Scene_Status.new(@actor_index)
when 1 #cycle through to previous hero
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_AP_Distribute.new(@actor_index)
when 2 #cycle through to next hero
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_AP_Distribute.new(@actor_index)
end
#--------------------------------------------------
when 1 #cancel
$game_system.se_play($data_system.cancel_se)
@alert_window.visible = false
@alertconfirm_window.active = false
@alertconfirm_window.visible = false
@confirm_window.active = true
@confirm_window.index = 0
#-------------------------------------------------------
end
end
end
#================================================================
end