+- Save-Point (https://www.save-point.org)
+-- Forum: Archives (https://www.save-point.org/forum-105.html)
+--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html)
+---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html)
+----- Forum: RPG Maker XP Code (https://www.save-point.org/forum-93.html)
+------ Forum: Menu/Title System (CMS) (https://www.save-point.org/forum-95.html)
+------ Thread: Level Up AP System (/thread-6346.html)
Level Up AP System - Skyboar - 08-18-2007
Level Up AP System
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.
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.
#------------------------------------------------------------------------------
#==============================================================================
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.
#------------------------------------------------------------------------------
#==============================================================================
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
#==============================================================================
# * Window_AP_Warning #prompts the player asking if he/she permanently wants to use the ap they distributed
#------------------------------------------------------------------------------
#==============================================================================
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
#------------------------------------------------------------------------------
#==============================================================================
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
#==============================================================================
# * Window_AP_HeroFace
#------------------------------------------------------------------------------
#displays the hero's portrait or battler graphic as well as name, lv, class, and remaining AP.
#==============================================================================
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)
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
#==============================================================================
# * Window_AP_Add
#------------------------------------------------------------------------------
# displays and updates the values of the subtotal and total AP distribution and stat points
#==============================================================================
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]-----------------
#----------------------------------------------------------------------
## 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"
#--------------[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
#-------------[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
#-------------[global variables for leveling up system]-------------------------------
#-------------[DO NOT TAMPER WITH THESE VALUES ABOVE]-------------------
#-------------[global variables for leveling up system]--------------------------------
# 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
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)
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