TheoAllen

Theo - Custom Parameter Formula (ENG)

Dec 8th, 2013
820
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.83 KB | None | 0 0
  1. # =============================================================================
  2. # TheoAllen - Custom Parameter Formula
  3. # Version : 1.0
  4. # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
  5. # (English Documentaton)
  6. # -----------------------------------------------------------------------------
  7. # ATTENTION ~ !
  8. # - This script needs RGSS3 knowlegde if you want to use it optimally.
  9. #   If you want to do something and you don't know how to do it in this script,
  10. #   you may ask me or make a thread script support in RGSS forum
  11. # =============================================================================
  12. ($imported ||= {})[:Theo_CustomParamFormula] = true
  13. # =============================================================================
  14. # Change Logs:
  15. # -----------------------------------------------------------------------------
  16. # 2013.11.12 - Finished Script
  17. # =============================================================================
  18. =begin
  19.   ---------------------------------------------------------------------------
  20.   Introduction :
  21.   ---------------------------------------------------------------------------
  22.   Have u though what if each parameter has its own formula? For example, the
  23.   MDF bonus is depends on remaining MP. Or even DEF is depends on remaining
  24.   HP? Which mean, if your character has a lot of remaining HP, your character
  25.   will be much stronger.
  26.  
  27.   ---------------------------------------------------------------------------
  28.   How to use :
  29.   ---------------------------------------------------------------------------
  30.   Put this script below material but above main
  31.   Edit the configuration below. Make sure that you edit it between "def" and
  32.   "end". For example :
  33.  
  34.   def custom_mdf(ori_param)
  35.     ori_param + mp/5
  36.   end
  37.  
  38.   (ori_param is a original parameter from the character)
  39.   From the example abouve, the MDF value will have 1 parameter bonus for each
  40.   MP 5. Which mean, if your character has 100 remain MP and MDF is equal 50,
  41.   then the result is 50 + (100/5) = 70
  42.  
  43.   What if those formula affect only specified character?
  44.   You may use "case" and when". For example :
  45.  
  46.   def custom_mdf(ori_param)
  47.     case id
  48.     when 1
  49.       ori_param + mp/5
  50.     else
  51.       ori_param
  52.     end
  53.   end
  54.  
  55.   Then, the rule only affect on an actor which has ID 1.
  56.   You may add "case, when" as many as you want
  57.  
  58.   A List of variables that can be used :
  59.   (Not limited on these if you know how to code in RGSS3)
  60.  
  61.   - hp    >> Remain HP
  62.   - mp    >> Remain MP
  63.   - tp    >> TP Value
  64.   - mhp   >> Maximal HP
  65.   - mmp   >> Maximal MP
  66.   - atk   >> Attack
  67.   - def   >> Defense
  68.   - mat   >> Magic attack
  69.   - mdf   >> Magic defense
  70.   - agi   >> Agility
  71.   - luk   >> Luck
  72.  
  73.   - $game_variables[var_id] >> In game variable (replace var_id with a number)
  74.  
  75.   ---------------------------------------------------------------------------
  76.   Terms of use :
  77.   ---------------------------------------------------------------------------
  78.   Credit me, TheoAllen. You are free to edit this script by your own. As long
  79.   as you don't claim it yours. For commercial purpose, don't forget to give me
  80.   a free copy of the game.
  81.  
  82.   If you want to share your ustom formula to public, you can request a credit
  83.   for yourself. But don't forget to credit me as well.
  84.  
  85. =end
  86. # =============================================================================
  87. class Game_Actor < Game_Battler  # <-- Do not touch
  88. # =============================================================================
  89. # Here you can edit your own custom formula
  90. # =============================================================================
  91.     Param_Base = false   # Basic Parameter? (Read below)
  92.   # --------------------------------------------------------------------------
  93.   # True  >> The ori_param value will be depends on database that not currently
  94.   #          calculated from features modifier            
  95.   # False >> The ori_param value have been produced from feature calculation
  96.   #          and others
  97.   # --------------------------------------------------------------------------
  98.   # * ) Maximum MP
  99.   # --------------------------------------------------------------------------
  100.   def custom_mhp(ori_param)
  101.     ori_param    # <-- Define it here
  102.   end
  103.   # --------------------------------------------------------------------------
  104.   # * ) Maximum MP
  105.   # --------------------------------------------------------------------------
  106.   def custom_mmp(ori_param)
  107.     ori_param   # <-- Define it here
  108.   end
  109.   # --------------------------------------------------------------------------
  110.   # * ) Attack Point
  111.   # --------------------------------------------------------------------------
  112.   def custom_atk(ori_param)
  113.     ori_param   # <-- Define it here
  114.   end
  115.   # --------------------------------------------------------------------------
  116.   # * ) Defense Point
  117.   # --------------------------------------------------------------------------
  118.   def custom_def(ori_param)
  119.     ori_param   # <-- Define it here
  120.   end
  121.   # --------------------------------------------------------------------------
  122.   # * ) Magic Attack
  123.   # --------------------------------------------------------------------------
  124.   def custom_mat(ori_param)
  125.     ori_param   # <-- Define it here
  126.   end
  127.   # --------------------------------------------------------------------------
  128.   # * ) Magic Defense
  129.   # --------------------------------------------------------------------------
  130.   def custom_mdf(ori_param)
  131.     ori_param   # <-- Define it here
  132.   end
  133.   # --------------------------------------------------------------------------
  134.   # * ) Agility Point
  135.   # --------------------------------------------------------------------------
  136.   def custom_agi(ori_param)
  137.     ori_param   # <-- Define it here
  138.   end
  139.   # --------------------------------------------------------------------------
  140.   # * ) Luck Point
  141.   # --------------------------------------------------------------------------
  142.   def custom_luk(ori_param)
  143.     ori_param   # <-- Define it here
  144.   end
  145. # =============================================================================
  146. # End of configuration
  147. # =============================================================================
  148. end
  149. param_name = Game_Actor::Param_Base ? "param_base" : "param"
  150. eval("
  151. class Game_Actor < Game_Battler
  152.  alias theo_custom_param #{param_name}
  153.  def #{param_name}(param_id)
  154.    ori_param = theo_custom_param(param_id)
  155.    case param_id
  156.    when 0  # MHP
  157.      custom_mhp(ori_param)
  158.    when 1  # MMP
  159.      custom_mmp(ori_param)
  160.    when 2  # ATK
  161.      custom_atk(ori_param)
  162.    when 3  # DEF
  163.      custom_def(ori_param)
  164.    when 4  # MAT
  165.      custom_mat(ori_param)
  166.    when 5  # MDF
  167.      custom_mdf(ori_param)
  168.    when 6  # AGI
  169.      custom_agi(ori_param)
  170.    when 7  # LUK
  171.      custom_luk(ori_param)
  172.    end
  173.  end
  174. end
  175. ")
Advertisement
Add Comment
Please, Sign In to add comment