Advertisement
Double_X

Level Cap

Jun 16th, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.53 KB | None | 0 0
  1. #==============================================================================|
  2. #  ** You only need to edit this part as it's about what this snippet does     |
  3. #------------------------------------------------------------------------------|
  4.  
  5. module Level_Cap
  6.  
  7.   # The level cap of all actors when game switch with id CAP_SWITCH_ID is true
  8.   LEVEL_CAP = 50
  9.  
  10.   # Id of game switch used to apply LEVEL_CAP to all actors
  11.   # Setting CAP_SWITCH_ID as 0 disables the entire feature
  12.   CAP_SWITCH_ID = 0
  13.  
  14. end # Level_Cap
  15.  
  16. #==============================================================================|
  17.  
  18. #==============================================================================|
  19. #  ** You need not edit this part as it's about how this snippet works         |
  20. #------------------------------------------------------------------------------|
  21.  
  22. class Game_Actor < Game_Battler
  23.  
  24.   #----------------------------------------------------------------------------|
  25.   #  Alias method: max_level                                                   |
  26.   #----------------------------------------------------------------------------|
  27.   alias max_level_cap max_level
  28.   def max_level
  29.     # This part is rewritten by this snippet to use LEVEL_CAP if switch with id CAP_SWITCH_ID is true
  30.     cap_switch_id = Level_Cap::CAP_SWITCH_ID
  31.     cap_switch_id > 0 && $game_switches[cap_switch_id] ? Level_Cap::LEVEL_CAP : max_level_cap
  32.     #
  33.   end # max_level
  34.  
  35. end # Game_Actor
  36.  
  37. #==============================================================================|
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement