Script Name: Gumps Level Up Bonus Script Script Author: Matt Sully Script Version: BETA 1.02.F
Information: This script was inspired by the mario rpg level up bonus effect where players could add bonus stats to actors when they leveled up. This script intends to imitate that functionality. The script comes with a bunch of settings and is built to be highly customizable.
Legal Information: You may freely use this script in any free or commercial game but you are required to provide credit to the script author. See the Legal Terms of Use near the top of the script for more information.
Install Notes: Copy the script into a new, empty spot within your script materials section. Configure the settings to tailor the script to your game.
Script:
Spoiler
Code:
$gumpindex ||= {}; $gumpindex[:lvlbonus] = [true, 1.0]module Gump module LVL_BONUS#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+# *** Gumps Level up Bonus Script# *** VERSION: BETA 1.02.F# *** Script Author: Matt Sully#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+# * Information#---------------------------------------------------------------------# > A mario rpg inspired system that allows the player to assign parameter# bonuses when they level up an actor.# > Don't touch anything outside the settings unless you know what yer doin'!# > This is an early version script! Got any cool ideas for it? Let me know.# > This script does not have any requirements and should be compatible with# all other scripts and battle systems.# > The Level bonus checking is done within Scene_Map for now. If an actor# has leveled, the next idle frame the player has on Scene_Map will trigger# the level bonus scene.#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+# * Dont touch these. Initization of settings hashes:# Custom_Params = {} # don't touch this line Custom_Params[:BONUS] = {} # don't touch this line Scene_BG_Color = {} # don't touch this line Scene_Windows = {}; Scene_Windows[:OFFSETS] = {} # don't touch this line Scene_Windows[:PROPERTIES] = {} # don't touch this line Scene_Windows[:PROPERTIES][:WIN_MESSAGE] = {} # don't touch this line Scene_Windows[:PROPERTIES][:WIN_FEEDBACK] = {} # don't touch this line Scene_Windows[:PROPERTIES][:WIN_COMMAND] = {} # don't touch this line Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG] = {} # don't touch this line Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD] = {} # don't touch this line Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS] = {} # don't touch this line Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT] = {} # don't touch this line Misc = {}; Misc[:sound] = {} # don't touch this line Misc[:vocab] = {}; Misc[:vocab][:confirm_window] = {} # don't touch this line Misc[:vocab][:command_window] = {}; Misc[:vocab][:message_window] = {} # don't touch this line Misc[:other] = {}; Misc[:other][:map_overrides] = [] # don't touch this line## * Don't touch those! They are important and stuff.##+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+# * LEGAL TERMS OF USE:# > You may freely use this script in any free or commercial game.# > If you use this script, you must provide credit to the script author.# > You may modify and use modifications of this script freely.#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+# * VERSION CHANGELOG:#---------------------------------------------------------------------# * BETA 1.02.B-F# > New option to enable or disable autocalling of the level bonus scene. If it# is disabled developers must call the scene manually with the standard:# SceneManager.call(Gump_Level_Bonus_Scene)# > Map ID override setting added. Now developers can add map ids where the# Level Bonus scene won't be called if autocalling is enabled.## * BETA 1.02.A# > All windows now have full opacity settings (3 opacity settings each) which# means control over windows border, background and contents transparency.## * BETA 1.01.A-F# > Script now uses a single scene. 200+ reduction in script linecount.# > "Available Bonuses" Window now dissapears via animation+closing if the actor# only has 1 point available. If the actor has more than 1 point, the window is# visible.# > Exposed a variety of all windows properties as new settings. Things such as# x and y positions, width and height settings and a few other things are now# easily configurable.# > Fixed some comments and removed some print commands left over from testing.## * BETA 1.00# > Initial release.#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+ #=========================================================================== # ***** SETTINGS ***** #=========================================================================== # #--------------------------------------------------------------------------- # * Autocall Bonus Scene # > if true, the level bonus scene is automatically called from scene_map # on the next idle frame. # > if false, you must manually call the scene elsewhere in your game. # > You can call the scene with SceneManager.call(Gump_Level_Bonus_Scene) #--------------------------------------------------------------------------- Autocall_Bonus_Scene = true # #--------------------------------------------------------------------------- # * Map Overrides # > Adding map id's to this option will prevent the level bonus scene from # being called on the defined map id's if Autocall_Bonus_Scene is true. # > To add data copy/paste this and replace the 0 with the new map id: # Misc[:other][:map_overrides] << 0 # > Put each setting on a new line. You can have any amount of ids. Misc[:other][:map_overrides] << 0 # * DO NOT insert map overrides below this line. # #--------------------------------------------------------------------------- # * Sound Effect Setup # > Settings for sound effect, which if enabled will play when the player # applies a bonus on an actor in the game. # > Play_Sound must be true or false # > Filename must be a "string" (sound must be in Audio/SE folder) # > Volume range: 0 - 100 # > Pitch range: 50 - 150 #--------------------------------------------------------------------------- Misc[:sound][:Play_Sound] = true Misc[:sound][:Filename] = "Recovery" Misc[:sound][:Volume] = 55 Misc[:sound][:Pitch] = 100 # > Pop sound plays when the level bonus scene opens Misc[:sound][:Pop_sound] = true Misc[:sound][:Filename_p] = "Item3" Misc[:sound][:Volume_p] = 60 Misc[:sound][:Pitch_p] = 50 # #--------------------------------------------------------------------------- # * Script Vocabulary settings # > Vocabulary settings for stuff... #--------------------------------------------------------------------------- Misc[:vocab][:confirm_window][:none] = "Nothing" Misc[:vocab][:confirm_window][:apply_msg] = "Apply Bonus to" Misc[:vocab][:confirm_window][:confirm] = "Are you sure?" Misc[:vocab][:command_window][:confirm] = "Confirm" Misc[:vocab][:command_window][:cancel] = "Cancel" Misc[:vocab][:class_title] = "Class:" Misc[:vocab][:level_bonus_added] = "LEVEL UP BONUS ADDED!" Misc[:vocab][:message_window][:msg_title] = "LEVEL UP BONUS!" Misc[:vocab][:message_window][:msg_line1] = "Choose your Level up Bonus." Misc[:vocab][:message_window][:msg_line2] = "Bonuses are permanent and immediate." Misc[:vocab][:message_window][:msg_line3] = "You will gain a small bonus to the" Misc[:vocab][:message_window][:msg_line4] = "parameter that you choose." Misc[:vocab][:remaining] = "Available Bonuses:" # #--------------------------------------------------------------------------- # * Scene Background Color # > Values Range: 0 - 255 #--------------------------------------------------------------------------- Scene_BG_Color[:red] = 1 Scene_BG_Color[:green] = 124 Scene_BG_Color[:blue] = 1 Scene_BG_Color[:alpha] = 128 # #--------------------------------------------------------------------------- # * Use VXACE Parameter Names # > Option to enable/disable usage of parameter names in database # > If disabled, the specified names below this option will be used instead. # > Settings: true or false #--------------------------------------------------------------------------- Use_VXACE_Parameter_Names = false # #--------------------------------------------------------------------------- # * Custom Parameter Names # > Only applicable if USE_VXACE_Parameter_Names is false. # > Can set different names to use for specific parameters. # > all custom names must be "strings". #--------------------------------------------------------------------------- Custom_Params[:MAX_HP] = "Health" Custom_Params[:MAX_MP] = "Mana" Custom_Params[:ATTACK] = "Power" Custom_Params[:DEFENSE] = "Toughness" Custom_Params[:MAGIC_ATK] = "Intellect" Custom_Params[:MAGIC_DEF] = "Spirit" Custom_Params[:AGILITY] = "Speed" Custom_Params[:LUCK] = "Chance" # #--------------------------------------------------------------------------- # * Bonus Values # > You may specify a fixed bonus value for each stat. This is used so you # may for example, have each HP bonus add +3 HP where each attack bonus only # adds +1. #--------------------------------------------------------------------------- Custom_Params[:BONUS][:MAX_HP] = 3 Custom_Params[:BONUS][:MAX_MP] = 2 Custom_Params[:BONUS][:ATTACK] = 1 Custom_Params[:BONUS][:DEFENSE] = 1 Custom_Params[:BONUS][:MAGIC_ATK] = 1 Custom_Params[:BONUS][:MAGIC_DEF] = 1 Custom_Params[:BONUS][:AGILITY] = 1 Custom_Params[:BONUS][:LUCK] = 2 # #--------------------------------------------------------------------------- # * Animation Speed # > Controls all window animation speed, measured in FRAMES. # > Note: 60 frames = 1 second unless the game is lagging. #--------------------------------------------------------------------------- Scene_Windows[:ANIM_SPEED] = 10 # #--------------------------------------------------------------------------- # * Windows Travel Distance + Offscreen Offset # > Controls the distance from screen and travelling distance for each window. # > 1 setting per window #--------------------------------------------------------------------------- # Scene_Windows[:OFFSETS][:Message_Window] = 700 Scene_Windows[:OFFSETS][:Command_Window] = 700 Scene_Windows[:OFFSETS][:Class_Window] = 500 Scene_Windows[:OFFSETS][:Bonus_Window] = 500 # #--------------------------------------------------------------------------- # * Windows Properties Settings # > Here many values are exposed, including window positions, sizes, and some # text display related settings as well. # > Each window is grouped into its own properties set. # Opacity notes: # > 'Opacity1' = Window Border Opacity. # > 'Opacity2' = Window Background Opacity. # > 'Opacity3' = Window Contents Opacity. #--------------------------------------------------------------------------- # # *** LARGE DETAILED MESSAGE/INFORMATION WINDOW PROPERTIES *** #--------------------------------------------------------------------------- Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Pos_X] = 0 Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Pos_Y] = 0 Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Width] = 400 Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Height] = 200 Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Bold_Title] = true Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Bold_MSG] = false Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Opacity1] = 255 Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Opacity2] = 192 Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Opacity3] = 255 # # *** FEEDBACK 'gained x' WINDOW PROPERTIES *** #--------------------------------------------------------------------------- Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Pos_X] = Graphics.width / 2 - 150 Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Pos_Y] = 128 Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Width] = 250 Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Height] = 72 Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Bold_L1] = true Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Bold_L2] = false Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Opacity1] = 255 Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Opacity2] = 192 Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Opacity3] = 255 # # *** MAIN COMMAND WINDOW PROPERTIES *** #--------------------------------------------------------------------------- Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Pos_X] = 400 Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Pos_Y] = 0 Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Width] = Graphics.width - 400 Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Alignment] = 1 Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Padding] = 4 Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Opacity1] = 255 Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Opacity2] = 192 Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Opacity3] = 255 # # *** CONFIRM MESSAGE WINDOW PROPERTIES *** #--------------------------------------------------------------------------- Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG][:Pos_X] = Graphics.width / 2 - 225 Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG][:Pos_Y] = Graphics.height / 2 - 64 Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG][:Width] = 300 Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG][:Height] = 72 Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG][:Opacity1] = 255 Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG][:Opacity2] = 192 Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG][:Opacity3] = 255 # # *** CONFIRM COMMAND WINDOW PROPERTIES *** #--------------------------------------------------------------------------- Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Pos_X] = Graphics.width / 2 - 225 Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Pos_Y] = Graphics.height / 2 + 8 Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Width] = 300 Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Alignment] = 1 Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Padding] = 4 Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Opacity1] = 255 Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Opacity2] = 192 Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Opacity3] = 255 # # *** ACTOR CLASS WINDOW PROPERTIES *** #--------------------------------------------------------------------------- Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS][:Pos_X] = 0 Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS][:Pos_Y] = 200 Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS][:Width] = 316 Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS][:Height] = 48 Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS][:Opacity1] = 255 Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS][:Opacity2] = 192 Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS][:Opacity3] = 255 # # *** REMAINING BONUS COUNT WINDOW PROPERTIES *** #--------------------------------------------------------------------------- Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Pos_X] = 0 Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Pos_Y] = 250 Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Width] = 316 Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Height] = 48 Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Bold_MSG] = true Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Opacity1] = 255 Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Opacity2] = 192 Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Opacity3] = 255 # # # # # #=========================================================================== # ***** END OF SETTINGS ***** #=========================================================================== # * DO NOT EDIT BEYOND THIS POINT UNLESS YOU KNOW WHAT YER DOIN'! def self.bgc(symbol) return 0 if Scene_BG_Color[symbol].nil? return Scene_BG_Color[symbol] end def self.LEVEL_BONUS(id) @lvlbonus_pending_ids = {} if @lvlbonus_pending_ids == nil actor = $game_actors[id] return unless $game_party.all_members.include?(actor) key = id if @lvlbonus_pending_ids.include?(key) oldval = @lvlbonus_pending_ids[key] valid = oldval[0]; valamt = oldval[1] valamt += 1 newval = [valid, valamt] @lvlbonus_pending_ids.delete(key) else newval = [id, 1] end @lvlbonus_pending_ids[key] = newval return end def self.LEVEL_BONUS_ITERATE return if @lvlbonus_pending_ids == nil || @lvlbonus_pending_ids.empty? keychain = @lvlbonus_pending_ids.keys; keychain.sort! nextkey = keychain.shift ary = @lvlbonus_pending_ids[nextkey] id = ary[0] return id end def self.LEVEL_BONUS_ITERATE_AMOUNT return if @lvlbonus_pending_ids == nil || @lvlbonus_pending_ids.empty? keychain = @lvlbonus_pending_ids.keys; keychain.sort! nextkey = keychain.shift ary = @lvlbonus_pending_ids[nextkey] amount = ary[1] return amount end def self.LEVEL_BONUS_DECREASE_AMT(key) return if @lvlbonus_pending_ids == nil || @lvlbonus_pending_ids.empty? ary = @lvlbonus_pending_ids[key] amount = ary[1]; id = ary[0] return unless amount > 1 amount -= 1 newvals = [id, amount] p "newvals: #{newvals}" @lvlbonus_pending_ids.delete(key) @lvlbonus_pending_ids[key] = newvals end def self.LEVEL_BONUS_DONE(id) return if @lvlbonus_pending_ids == nil || @lvlbonus_pending_ids.empty? ary = @lvlbonus_pending_ids[id] chkval = ary[1] if chkval > 1 chkval -= 1 newary = [id, chkval] @lvlbonus_pending_ids.delete(id) @lvlbonus_pending_ids[id] = newary else @lvlbonus_pending_ids.delete(id) end @lvlbonus_pending_ids = nil if @lvlbonus_pending_ids.empty? return end def self.DESTROY_BONUS_IDS @lvlbonus_pending_ids = nil return end endend#===============================================================================# * Game_Actor Method (Core VX ACE)# > Aliased methods: 1# > Overwritten methods: 0# > Added methods: 1#===============================================================================class Game_Actor < Game_Battler alias :gump_level_up_bonus_7832ty :level_up def level_up(*args) gump_level_up_bonus_7832ty Gump::LVL_BONUS.LEVEL_BONUS(actor.id) end # does not include max hp or max mp def gump_get_parameter_hash ary = {} pid = 2 while pid < 7 ary[pid] = self.class.params[pid, @level] pid += 1 end return ary endend#===============================================================================# * Scene_Map Method (Core VX ACE)# > Aliased methods: 1# > Overwritten methods: 0# > Added methods: 3#===============================================================================class Scene_Map < Scene_Base alias :gump_lvlbonus_update_scene_438fh0 :update_scene def update_scene(*args) gump_lvlbonus_update_scene_438fh0 check_for_lvlbonus unless !Gump::LVL_BONUS::Autocall_Bonus_Scene || gump_lvlbonus_checks end def gump_lvlbonus_checks return true if scene_changing? return true if $game_message.busy? return true if Gump::LVL_BONUS::Misc[:other][:map_overrides].include?($game_map.map_id) return false end def check_for_lvlbonus if Gump::LVL_BONUS.LEVEL_BONUS_ITERATE != nil play_lvlbonus_sound(1) SceneManager.call(Gump_Level_Bonus_Scene) end end def play_lvlbonus_sound(n=nil) return unless n == 1 return if !Gump::LVL_BONUS::Misc[:sound][:Pop_Sound] Audio.se_stop file = Gump::LVL_BONUS::Misc[:sound][:Filename_p] volume = Gump::LVL_BONUS::Misc[:sound][:Volume_p] pitch = Gump::LVL_BONUS::Misc[:sound][:Pitch_p] Audio.se_play('Audio/SE/' + file, volume, pitch) return endend#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+# ***** SCENE & WINDOWS ***** ##+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+#+class Gump_Level_Bonus_Scene < Scene_MenuBase def start return_to_caller if Gump::LVL_BONUS.LEVEL_BONUS_ITERATE == nil p_id = Gump::LVL_BONUS.LEVEL_BONUS_ITERATE return_to_caller if p_id == nil super @actor = $game_actors[p_id] create_windowsz setup_base_positions post_start animate(1) select_recommended_bonus end def post_start super count_remaining_hide_window_check end def create_background @background_sprite = Sprite.new @background_sprite.bitmap = SceneManager.background_bitmap @background_sprite.color.set(Gump::LVL_BONUS::Scene_BG_Color[:red], Gump::LVL_BONUS::Scene_BG_Color[:green], Gump::LVL_BONUS::Scene_BG_Color[:blue], Gump::LVL_BONUS::Scene_BG_Color[:alpha]) return end def setup_base_positions @message_window.y += Gump::LVL_BONUS::Scene_Windows[:OFFSETS][:Message_Window] @cmd_window.x += Gump::LVL_BONUS::Scene_Windows[:OFFSETS][:Command_Window] @class_display_window.x -= Gump::LVL_BONUS::Scene_Windows[:OFFSETS][:Class_Window] @bonus_amount_window.x -= Gump::LVL_BONUS::Scene_Windows[:OFFSETS][:Bonus_Window] end def animate(step=0) return if step == 0 speed = Gump::LVL_BONUS::Scene_Windows[:ANIM_SPEED] if step == 1 animate = speed while animate > 0 Graphics.wait(1) @message_window.y -= Gump::LVL_BONUS::Scene_Windows[:OFFSETS][:Message_Window] / speed @cmd_window.x -= Gump::LVL_BONUS::Scene_Windows[:OFFSETS][:Command_Window] / speed @class_display_window.x += Gump::LVL_BONUS::Scene_Windows[:OFFSETS][:Class_Window] / speed @bonus_amount_window.x += Gump::LVL_BONUS::Scene_Windows[:OFFSETS][:Bonus_Window] / speed animate -= 1 end end if step == 2 animate = speed while animate > 0 Graphics.wait(1) @message_window.y += Gump::LVL_BONUS::Scene_Windows[:OFFSETS][:Message_Window] / speed @cmd_window.x += Gump::LVL_BONUS::Scene_Windows[:OFFSETS][:Command_Window] / speed @class_display_window.x -= Gump::LVL_BONUS::Scene_Windows[:OFFSETS][:Class_Window] / speed @bonus_amount_window.x -= Gump::LVL_BONUS::Scene_Windows[:OFFSETS][:Bonus_Window] / speed animate -= 1 end end if step == 3 animate = speed while animate > 0 Graphics.wait(1) @bonus_amount_window.x -= Gump::LVL_BONUS::Scene_Windows[:OFFSETS][:Bonus_Window] / speed animate -= 1 end end end def count_remaining_hide_window_check count = Gump::LVL_BONUS.LEVEL_BONUS_ITERATE_AMOUNT if count <= 1 animate(3) @bonus_amount_window.close update until @bonus_amount_window.close? end return end def create_windowsz x = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Pos_X] y = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Pos_Y] @name = @actor.name @message_window = Level_Bonus_Message_Window.new(x, y, @name) x = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Pos_X] y = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Pos_Y] @cmd_window = Level_Bonus_Command_Window.new(x, y) @cmd_window.set_handler(:maxhp, method(:choice_MaxHP)) @cmd_window.set_handler(:maxmp, method(:choice_MaxMP)) @cmd_window.set_handler(:attack, method(:choice_Attack)) @cmd_window.set_handler(:defense, method(:choice_Defense)) @cmd_window.set_handler(:magatk, method(:choice_Mag_Attack)) @cmd_window.set_handler(:magdef, method(:choice_Mag_Defense)) @cmd_window.set_handler(:agility, method(:choice_Agility)) @cmd_window.set_handler(:luck, method(:choice_Luck)) class_name = fetch_class_name x = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS][:Pos_X] y = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS][:Pos_Y] @class_display_window = Level_Bonus_Class_Display.new(x, y, class_name) x = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Pos_X] y = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Pos_Y] @bonus_amount_window = Window_LvlBonus_Amount_Disp.new(x, y) x = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG][:Pos_X] y = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG][:Pos_Y] stat = nil @confirm_msg = Level_Bonus_Message_Confirm_Window.new(x, y, stat) @confirm_msg.close @confirm_msg.hide x = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Pos_X] y = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Pos_Y] @confirm_msg_command = Level_Bonus_Command_Window_Confirm.new(x, y) @confirm_msg_command.set_handler(:confirm, method(:confirm_selection)) @confirm_msg_command.set_handler(:cancel, method(:cancel_selection)) @confirm_msg_command.close @confirm_msg_command.hide @cmd_window.activate Graphics.wait(6) end def select_recommended_bonus param_hash = @actor.gump_get_parameter_hash vals = param_hash.values max = vals.max pid = param_hash.index(max) case pid when 2 # attack highest @cmd_window.select_symbol(:attack) when 3 # defense highest @cmd_window.select_symbol(:defense) when 4 # magic attack highest @cmd_window.select_symbol(:magatk) when 5 # magic defense highest @cmd_window.select_symbol(:magdef) when 6 # agility higest @cmd_window.select_symbol(:agility) when 7 # luck highest @cmd_window.select_symbol(:luck) end end def fetch_class_name return @actor.class.name end def confirm_to_player animate(2) @confirm_msg.show @confirm_msg_command.show @confirm_msg.open @confirm_msg_command.open update until @confirm_msg_command.open? @confirm_msg_command.activate end def confirm_selection @confirm_msg.close @confirm_msg_command.close update until @confirm_msg_command.close? @confirm_msg_command.hide @confirm_msg.hide add_bonus_value end def cancel_selection @confirm_msg.close @confirm_msg_command.close update until @confirm_msg_command.close? @confirm_msg_command.hide @confirm_msg.hide animate(1) @cmd_window.activate end def open_bonus_feedback_window(value) x = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Pos_X] y = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Pos_Y] @feedbackwindow = Level_Bonus_Added_Feedback_Window.new(x, y, @stat, value) @feedbackwindow.set_handler(:ok, method(:pre_term)) @feedbackwindow.set_handler(:cancel, method(:pre_term)) play_bonus_sound(1) Graphics.wait(10) @feedbackwindow.activate end def play_bonus_sound(n=nil) return unless n == 1 return if !Gump::LVL_BONUS::Misc[:sound][:Play_Sound] Audio.se_stop file = Gump::LVL_BONUS::Misc[:sound][:Filename] volume = Gump::LVL_BONUS::Misc[:sound][:Volume] pitch = Gump::LVL_BONUS::Misc[:sound][:Pitch] Audio.se_play('Audio/SE/' + file, volume, pitch) return end def add_bonus_value case @choice when 1 @actor.add_param(0, Gump::LVL_BONUS::Custom_Params[:BONUS][:MAX_HP]) value = Gump::LVL_BONUS::Custom_Params[:BONUS][:MAX_HP] when 2 @actor.add_param(1, Gump::LVL_BONUS::Custom_Params[:BONUS][:MAX_MP]) value = Gump::LVL_BONUS::Custom_Params[:BONUS][:MAX_MP] when 3 @actor.add_param(2, Gump::LVL_BONUS::Custom_Params[:BONUS][:ATTACK]) value = Gump::LVL_BONUS::Custom_Params[:BONUS][:ATTACK] when 4 @actor.add_param(3, Gump::LVL_BONUS::Custom_Params[:BONUS][:DEFENSE]) value = Gump::LVL_BONUS::Custom_Params[:BONUS][:DEFENSE] when 5 @actor.add_param(4, Gump::LVL_BONUS::Custom_Params[:BONUS][:MAGIC_ATK]) value = Gump::LVL_BONUS::Custom_Params[:BONUS][:MAGIC_ATK] when 6 @actor.add_param(5, Gump::LVL_BONUS::Custom_Params[:BONUS][:MAGIC_DEF]) value = Gump::LVL_BONUS::Custom_Params[:BONUS][:MAGIC_DEF] when 7 @actor.add_param(6, Gump::LVL_BONUS::Custom_Params[:BONUS][:AGILITY]) value = Gump::LVL_BONUS::Custom_Params[:BONUS][:AGILITY] when 8 @actor.add_param(7, Gump::LVL_BONUS::Custom_Params[:BONUS][:LUCK]) value = Gump::LVL_BONUS::Custom_Params[:BONUS][:LUCK] end open_bonus_feedback_window(value) end def choice_MaxHP Gump::LVL_BONUS::Use_VXACE_Parameter_Names ? @stat = Vocab::param(0) : @stat = Gump::LVL_BONUS::Custom_Params[:MAX_HP] @confirm_msg.update_stat(@stat) @choice = 1 confirm_to_player end def choice_MaxMP Gump::LVL_BONUS::Use_VXACE_Parameter_Names ? @stat = Vocab::param(1) : @stat = Gump::LVL_BONUS::Custom_Params[:MAX_MP] @confirm_msg.update_stat(@stat) @choice = 2 confirm_to_player end def choice_Attack Gump::LVL_BONUS::Use_VXACE_Parameter_Names ? @stat = Vocab::param(2) : @stat = Gump::LVL_BONUS::Custom_Params[:ATTACK] @confirm_msg.update_stat(@stat) @choice = 3 confirm_to_player end def choice_Defense Gump::LVL_BONUS::Use_VXACE_Parameter_Names ? @stat = Vocab::param(3) : @stat = Gump::LVL_BONUS::Custom_Params[:DEFENSE] @confirm_msg.update_stat(@stat) @choice = 4 confirm_to_player end def choice_Mag_Attack Gump::LVL_BONUS::Use_VXACE_Parameter_Names ? @stat = Vocab::param(4) : @stat = Gump::LVL_BONUS::Custom_Params[:MAGIC_ATK] @confirm_msg.update_stat(@stat) @choice = 5 confirm_to_player end def choice_Mag_Defense Gump::LVL_BONUS::Use_VXACE_Parameter_Names ? @stat = Vocab::param(5) : @stat = Gump::LVL_BONUS::Custom_Params[:MAGIC_DEF] @confirm_msg.update_stat(@stat) @choice = 6 confirm_to_player end def choice_Agility Gump::LVL_BONUS::Use_VXACE_Parameter_Names ? @stat = Vocab::param(6) : @stat = Gump::LVL_BONUS::Custom_Params[:AGILITY] @confirm_msg.update_stat(@stat) @choice = 7 confirm_to_player end def choice_Luck Gump::LVL_BONUS::Use_VXACE_Parameter_Names ? @stat = Vocab::param(7) : @stat = Gump::LVL_BONUS::Custom_Params[:LUCK] @confirm_msg.update_stat(@stat) @choice = 8 confirm_to_player end def pre_term @feedbackwindow.close update until @feedbackwindow.close? amtleft = Gump::LVL_BONUS.LEVEL_BONUS_ITERATE_AMOUNT if amtleft <= 1 return_to_caller else Gump::LVL_BONUS.LEVEL_BONUS_DECREASE_AMT(@actor.id) @bonus_amount_window.refresh_data count_remaining_hide_window_check animate(1) @cmd_window.activate end end def return_to_caller Graphics.wait(8) id = @actor.id unless @actor == nil Gump::LVL_BONUS.LEVEL_BONUS_DONE(id) unless id == nil SceneManager.return endendclass Level_Bonus_Added_Feedback_Window < Window_Selectable def initialize(x, y, stat, value) @stat_string = stat @bonus = value wi = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Width] he = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Height] super(x, y, wi, he) self.opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Opacity1] self.back_opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Opacity2] self.contents_opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Opacity3] draw_message end def draw_message change_color(tp_gauge_color2) self.contents.font.bold = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Bold_L1] draw_text(0, 0, 240, line_height, Gump::LVL_BONUS::Misc[:vocab][:level_bonus_added], 0) self.contents.font.bold = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_FEEDBACK][:Bold_L2] change_color(normal_color) draw_text(0, 0, 240, line_height*3, "#{@stat_string} +#{@bonus}!", 1) endendclass Level_Bonus_Message_Window < Window_Base def initialize(x, y, name) wi = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Width] he = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Height] @name = name super(x, y, wi, he) self.opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Opacity1] self.back_opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Opacity2] self.contents_opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Opacity3] draw_message end def draw_message change_color(tp_gauge_color2) self.contents.font.bold = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Bold_Title] draw_text(0, 0, 386, line_height, Gump::LVL_BONUS::Misc[:vocab][:message_window][:msg_title], 1) self.contents.font.bold = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_MESSAGE][:Bold_MSG] change_color(normal_color) draw_text(0, 0, 390, line_height*3, Gump::LVL_BONUS::Misc[:vocab][:message_window][:msg_line1], 0) draw_text(0, 0, 390, line_height*5, Gump::LVL_BONUS::Misc[:vocab][:message_window][:msg_line2], 0) draw_text(0, 0, 390, line_height*7, Gump::LVL_BONUS::Misc[:vocab][:message_window][:msg_line3], 0) draw_text(0, 0, 390, line_height*9, Gump::LVL_BONUS::Misc[:vocab][:message_window][:msg_line4], 0) endendclass Level_Bonus_Command_Window < Window_Command def initialize(x, y) super(x, y) self.opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Opacity1] self.back_opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Opacity2] self.contents_opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Opacity3] refresh end def window_width return Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Width] end def alignment return Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Alignment] end def standard_padding return Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_COMMAND][:Padding] end def make_command_list get_param_stringdata add_command(@strings[:max_hp], :maxhp) add_command(@strings[:max_mp], :maxmp) add_command(@strings[:attack], :attack) add_command(@strings[:defense], :defense) add_command(@strings[:magatk], :magatk) add_command(@strings[:magdef], :magdef) add_command(@strings[:agility], :agility) add_command(@strings[:luck], :luck) end def get_param_stringdata if Gump::LVL_BONUS::Use_VXACE_Parameter_Names @strings = { :max_hp => Vocab::param(0), :max_mp => Vocab::param(1), :attack => Vocab::param(2), :defense => Vocab::param(3), :magatk => Vocab::param(4), :magdef => Vocab::param(5), :agility => Vocab::param(6), :luck => Vocab::param(7), } else @strings = { :max_hp => Gump::LVL_BONUS::Custom_Params[:MAX_HP], :max_mp => Gump::LVL_BONUS::Custom_Params[:MAX_MP], :attack => Gump::LVL_BONUS::Custom_Params[:ATTACK], :defense => Gump::LVL_BONUS::Custom_Params[:DEFENSE], :magatk => Gump::LVL_BONUS::Custom_Params[:MAGIC_ATK], :magdef => Gump::LVL_BONUS::Custom_Params[:MAGIC_DEF], :agility => Gump::LVL_BONUS::Custom_Params[:AGILITY], :luck => Gump::LVL_BONUS::Custom_Params[:LUCK], } end endendclass Level_Bonus_Message_Confirm_Window < Window_Selectable def initialize(x, y, stat=nil) wi = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG][:Width] he = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG][:Height] @stat = stat super(x, y, wi, he) self.opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG][:Opacity1] self.back_opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG][:Opacity2] self.contents_opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_MSG][:Opacity3] draw_message end def draw_message @stat = Gump::LVL_BONUS::Misc[:vocab][:confirm_window][:none] if @stat == nil draw_text(0, 0, 280, line_height, "#{Gump::LVL_BONUS::Misc[:vocab][:confirm_window][:apply_msg]} #{@stat}", 0) change_color(crisis_color) draw_text(50, 0, 170, line_height*3, Gump::LVL_BONUS::Misc[:vocab][:confirm_window][:confirm], 1) end def update_stat(stat) if @stat != stat @stat = stat end refresh end def refresh super draw_message endendclass Level_Bonus_Command_Window_Confirm < Window_Command def initialize(x, y) super(x, y) self.opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Opacity1] self.back_opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Opacity2] self.contents_opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Opacity3] refresh end def window_width return Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Width] end def alignment return Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Alignment] end def standard_padding return Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_CONFIRM_CMD][:Padding] end def make_command_list add_command(Gump::LVL_BONUS::Misc[:vocab][:command_window][:confirm], :confirm) add_command(Gump::LVL_BONUS::Misc[:vocab][:command_window][:cancel], :cancel) endend#-----------------------------------------------------------# Character Class Window#-----------------------------------------------------------class Level_Bonus_Class_Display < Window_Base def initialize(x, y, class_name=nil) wi = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS][:Width] he = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS][:Height] super(x, y, wi, he) @c_name = class_name self.opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS][:Opacity1] self.back_opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS][:Opacity2] self.contents_opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_ACTOR_CLASS][:Opacity3] draw_class end def draw_class change_color(system_color) draw_text(0, 0, 80, line_height, Gump::LVL_BONUS::Misc[:vocab][:class_title], 0) change_color(normal_color) draw_text(80, 0, 216, line_height, @c_name, 0) end def reload(class_name) contents.clear if @c_name != class_name @c_name = class_name end draw_class endend# Window for displaying amount of available bonusesclass Window_LvlBonus_Amount_Disp < Window_Base def initialize(x, y) width = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Width] height = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Height] super(x, y, width, height) self.opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Opacity1] self.back_opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Opacity2] self.contents_opacity = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Opacity3] refresh_data end def refresh_data get_data contents.clear draw_msg end def get_data @amt = Gump::LVL_BONUS.LEVEL_BONUS_ITERATE_AMOUNT end def draw_msg self.contents.font.out_color = Color.new(0, 196, 0, 226) self.contents.font.bold = Gump::LVL_BONUS::Scene_Windows[:PROPERTIES][:WIN_BONUS_COUNT][:Bold_MSG] draw_text(0, 0, 236, line_height, "#{Gump::LVL_BONUS::Misc[:vocab][:remaining]} #{@amt}", 0) endend
复制代码
Screenshots:
Spoiler
Changelog: BETA 1.02.F - Kitkat edition build. [NEW] New option to enable or disable auto-calling of the level bonus scene. If it is disabled developers must call the scene manually with the standard: SceneManager.call(Gump_Level_Bonus_Scene) [NEW] Map ID override setting added. Now developers can add map ids where the Level Bonus scene won't be called if autocalling is enabled.
Older Version Changelogs:
SpoilerBETA 1.02.A - The "I knew I forgot an essential setting..." build. [NEW] All windows now have full opacity settings (3 opacity settings each) which means control over windows border, background and contents transparency.
BETA 1.01E - Coded with 9 fingers. [MOD][/MOD][MOD] Script now uses a single scene. 200+ reduction in script linecount. [MOD][/MOD][MOD] "Available Bonuses" Window now dissapears via animation+closing if the actor only has 1 point available. If the actor has more than 1 point, the window is visible. [NEW] Exposed a variety of all windows properties as new settings. Things such as x and y positions, width and height settings and a few other things are now easily configurable.