Advertisement
Dekita

tp limz

Nov 7th, 2012
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.84 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.0
  3. ★ TP Limit Breaker™ ★
  4.  
  5. ================================================================================
  6. Script Information:
  7. ====================
  8. Simple script to allow for higher TP than normally allowed, e.g 1,000,000 tp.
  9.  
  10. ================================================================================
  11. FEATURES:
  12. ==========
  13. - Big Numbers ^_^
  14.  
  15. ================================================================================
  16. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  17. ================================================================================
  18. 1. You must give credit to "Dekita"
  19. 2. You are NOT allowed to repost this script.(or modified versions)
  20. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  21. 4. You are NOT allowed to use this script for Commercial games.
  22. 5. ENJOY!
  23.  
  24. "FINE PRINT"
  25. By using this script you hereby agree to the above terms and conditions,
  26. if any violation of the above terms occurs "legal action" may be taken.
  27. Not understanding the above terms and conditions does NOT mean that
  28. they do not apply to you.
  29. If you wish to discuss the terms and conditions in further detail you can
  30. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  31.  
  32. ================================================================================
  33. History:
  34. =========
  35. D /M /Y
  36. 11/10/2o12 - Started and finished.
  37.  
  38. ================================================================================
  39. INSTRUCTIONS:
  40. ==============
  41. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  42. REQUIRES Dekita__CORE, place this below the core script.
  43.  
  44. ================================================================================
  45. Notetags:
  46. ==========
  47. <inc tp: X>
  48.  
  49. X = a value
  50. give this notetag to equipment to increase maximum tp while it is equipped
  51. =end
  52.  
  53. module Dekita__TP_Limits
  54.  
  55. Max_TP = 5
  56.  
  57. Preserve_TP = true
  58. Initial_TP = 0
  59. Regen_TP = 0
  60.  
  61. Take_HP_Damage = 1
  62. Deal_HP_Damage = 1
  63. Heal_HP_Damage = 0
  64.  
  65. Take_MP_Damage = 0
  66. Deal_MP_Damage = 0
  67. Heal_MP_Damage = 0
  68.  
  69. Kill_Enemy = 0
  70.  
  71. # Do Not Remove this.
  72. p 'Loaded : DPBz - TP Limits'
  73. end # module Dekita__TP_Limits
  74.  
  75. $imported = {} if $imported.nil?
  76. $imported[:Dekita__TP_Limits] = true
  77.  
  78. #==============================================================================
  79. module DataManager
  80. #==============================================================================
  81.  
  82. class <<self; alias load_database_TP_Limits_DPBz load_database; end
  83. def self.load_database
  84. load_database_TP_Limits_DPBz
  85. load_notetags_TP_Limits_DPBz
  86. end
  87.  
  88. def self.load_notetags_TP_Limits_DPBz
  89. groups = [$data_weapons, $data_armors]
  90. for group in groups
  91. for obj in group
  92. next if obj.nil?
  93. obj.load_notetags_TP_Limits_DPBz
  94. end
  95. end
  96. end
  97.  
  98. end # DataManager
  99.  
  100. #==============================================================================
  101. class RPG::EquipItem < RPG::BaseItem
  102. #==============================================================================
  103.  
  104. attr_accessor :max_tp_boost_DPBz
  105.  
  106. def load_notetags_TP_Limits_DPBz
  107. @max_tp_boost_DPBz = 0
  108. self.note.split(/[\r\n]+/).each { |line|
  109. case line
  110. when /<inc tp: (.*)>/i
  111. @max_tp_boost_DPBz += $1.to_i
  112. p "Loaded : DPBz - TP Limits - Max TP Limit Mod For #{name}"
  113. end
  114. } # self.note.split
  115. end
  116.  
  117. end # RPG::EquipItem
  118.  
  119. #==============================================================================
  120. class Game_BattlerBase
  121. #==============================================================================
  122.  
  123. def tp_rate
  124. @tp.to_f / max_tp
  125. end
  126.  
  127. alias preserve_tp_DPBz preserve_tp?
  128. def preserve_tp?
  129. return true if Dekita__TP_Limits::Preserve_TP
  130. return preserve_tp_DPBz
  131. end
  132.  
  133. end # class Game_BattlerBase
  134.  
  135. #==============================================================================
  136. class Game_Battler < Game_BattlerBase
  137. #==============================================================================
  138.  
  139. def init_tp
  140. self.tp = Dekita__TP_Limits::Initial_TP
  141. end
  142.  
  143. def charge_tp_by_damage(damage_rate)
  144. self.tp += Dekita__TP_Limits::Take_HP_Damage
  145. end
  146.  
  147. def charge_tp_by_mp_damage(damage_rate)
  148. self.tp += Dekita__TP_Limits::Take_MP_Damage
  149. end
  150.  
  151. def regenerate_tp
  152. self.tp += Dekita__TP_Limits::Regen_TP
  153. end
  154.  
  155. alias execute_damage_DPBz_TP execute_damage
  156. def execute_damage(user)
  157. execute_damage_DPBz_TP(user)
  158. return unless $game_party.in_battle
  159. if @result.hp_damage > 0
  160. user.tp += Dekita__TP_Limits::Deal_HP_Damage
  161. elsif @result.hp_damage < 0
  162. user.tp += Dekita__TP_Limits::Heal_HP_Damage
  163. end
  164. if @result.mp_damage > 0
  165. user.tp += Dekita__TP_Limits::Deal_MP_Damage
  166. charge_tp_by_mp_damage(@result.mp_damage)
  167. elsif @result.mp_damage < 0
  168. user.tp += Dekita__TP_Limits::Heal_MP_Damage
  169. end
  170. user.tp += Dekita__TP_Limits::Kill_Enemy if self.hp == 0
  171. end
  172.  
  173. alias item_effect_recover_hp_DPBz_TP item_effect_recover_hp
  174. def item_effect_recover_hp(user, item, effect)
  175. item_effect_recover_hp_DPBz_TP(user, item, effect)
  176. return unless $game_party.in_battle
  177. if @result.hp_damage > 0
  178. user.tp += Dekita__TP_Limits::Deal_HP_Damage
  179. elsif @result.hp_damage < 0
  180. user.tp += Dekita__TP_Limits::Heal_HP_Damage
  181. end
  182. end
  183.  
  184. alias item_eff_DPBZ item_effect_recover_mp
  185. def item_effect_recover_mp(user, item, effect)
  186. item_eff_DPBZ(user, item, effect)
  187. return unless $game_party.in_battle
  188. if @result.mp_damage > 0
  189. user.tp += Dekita__TP_Limits::Deal_MP_Damage
  190. elsif @result.mp_damage < 0
  191. user.tp += Dekita__TP_Limits::Heal_MP_Damage
  192. end
  193. end
  194.  
  195. end # Game_Battler
  196.  
  197. #==============================================================================
  198. class Game_Actor < Game_Battler
  199. #==============================================================================
  200.  
  201. def max_tp
  202. val = Dekita__TP_Limits::Max_TP
  203. val += equip_tp_limit_raise_DPBz
  204. end
  205.  
  206. def equip_tp_limit_raise_DPBz
  207. rlval = 0.0
  208. rlval += equips.compact.inject(0) {|r, i| r += i.max_tp_boost_DPBz rescue 0 }
  209. return rlval
  210. end
  211.  
  212. end # class Game_Actor < Game_Battler
  213.  
  214. #===============================================================================#
  215. # - SCRIPT END - #
  216. #===============================================================================#
  217. # http://dekitarpg.wordpress.com/ #
  218. #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement