Advertisement
Dekita

Damage Tracker v1.1

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