Advertisement
Dekita

pspds snippet

Jan 15th, 2013
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. #==============================================================================#
  2. # http://dekitarpg.wordpress.com/ #
  3. #==============================================================================#
  4. # THIS IS A SNIPPET FOR MY PERFECT STAT POINT DISTRUBUTION SCRIPT TO ALLOW FOR
  5. # EACH ACTOR TO HAVE DIFFERENT FORMULAS FOR GAINING LEVEL UP POINTS
  6. # PLACE THIS SCRIPT BELOW THE STAT POINT DISTRIBUTION SCRIPT !!
  7. #
  8. # BIG NOTE:
  9. # The old script calls of $pts and $bonuspts to change level up points should
  10. # !! NoT !! be used if using this snippet.
  11.  
  12. # NEW Script calls:
  13. # $game_actors[ACTOR_ID].pts_form(" your formula ") (normal points)
  14. # $game_actors[ACTOR_ID].b_pts_form(" your formula ") (bonus level up points)
  15.  
  16. # if you want to do a bigger formula do something like this...
  17. # a = (self.level + 19 / 100).to_f + self.level
  18. # b = (self.level + 10) * (self.atk + self.def + self.mat + self.mdf) / 9999
  19. # c = (self.vit + self.mag + self.str + self.dex * (self.atl + self.dfl))
  20. # $game_actors[ACTOR_ID].pts_form("#{ a + b - c + 1 }")
  21.  
  22. # NOTE:
  23. # Make sure your formula always returns at least the value of 1
  24. # an easy way to do this is by putting " + 1 " at the end of your formula.
  25.  
  26. module PSPDS_ADDON
  27.  
  28. # ...
  29. Use_Snippet = true
  30.  
  31. # Default NORMAL Points formula.
  32. Points_Gain_Formula = " ( self.level + 5 * (self.level/10) ) + 1 "
  33.  
  34. # Default BONUS Points formula.
  35. Bonus_Points_Gain_Formula = " ( self.level + 5 ) + 1 "
  36.  
  37. end
  38.  
  39. #==============================================================================#
  40. # http://dekitarpg.wordpress.com/ #
  41. #==============================================================================#
  42. class Game_Actor < Game_Battler #
  43. #==============================================================================#
  44.  
  45. if PSPDS_ADDON::Use_Snippet
  46.  
  47. attr_reader :points_gain_formula
  48. attr_reader :bonus_pts_gain_formula
  49.  
  50. alias :old_PSPDS_initialize :initialize
  51. def initialize(actor_id)
  52. old_PSPDS_initialize(actor_id)
  53. @points_gain_formula = PSPDS_ADDON::Points_Gain_Formula
  54. @bonus_pts_gain_formula = PSPDS_ADDON::Bonus_Points_Gain_Formula
  55. end
  56.  
  57. def points_formula
  58. eval(@points_gain_formula).to_i
  59. end
  60.  
  61. def bonus_pts_formula
  62. eval(@bonus_pts_gain_formula).to_i
  63. end
  64.  
  65. def pts_form(script)
  66. @points_gain_formula = script
  67. end
  68.  
  69. def b_pts_form(script)
  70. @bonus_pts_gain_formula = script
  71. end
  72.  
  73. end # if PSPDS_ADDON::Use_Snippet
  74.  
  75. end
  76.  
  77. #==============================================================================#
  78. # http://dekitarpg.wordpress.com/ #
  79. #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement