VanCoolz

[RGSS/2] Recover on Level Up

May 9th, 2012
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.47 KB | None | 0 0
  1. #==============================================================================
  2. # [RGSS/2] Recover on Level Up
  3. # Last Update : 17/5/2012
  4. # Version : 1.1
  5. # Author : LowlingLife
  6. #==============================================================================
  7. # Nge-recover HP, SP, atau State kalau level-up
  8. #==============================================================================
  9. # CHANGELOG
  10. # V.1.0 | Original Release
  11. # V.1.1 | Cross-Engined
  12. #==============================================================================
  13. module LevelUpRecover
  14.   RECOVER_HP = true # Set ke true jika ingin recover HP saat level up.
  15.   RECOVER_MP = true # Set ke true jika ingin recover SP saat level up.
  16.   RECOVER_STATE = true # Set ke true jika ingin recover State saat level up.
  17. end
  18. #==============================================================================
  19. # EDITING BEYOND THIS LINE CAN CAUSE DAMAGE TO YOUR GAME, THEREFORE EDIT
  20. # WITH YOUR OWN RISK.
  21. #==============================================================================
  22. VX = defined?(Window_ActorCommand)
  23. level_def = VX ? "change_exp" : "exp="
  24. hp_max = VX ? "maxhp" : "self.maxhp"
  25. sp_max = VX ? "@mp = maxmp" : "@sp = self.maxsp"
  26. eval"
  27.  
  28. class Game_Actor < Game_Battler
  29.  include LevelUpRecover
  30.  alias recover_exp #{level_def} unless $@
  31.  def #{level_def}(*args, &block)
  32.    recover_exp(*args, &block)
  33.    @hp = #{hp_max} if RECOVER_HP
  34.    #{sp_max} if RECOVER_MP
  35.    @states.clear if RECOVER_STATE
  36.  end
  37. end#"
Advertisement
Add Comment
Please, Sign In to add comment