TheoAllen

Theo - Difficulty Setting

Feb 23rd, 2013
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 10.70 KB | None | 0 0
  1. # =============================================================================
  2. # ♫ ~ Difficulty setting by parameter by TheoAllen ~ ♫
  3. # Version  : 1.1
  4. # Requires : N/A
  5. # Contact  : www.rpgmakerid.com
  6. # =============================================================================
  7. # ♫ UPDATES :
  8. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  9. # 2013.03.01 - Add shop price change
  10. #            - Add exp gain change
  11. #            - Add gold drop change
  12. #            - Compatibility Patch
  13. # 2013.02.24 - Fixed bugs
  14. # 2013.02.24 - Started and finished script
  15. #
  16. # =============================================================================
  17. # ♫ DESCRIPTION :
  18. # This script allow you to change enemy's parameter for difficulty setting.
  19. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  20. # ♫ INSTRUCTION :
  21. # Put this script below material but above main in script editor. Don't forget
  22. # to save.
  23. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  24. # ♫ HOW TO USE :
  25. # Edit the configuration below. Determine the variable id for parameter change.
  26. # WARNING! This script isn't plug an play! You need to do something with game
  27. # variable at the beginning of your game first!
  28. #
  29. # For example, if you set MHP_ID = 1
  30. # You need to set 1st id variable to 100 or another number as you like.
  31. # Remember. 100 stands for 100%. 50 stands for 50%
  32. # =============================================================================
  33. # ♫ TERMS OF USE :
  34. # - Credit me, TheoAllen. If you think it's necessary.
  35. # - You may use this script both commercial and non-commercial purposes or even
  36. #   adult game as long as you don't claim it's yours.
  37. # - I'll be glad if you give me a free copy of your game if you use this script
  38. #   in your commercial project.
  39. # =============================================================================
  40. $imported = {} if $imported.nil?
  41. $imported["Theo-DiffSetting"] = true
  42. # =============================================================================
  43. # ♫ CONFIGURATIONS ~ ♫
  44. # =============================================================================
  45. module THEOLIZED
  46.  
  47. # Edit these setting to decide which variable id will be used for enemy's
  48. # parameter change. 0 to disable
  49.   MHP_ID = 1
  50.   MMP_ID = 2
  51.   ATK_ID = 3
  52.   DEF_ID = 4
  53.   MAT_ID = 5
  54.   MDF_ID = 6
  55.   AGI_ID = 7
  56.   LUK_ID = 8
  57.  
  58. # Battle Related. If you also want to change total gained exp and gold drop.
  59. # 0 to disable
  60.   EXP_ID  = 0
  61.   GOLD_ID = 0
  62.  
  63. # Scene shop related. If you also want to change the buying price and selling
  64. # price. 0 to disable
  65.   BUY_ID  = 0
  66.   SELL_ID = 0
  67.  
  68. end
  69. # =============================================================================
  70. # ♫ Do not edit unless you know what to do ~ ♫
  71. # =============================================================================
  72. # SCRIPT INFOS:
  73. # ------------------------------------------
  74. # Rewriten method : N/A
  75. # ------------------------------------------
  76. # Aliased method :
  77. # - Game_Enemy
  78. #     def mhp
  79. #     def mmp
  80. #     def atk
  81. #     def def
  82. #     def mat
  83. #     def mdf
  84. #     def agi
  85. #     def luk
  86. # - Game_Troop
  87. #     def exp_total
  88. #     def gold_total
  89. # - Scene_Shop
  90. #     def buying_price
  91. #     def selling_price
  92. # =============================================================================
  93. # ♫ Game_Enemy ~ ♫
  94. # =============================================================================
  95. class Game_Enemy < Game_Battler
  96.   #--------------------------------------------------------------------------
  97.   # ♫ Maximum hit point
  98.   #--------------------------------------------------------------------------
  99.   alias theolized_mhp mhp
  100.   def mhp  
  101.     check_var_id(diff_var_id(0)) ? theolized_mhp*$game_variables[diff_var_id(0)]/100 : theolized_mhp  
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ♫ Maximum magic point
  105.   #--------------------------------------------------------------------------
  106.   alias theolized_mmp mmp
  107.   def mmp
  108.     check_var_id(diff_var_id(1)) ? theolized_mmp*$game_variables[diff_var_id(1)]/100 : theolized_mmp
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ♫ Attack point
  112.   #--------------------------------------------------------------------------
  113.   alias theolized_atk atk
  114.   def atk  
  115.     check_var_id(diff_var_id(2)) ? theolized_atk*$game_variables[diff_var_id(2)]/100 : theolized_atk
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ♫ Defense point
  119.   #--------------------------------------------------------------------------
  120.   alias theolized_def def
  121.   def def
  122.     check_var_id(diff_var_id(3)) ? theolized_def*$game_variables[diff_var_id(3)]/100 : theolized_def
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ♫ Magic attack
  126.   #--------------------------------------------------------------------------
  127.   alias theolized_mat mat
  128.   def mat
  129.     check_var_id(diff_var_id(4)) ? theolized_mat*$game_variables[diff_var_id(4)]/100 : theolized_mat  
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ♫ Magic defense
  133.   #--------------------------------------------------------------------------
  134.   alias theolized_mdf mdf
  135.   def mdf  
  136.     check_var_id(diff_var_id(5)) ? theolized_mdf*$game_variables[diff_var_id(5)]/100 : theolized_mdf  
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ♫ Agility point
  140.   #--------------------------------------------------------------------------
  141.   alias theolized_agi agi
  142.   def agi
  143.     check_var_id(diff_var_id(6)) ? theolized_agi*$game_variables[diff_var_id(6)]/100 : theolized_agi
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ♫ Luck point
  147.   #--------------------------------------------------------------------------
  148.   alias theolized_luk luk
  149.   def luk
  150.     check_var_id(diff_var_id(7)) ? theolized_luk*$game_variables[diff_var_id(7)]/100 : theolized_luk
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ♫ Get variable id
  154.   #--------------------------------------------------------------------------
  155.   def diff_var_id(id)
  156.     case id
  157.     when 0
  158.       return THEOLIZED::MHP_ID
  159.     when 1
  160.       return THEOLIZED::MMP_ID
  161.     when 2
  162.       return THEOLIZED::ATK_ID
  163.     when 3
  164.       return THEOLIZED::DEF_ID
  165.     when 4
  166.       return THEOLIZED::MAT_ID
  167.     when 5
  168.       return THEOLIZED::MDF_ID
  169.     when 6
  170.       return THEOLIZED::AGI_ID
  171.     when 7
  172.       return THEOLIZED::LUK_ID
  173.     else
  174.       return 0
  175.     end
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ♫ Check variable id
  179.   #--------------------------------------------------------------------------
  180.   def check_var_id(id)
  181.     return true if id > 0
  182.     return false
  183.   end
  184.  
  185. end
  186. # =============================================================================
  187. # ♫ Game_Troop ♫
  188. # =============================================================================
  189. class Game_Troop < Game_Unit
  190.   #--------------------------------------------------------------------------
  191.   # * Calculate Total Experience
  192.   #--------------------------------------------------------------------------
  193.   alias theolized_exp_total exp_total
  194.   def exp_total
  195.     check_var(battle_var(0)) ? theolized_exp_total*game_var(battle_var(0))/100 : theolized_exp_total
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # * Calculate Total Gold
  199.   #--------------------------------------------------------------------------
  200.   alias theolized_gold_total gold_total
  201.   def gold_total
  202.     check_var(battle_var(1)) ? theolized_gold_total*game_var(battle_var(1))/100 : theolized_gold_total
  203.   end
  204.    #--------------------------------------------------------------------------
  205.   # ♫ Get battle variable id
  206.   #--------------------------------------------------------------------------
  207.   def battle_var(id)
  208.     case id
  209.     when 0
  210.       return THEOLIZED::EXP_ID
  211.     when 1
  212.       return THEOLIZED::GOLD_ID
  213.     else
  214.       return 0
  215.     end # case
  216.   end # battle var
  217.   #--------------------------------------------------------------------------
  218.   # ♫ Check variable id
  219.   #--------------------------------------------------------------------------
  220.   def check_var(index)
  221.     return false unless index > 0
  222.     return true
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # ♫ Simplify game variable call
  226.   #--------------------------------------------------------------------------
  227.   def game_var(index)
  228.     $game_variables[index]
  229.   end
  230.  
  231. end
  232. # =============================================================================
  233. # ♫ Scene_Shop ♫
  234. # =============================================================================
  235. class Scene_Shop < Scene_MenuBase
  236.   #--------------------------------------------------------------------------
  237.   # ♫ Get Purchase Price
  238.   #--------------------------------------------------------------------------
  239.   alias theolized_buy_price buying_price
  240.   def buying_price
  241.     check_var(price_var(0)) ? theolized_buy_price*game_var(price_var(0))/100 : theolized_buy_price
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ♫ Get Sale Price
  245.   #--------------------------------------------------------------------------
  246.   alias theolized_sell_price selling_price
  247.   def selling_price
  248.     check_var(price_var(1)) ? theolized_sell_price*game_var(price_var(1))/100 : theolized_sell_price
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ♫ Check variable id
  252.   #--------------------------------------------------------------------------
  253.   def check_var(index)
  254.     return false unless index > 0
  255.     return true
  256.   end
  257.   #--------------------------------------------------------------------------
  258.   # ♫ Get price variable id
  259.   #--------------------------------------------------------------------------
  260.   def price_var(id)
  261.     case id
  262.     when 0
  263.       return THEOLIZED::BUY_ID
  264.     when 1
  265.       return THEOLIZED::SELL_ID
  266.     else
  267.       return 0
  268.     end # case
  269.   end # price_var
  270.   #--------------------------------------------------------------------------
  271.   # ♫ Simplify game variable call
  272.   #--------------------------------------------------------------------------
  273.   def game_var(index)
  274.     $game_variables[index]
  275.   end
  276.  
  277. end
  278. # =============================================================================
  279. # ♫ End of Script ♫
  280. # =============================================================================
Advertisement
Add Comment
Please, Sign In to add comment