Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Parameter Points Script, version 0.1
- # Author: bgillisp
- # Released 9/3/2014
- # This script allows you to earn parameter points upon level up, which
- # you can then spend to increase your stats. The standard level-up
- # process is still present, so you can either have these as bonuses,
- # or you can set the database to give no reward on level up, then
- # these points have to increase your parameters
- # To use:
- # Place in the materials folder, but above main
- #
- # Currently there is no graphical interface for the points. This means
- # you will never know how many points you have short of a script call.
- # To check points, call $game_actors[x].parameter_points in a script call in an
- # event. Replace x with the name of the actor (remember the database starts at 1)
- # To spend points, call $game_actors[x].spend_parameter_points(y), replacing
- # x with the actor's id, and y with value of the stat you wish to spent a point
- # to increase. The values to pass are as follows
- # 0 - MHP
- # 1 - MMP
- # 2 - ATK
- # 3 - DEF
- # 4 - MAT
- # 5 - MDF
- # 6 - AGL
- # 7 - LUK
- # If, for some reason, you accidentally pass a number less than 0, the point will
- # be spent to increase MHP.
- # If, for some reason, you accidentally pass a number more than 7, the point
- # will be spent to increase LUK.
- #
- # If you call the command, but do not have the points to spend, it will do
- # nothing.
- # Terms of use:
- # Free for use in commercial and non-commercial games, with credit
- # given.
- #----------------------------------------------------------------------------
- # Editable region
- module BG_Parameter_points
- #Edit this array to determine how many paramter points a character has
- #Do not erase the commas or the [ or ] or you will get an error!
- Points_per_level = [0, 1, 1, 1, 1, 2, 1, 1, 1, 1, #Levels 0 - 9
- 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, #Levels 10 - 19
- 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, #Levels 20 - 29
- 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, #Levels 30 - 39
- 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, #Levels 40 - 49
- 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, #Levels 50 - 59
- 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, #Levels 60 - 69
- 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, #Levels 70 - 79
- 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, #Levels 80 - 89
- 2, 1, 1, 1, 1, 2, 1, 1, 1, 1] #Levels 90 - 99
- #Edit these to change what the actor gains for spending a point
- #on that stat. These refer to, in order, assuming default names
- #HP, MP, ATK, DEF, MAT, MDF< AGL, and LUK
- Amount_to_increase = [10, 5, 1, 1, 1, 1, 1, 1]
- end
- #End of Editable Region
- #--------------------------------------------------------------------------
- #Do not edit anything below here unless you know what you are doing.
- #Failure to ahead to this warning may result in unpredictable behavior in
- #your game. Consider yourself warned
- #__________________________________________________________________________
- class Game_Actor < Game_Battler
- attr_accessor :parameter_points
- alias bg_parameter_points_initialize initialize
- alias bg_paramater_points_level_up level_up
- #Aliased method, initialize
- def initialize(actor_id)
- #Call aliased method
- bg_parameter_points_initialize(actor_id)
- #Set our parameter points to zero (for now)
- self.parameter_points = 0
- end #End initiliaze
- #Alias method, level_up
- def level_up
- #Call aliased method
- bg_paramater_points_level_up
- #Add (or subtract) the desired number of points.
- self.parameter_points += BG_Parameter_points::Points_per_level[@level]
- end #End level_up
- #Original Method, spend point
- def spend_point(stat_to_increase)
- #Error catching, to avoid crashes
- if(stat_to_increase < 0)
- stat_to_increase = 0
- end
- if(stat_to_increase > 7)
- stat_to_increase = 7
- end
- #If we have no points to spend, abort
- if(self.parameter_points <= 0)
- return
- end
- self.parameter_points -= 1
- add_param(stat_to_increase, BG_Parameter_points::Amount_to_increase[stat_to_increase])
- end #End spend_point
- #Original method, give parameter points
- def give_parameter_points(amount)
- self.parameter_points += amount
- #Set the parameter points to the maximum of 0 and whatever we set it at.
- self.parameter_points = [0, self.parameter_points].max
- end
- end
RAW Paste Data