Advertisement
Dekita

damage tracker 1.0

Mar 23rd, 2013
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.71 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # ☆ $D13x - Damage Tracker
  4. # -- Author : Dekita
  5. # -- Version : 1.0
  6. # -- Level : Easy
  7. # -- Requires : N/A
  8. # -- Engine : RPG Maker VX Ace.
  9. #
  10. #===============================================================================
  11. # ☆ Import
  12. #-------------------------------------------------------------------------------
  13. $D13x={}if$D13x==nil
  14. $D13x[:DMG_Tracker]=true
  15. #===============================================================================
  16. # ☆ Updates
  17. #-------------------------------------------------------------------------------
  18. # D /M /Y
  19. # 22/o3/2o13 - Started, Finished,
  20. #
  21. #===============================================================================
  22. # ☆ Introduction
  23. #-------------------------------------------------------------------------------
  24. # This Script allows variables to track the overall damage actors have taken
  25. # and the overall damage actors have dealt to enemies.
  26. # Each point of damage an actor takes/deals will be added onto a set variable.
  27. #
  28. # Does not account for heals of any kind !!
  29. #
  30. # Why you may want to use this :
  31. # Maybe a healing skill that heals based on the damage you take during gameplay.
  32. # Maybe a clan that only allows warriors who have been through harsh battles ?
  33. # Maybe you want to combine this script with my $D13x - Learn Skill Requirements
  34. # To make certain skills only available after taking/dealing x amount of damage...
  35. # The list goes on :p
  36. #
  37. # The default settings will only track variables for actor 1, you must customize
  38. # the settings to suit your needs for other actors.
  39. #
  40. #===============================================================================
  41. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  42. #===============================================================================
  43. # 1. You MUST give credit to "Dekita" !!
  44. # 2. You are NOT allowed to repost this script.(or modified versions)
  45. # 3. You are NOT allowed to convert this script.
  46. # 4. You are NOT allowed to use this script for Commercial games.
  47. # 5. ENJOY!
  48. #
  49. # "FINE PRINT"
  50. # By using this script you hereby agree to the above terms and conditions,
  51. # if any violation of the above terms occurs "legal action" may be taken.
  52. # Not understanding the above terms and conditions does NOT mean that
  53. # they do not apply to you.
  54. # If you wish to discuss the terms and conditions in further detail you can
  55. # contact me at http://dekitarpg.wordpress.com/
  56. #
  57. #===============================================================================
  58. # ☆ Instructions
  59. #-------------------------------------------------------------------------------
  60. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  61. #
  62. #===============================================================================
  63. # ☆ Additional Credit
  64. #-------------------------------------------------------------------------------
  65. # ' ' - For giving me the inspiration to write this :)
  66. #
  67. #===============================================================================
  68. module DMG_Tracker
  69. #===============================================================================
  70. Actor={}# << Keep
  71.  
  72. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  73. # ☆ General Settings
  74. #--------------------------------------------------------------------------
  75. # If this option is true, the damage taken from negative HRG / MRG states
  76. # will also be added to the variable (if it is set to use)
  77. # This would also include floor damage.
  78. # NOTE: Only affects damage taken, not damage dealt !
  79. All_Damage_Counts = true
  80.  
  81. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  82. # ☆ Tracking Settings
  83. #--------------------------------------------------------------------------
  84. # This is where you define which actors control which variables
  85. # Actor[ id ] = { << begins hash, must be kept.
  86. # :hp_dmg_took => [ use? , vari id ] , :mp_dmg_took => [ use? , vari id ] ,
  87. # :hp_dmg_deal => [ use? , vari id ] , :mp_dmg_deal => [ use? , vari id ] ,
  88. # } << ends hash, must be kept.
  89. Actor[1]={
  90. :hp_dmg_took => [ true , 100 ] , :mp_dmg_took => [ false , 101 ] ,
  91. :hp_dmg_deal => [ true , 102 ] , :mp_dmg_deal => [ false , 103 ] ,
  92. } # << End actor id 1
  93.  
  94. Actor[2]={
  95. :hp_dmg_took => [ false , 104 ] , :mp_dmg_took => [ false , 105 ] ,
  96. :hp_dmg_deal => [ false , 106 ] , :mp_dmg_deal => [ false , 107 ] ,
  97. } # << End actor id 2
  98.  
  99. Actor[3]={
  100. :hp_dmg_took => [ false , 108 ] , :mp_dmg_took => [ false , 109 ] ,
  101. :hp_dmg_deal => [ false , 110 ] , :mp_dmg_deal => [ false , 111 ] ,
  102. } # << End actor id 3
  103.  
  104. Actor[4]={
  105. :hp_dmg_took => [ false , 112 ] , :mp_dmg_took => [ false , 113 ] ,
  106. :hp_dmg_deal => [ false , 114 ] , :mp_dmg_deal => [ false , 115 ] ,
  107. } # << End actor id 4
  108.  
  109. Actor[5]={
  110. :hp_dmg_took => [ false , 116 ] , :mp_dmg_took => [ false , 117 ] ,
  111. :hp_dmg_deal => [ false , 118 ] , :mp_dmg_deal => [ false , 119 ] ,
  112. } # << End actor id 5
  113.  
  114. Actor[6]={
  115. :hp_dmg_took => [ false , 120 ] , :mp_dmg_took => [ false , 121 ] ,
  116. :hp_dmg_deal => [ false , 122 ] , :mp_dmg_deal => [ false , 123 ] ,
  117. } # << End actor id 6
  118.  
  119. Actor[7]={
  120. :hp_dmg_took => [ false , 124 ] , :mp_dmg_took => [ false , 125 ] ,
  121. :hp_dmg_deal => [ false , 126 ] , :mp_dmg_deal => [ false , 127 ] ,
  122. } # << End actor id 7
  123.  
  124. Actor[8]={
  125. :hp_dmg_took => [ false , 128 ] , :mp_dmg_took => [ false , 129 ] ,
  126. :hp_dmg_deal => [ false , 130 ] , :mp_dmg_deal => [ false , 131 ] ,
  127. } # << End actor id 8
  128.  
  129. Actor[9]={
  130. :hp_dmg_took => [ false , 132 ] , :mp_dmg_took => [ false , 133 ] ,
  131. :hp_dmg_deal => [ false , 134 ] , :mp_dmg_deal => [ false , 135 ] ,
  132. } # << End actor id 9
  133.  
  134. Actor[10]={
  135. :hp_dmg_took => [ false , 136 ] , :mp_dmg_took => [ false , 137 ] ,
  136. :hp_dmg_deal => [ false , 138 ] , :mp_dmg_deal => [ false , 139 ] ,
  137. } # << End actor id 10
  138.  
  139. # << Add more lines here if you have more than 10 actors :)
  140.  
  141. end #####################
  142. # CUSTOMISATION END #
  143. #####################
  144. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  145. # #
  146. # http://dekitarpg.wordpress.com/ #
  147. # #
  148. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  149. #===============================================================================#
  150. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  151. # YES?\.\. #
  152. # OMG, REALLY? \| #
  153. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  154. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  155. #===============================================================================#
  156. class Game_Battler < Game_BattlerBase
  157. #===============================================================================
  158. #--------------------------------------------------------------------------
  159. # Alias List
  160. #--------------------------------------------------------------------------
  161. alias :exe_dmg_tracker :execute_damage
  162. alias :regen_hp_vtrack :regenerate_hp
  163. alias :regen_mp_vtrack :regenerate_mp
  164. #--------------------------------------------------------------------------
  165. # Damage Processing
  166. #--------------------------------------------------------------------------
  167. def execute_damage(user)
  168. hpd = @result.hp_damage.to_i
  169. mpd = @result.mp_damage.to_i
  170. exe_dmg_tracker(user)
  171. execute_var_mod(hpd,mpd)
  172. exec_var_mod_II(user,hpd,mpd)
  173. end
  174. #--------------------------------------------------------------------------
  175. # Modify Variables From Damage Taken
  176. #--------------------------------------------------------------------------
  177. def execute_var_mod(hp_dam,mp_dam)
  178. return unless self.is_a?(Game_Actor)
  179. return unless DMG_Tracker::Actor[self.id] != nil
  180. info = DMG_Tracker::Actor[self.id]
  181. $game_variables[ info[:hp_dmg_took][1] ] += hp_dam if info[:hp_dmg_took][0]
  182. $game_variables[ info[:mp_dmg_took][1] ] += mp_dam if info[:mp_dmg_took][0]
  183. end
  184. #--------------------------------------------------------------------------
  185. # Modify Variables From Damage Dealt
  186. #--------------------------------------------------------------------------
  187. def exec_var_mod_II(user,hp_dam,mp_dam)
  188. return unless user.is_a?(Game_Actor)
  189. return unless DMG_Tracker::Actor[user.id] != nil
  190. info = DMG_Tracker::Actor[user.id]
  191. $game_variables[ info[:hp_dmg_deal][1] ] += hp_dam if info[:hp_dmg_deal][0]
  192. $game_variables[ info[:mp_dmg_deal][1] ] += mp_dam if info[:mp_dmg_deal][0]
  193. end
  194. #--------------------------------------------------------------------------
  195. # Regenerate HP
  196. #--------------------------------------------------------------------------
  197. def regenerate_hp
  198. regen_hp_vtrack
  199. execure_regen(:hp, @result.hp_damage)
  200. end
  201. #--------------------------------------------------------------------------
  202. # Regenerate MP
  203. #--------------------------------------------------------------------------
  204. def regenerate_mp
  205. regen_mp_vtrack
  206. execure_regen(:mp, @result.mp_damage)
  207. end
  208. #--------------------------------------------------------------------------
  209. # Execute Regen ( kept the typo ;p )
  210. #--------------------------------------------------------------------------
  211. def execure_regen(type = nil, damage)
  212. return unless self.is_a?(Game_Actor)
  213. return unless DMG_Tracker::All_Damage_Counts
  214. return unless type != nil
  215. return unless damage > 0
  216. return unless DMG_Tracker::Actor[self.id] != nil
  217. info = DMG_Tracker::Actor[self.id]
  218. vee = $game_variables
  219. case type
  220. when :hp then vee[info[:hp_dmg_took][1]] += damage if info[:hp_dmg_took][0]
  221. when :mp then vee[info[:mp_dmg_took][1]] += damage if info[:mp_dmg_took][0]
  222. end
  223. end
  224.  
  225. end
  226.  
  227. #==============================================================================#
  228. # http://dekitarpg.wordpress.com/ #
  229. #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement