adiktuzmiko

Level Extension v1.10

Mar 6th, 2014
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.11 KB | None | 0 0
  1. =begin
  2.  ==============================================================================
  3.  
  4.  Level Extension v1.10
  5.  by AdiktuzMiko
  6.  --- Date Created: 03/06/2014
  7.  --- Last Date Updated: 03/08/2014
  8.  --- Level: Easy
  9.  
  10.  ==============================================================================
  11.  Overview
  12.  ==============================================================================
  13.  
  14.  This script provides the ability to run RGSS3 methods/formulas during the
  15.  level up and down
  16.  
  17.  These can be used for:
  18.  
  19.  global/actors/classes/weapons/armors/states
  20.  
  21.  Global - affects all level up/downs
  22.  Actors - affects all level up/down by the actor
  23.  Classes - affects all level up/down by the class
  24.  Weapons/Armors - affects all level up/down by the actor that is
  25.                   equipped with the item
  26.  States - affects all level up/down by the actor who has the state
  27.  
  28.  ==============================================================================
  29.  Set-Up
  30.  ==============================================================================
  31.  
  32.  Just put this script into a blank slot above main but below materials
  33.  (see compatibility section) and start tagging and making your own formulas
  34.  
  35.  ==============================================================================
  36.  Method flow
  37.  ==============================================================================
  38.  
  39.  This is the normal flow of the custom methods based on the default set-up
  40.  
  41.  global
  42.  Actor
  43.  Class
  44.  Equips
  45.  State
  46.  
  47.  ==============================================================================
  48.  Tags
  49.  ==============================================================================
  50.  
  51.  -------------------------------------------------------------------
  52.  For level up
  53.  -------------------------------------------------------------------
  54.  <start_level_ext>
  55.    formula
  56.  <end_level_ext>
  57.  
  58.  -------------------------------------------------------------------
  59.  For level down
  60.  -------------------------------------------------------------------
  61.  <start_unlevel_ext>
  62.    formula
  63.  <end_unlevel_ext>
  64.  
  65.  Use self to denote the actor that is leveled
  66.  
  67.  As for the global, go to the module below and edit the method
  68.  
  69.  ==============================================================================
  70.  Compatibility
  71.  ==============================================================================
  72.  
  73.  This script aliases Game_Actor's level_up and level_down methods
  74.  So put it below any script that overwrites those
  75.  
  76.  ==============================================================================
  77.  Terms and Conditions
  78.  ==============================================================================
  79.  
  80.  View it here: http://lescripts.wordpress.com/terms-and-conditions/
  81.  
  82.  ==============================================================================
  83. =end
  84.  
  85. module ADIK
  86.   module LEVEL_EXTENSION
  87.    
  88.     #Edit this one for global level extension
  89.    
  90.     def self.global_level(actor)
  91.       actor.hp = actor.mhp
  92.       actor.mp = actor.mmp
  93.     end
  94.    
  95.     #Edit this one for global unlevel extension
  96.     def self.global_unlevel(actor)
  97.     end
  98.    
  99.     # ==============================================================================
  100.     # DO NOT EDIT BELOW THIS LINE
  101.     # ==============================================================================
  102.  
  103.     LEVEL = /<start_level_ext>(.*)<end_level_ext>/m
  104.     UNLEVEL = /<start_unlevel_ext>(.*)<end_unlevel_ext>/m
  105.   end
  106. end
  107.  
  108. class RPG::BaseItem
  109.  
  110.  def load_level_extension_formula
  111.     @level_extension_formula = ""
  112.     if self.note =~ ADIK::LEVEL_EXTENSION::LEVEL
  113.       @level_extension_formula = $1.to_s
  114.     end
  115.     return @level_extension_formula
  116.   end
  117.  
  118.   def level_extension_formula
  119.     return @level_extension_formula.nil? ? load_level_extension_formula : @level_extension_formula
  120.   end
  121.  
  122.   def load_unlevel_extension_formula
  123.     @unlevel_extension_formula = ""
  124.     if self.note =~ ADIK::LEVEL_EXTENSION::UNLEVEL
  125.       @unlevel_extension_formula = $1.to_s
  126.     end
  127.     return @unlevel_extension_formula
  128.   end
  129.  
  130.   def unlevel_extension_formula
  131.     return @unlevel_extension_formula.nil? ? load_unlevel_extension_formula : @unlevel_extension_formula
  132.   end
  133.  
  134. end
  135.  
  136.  
  137. class Game_Actor
  138.  
  139.   alias level_up_extension level_up
  140.   def level_up
  141.     level_up_extension
  142.     ADIK::LEVEL_EXTENSION.global_level(self)
  143.     eval(self.actor.level_extension_formula)
  144.     eval(self.class.level_extension_formula)
  145.     self.equips.each do |equip|
  146.       next if equip.nil?
  147.       eval(equip.level_extension_formula)
  148.     end
  149.     self.states.each do |state|
  150.       next if state.nil?
  151.       eval(state.level_extension_formula)
  152.     end
  153.   end
  154.  
  155.   alias level_down_extension level_down
  156.   def level_down
  157.     level_down_extension
  158.     ADIK::LEVEL_EXTENSION.global_unlevel(self)
  159.     eval(self.actor.unlevel_extension_formula)
  160.     eval(self.class.unlevel_extension_formula)
  161.     self.equips.each do |equip|
  162.       next if equip.nil?
  163.       eval(equip.unlevel_extension_formula)
  164.     end
  165.       self.states.each do |state|
  166.       next if state.nil?
  167.       eval(state.unlevel_extension_formula)
  168.     end
  169.   end
  170.  
  171. end
Advertisement
Add Comment
Please, Sign In to add comment