Advertisement
AngryPacman

[VXA] Movable Level Cap

Jun 18th, 2012
707
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.59 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Movable Level Cap (1.0)
  4. # 21/10/12
  5. # By Pacman
  6. # This script simply allows you to change the level max of actors. Actors start
  7. # the game with the level max you set in the database, but this can be altered
  8. # in-game with a simple script call.
  9. #
  10. # Script Call:
  11. #   change_max_level(id[, n])
  12. #     Changes the level maximum of actor with ID id to n. If n is omitted, it
  13. #     will set it to the actor's default level maximum. If n is less than 1, it
  14. #     will be set to 1.
  15. #
  16. #===============================================================================
  17.  
  18. #==============================================================================
  19. # ** Game_Actor
  20. #------------------------------------------------------------------------------
  21. #  This class handles actors. It is used within the Game_Actors class
  22. # ($game_actors) and is also referenced from the Game_Party class ($game_party).
  23. #==============================================================================
  24.  
  25. class Game_Actor < Game_Battler
  26.   #--------------------------------------------------------------------------
  27.   # Public Instance Variables
  28.   #--------------------------------------------------------------------------
  29.   attr_accessor :max_level
  30.   #--------------------------------------------------------------------------
  31.   # * Get maximum level
  32.   #--------------------------------------------------------------------------
  33.   def max_level(*args)
  34.     @max_level || actor.max_level
  35.   end
  36. end
  37.  
  38. #==============================================================================
  39. # ** Game_Interpreter
  40. #------------------------------------------------------------------------------
  41. #  An interpreter for executing event commands. This class is used within the
  42. # Game_Map, Game_Troop, and Game_Event classes.
  43. #==============================================================================
  44.  
  45. class Game_Interpreter
  46.   #--------------------------------------------------------------------------
  47.   # * Change actor's level cap
  48.   #     id : ID of actor whose level is changing
  49.   #     n  : new level cap (must be larger than 0)
  50.   #--------------------------------------------------------------------------
  51.   def change_max_level(id, n = nil)
  52.     n ||= $game_actors[id].actor.max_level
  53.     $game_actors[id].max_level = [n, 1].max
  54.   end
  55. end
  56.  
  57. ($pac ||= {})[:movable_lvl_cap] = 1.0
  58.  
  59. #===============================================================================
  60. #
  61. # END OF SCRIPT
  62. #
  63. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement