Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Custom EXP Formula
- # 19/06/2014
- # By Pacman
- #
- #===============================================================================
- #
- # This script allows you to give custom EXP formulae to each class. I advise
- # that the faint of heart stay away from this script, as creating formulae can
- # be complicated and headache-inducing.
- #
- #===============================================================================
- #
- # ~! INSTALLATION !~
- # Paste above Main, below Materials.
- # To configure the script, write your desired formula for any particular class
- # in the array below. To do this, simply write:
- # Custom_Formula[n] = "formula"
- # Where n is the ID of the class and "formula" is the formula you wish to have
- # calculating the EXP curve.
- # In creating your formula, there are 5 variables you can use. These are the
- # level, base value, extra value, accelaration A and accelaration B. The level
- # refers to the current level of the actor, and the other four values correspond
- # to those set in the EXP curve in the database. You must refer to them thusly:
- # Level - lv
- # Base Value - base
- # Extra Value - extra
- # Accelaration A - acc_a
- # Accelaration B - acc_b
- # You could also not use any of these fancy variables. Nobody will laugh at you.
- # The writing of the formula must be done inside quotation marks ("") and can
- # use all basic mathematical proceedings. Exponents must be denoted with **
- # instead of ^.
- #
- #===============================================================================
- module Custom_Formula # Woah woah woah don't touch that man
- Custom_Formula = [] # Don't even think about it
- #--------------------------------------------------------------------------
- Custom_Formula[1] = "(basis**lv - (basis * lv))"
- Custom_Formula[2] = "(basis*((lv-1)**(0.9+acc_a/150))*lv*(lv+1)/
- (6+lv**2/50/acc_b)+(lv-1)*2*extra)"
- #--------------------------------------------------------------------------
- end # Okay you can just go home now.
- #===============================================================================
- #
- # Just... don't touch this stuff. This is my stuff.
- #
- #===============================================================================
- # ** RPG::Class
- #------------------------------------------------------------------------------
- # The data class for class. Yo dawg, I heard you like class.
- #==============================================================================
- class RPG::Class < RPG::BaseItem
- #--------------------------------------------------------------------------
- # * Get Total EXP Required for Rising to Specified Level
- #--------------------------------------------------------------------------
- def exp_for_level(level)
- lv = level.to_f
- basis = @exp_params[0].to_f
- extra = @exp_params[1].to_f
- acc_a = @exp_params[2].to_f
- acc_b = @exp_params[3].to_f
- return (basis*((lv-1)**(0.9+acc_a/250))*lv*(lv+1)/
- (6+lv**2/50/acc_b)+(lv-1)*extra).round.to_i
- end
- #--------------------------------------------------------------------------
- # * Get Total EXP Required for Rising to Specified Level, but cool this time.
- #--------------------------------------------------------------------------
- def exp_for_level_custom(level, id)
- lv = level.to_f
- basis = @exp_params[0].to_f
- extra = @exp_params[1].to_f
- acc_a = @exp_params[2].to_f
- acc_b = @exp_params[3].to_f
- return eval(Custom_Formula::Custom_Formula[id]).round.to_i rescue 0
- end
- end
- #==============================================================================
- # ** Game_Actor
- #------------------------------------------------------------------------------
- # This class handles actors. It is used within the Game_Actors class
- # ($game_actors) and is also referenced from the Game_Party class ($game_party).
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # Alias Method
- #--------------------------------------------------------------------------
- alias pac_custom_formula_expflvl exp_for_level
- #--------------------------------------------------------------------------
- # * Get Total EXP Required for Rising to Specified Level
- #--------------------------------------------------------------------------
- def exp_for_level(level, *args)
- if Custom_Formula::Custom_Formula[@class_id]
- self.class.exp_for_level_custom(level, id, *args)
- else
- self.class.exp_for_level(level, *args)
- end
- end
- end
- #===============================================================================
- #
- # END OF SCRIPT
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement