Advertisement
Dekita

$D13x MMO Regen v1.1

May 30th, 2013
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.33 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - MMO Style Regen
  5. # -- Author : Dekita
  6. # -- Version : 1.1
  7. # -- Level : Easy
  8. # -- Requires : $D13x Core v1.6+
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:MMO_Regen]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # 18/o5/2o13 - Update, (Key Menu HUD now shows regen key)
  21. # o4/o4/2o13 - Started, Finished,
  22. #
  23. #===============================================================================
  24. # ☆ Introduction
  25. #-------------------------------------------------------------------------------
  26. # This script adds a MMO style regeneration method into the game.
  27. # Each second you (all battle members) will regenerate hp/mp/tp according
  28. # to the formulas within this script. Can also enable for enemies.
  29. #
  30. # you can have extra regen bonuses for holding down a key
  31. # and disable all regen unless a key is being pressed.
  32. #
  33. # The default formulas will allow for more hp to be regenerated based on
  34. # the actors max hp, but you can make the formula check whatever actor stats
  35. # you want, for example, you could easily base the regen method against
  36. # an actors equipment or skills... ( << needs coding know-how )
  37. #
  38. # This script requires my $D13x Core, therefor most keyboard keys are available
  39. # as the "Regen" key. (By default its the 'R' Key)
  40. #
  41. #===============================================================================
  42. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  43. #===============================================================================
  44. # 1. You MUST give credit to "Dekita" !!
  45. # 2. You are NOT allowed to repost this script.(or modified versions)
  46. # 3. You are NOT allowed to convert this script.
  47. # 4. You are NOT allowed to use this script for Commercial games.
  48. # 5. ENJOY!
  49. #
  50. # "FINE PRINT"
  51. # By using this script you hereby agree to the above terms and conditions,
  52. # if any violation of the above terms occurs "legal action" may be taken.
  53. # Not understanding the above terms and conditions does NOT mean that
  54. # they do not apply to you.
  55. # If you wish to discuss the terms and conditions in further detail you can
  56. # contact me at http://dekitarpg.wordpress.com/
  57. #
  58. #===============================================================================
  59. # ☆ Instructions
  60. #-------------------------------------------------------------------------------
  61. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  62. #
  63. #===============================================================================
  64. # ☆ HELP
  65. #-------------------------------------------------------------------------------
  66. # You really should'nt need any...
  67. #
  68. #===============================================================================
  69. module MMO_Regen
  70. #===============================================================================
  71. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  72. # ☆ General Settings
  73. #-----------------------------------------------------------------------------
  74. # The key to press for 'bonus' Regeneration
  75. Regen_Key = :R
  76. #-----------------------------------------------------------------------------
  77. # The animation displayed for 'bonus' regen
  78. Animation = 113
  79. #-----------------------------------------------------------------------------
  80. # Allow base regen to happen without key press
  81. Regen_Per_Sec = true
  82. #-----------------------------------------------------------------------------
  83. # Allow Regen in battle scene ?
  84. Allow_In_Battle = true
  85. #-----------------------------------------------------------------------------
  86. # Allow Regen on the game map ?
  87. Allow_On_Map = true
  88. #-----------------------------------------------------------------------------
  89. # Allow Enemies the stndard regen each second ? (disregard key press)
  90. Enemy_Can_Regen = true
  91. #-----------------------------------------------------------------------------
  92. # Disable Default Regen Method ? (eg. hrg, mrg, trg)
  93. Disable_Default_Regen = true
  94. #-----------------------------------------------------------------------------
  95. # Requires $D13x Key Menu HUD v1.2+
  96. # = [switch, show, x, y, icon, hue]
  97. Regen_HUD = [10 , true, 158, 2, 112, 0]
  98.  
  99. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  100. # ☆ Basic Calculation Settings
  101. #-----------------------------------------------------------------------------
  102. # The Min Value of regen each second.
  103. Base_HP = 1
  104. Base_MP = 1
  105. Base_TP = 0
  106.  
  107. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  108. # ☆ Advanced Calculation Settings
  109. #-----------------------------------------------------------------------------
  110. # This is where you would change the calculations used in determining
  111. # the total hp/mp/tp gained each regen.
  112. # if you wish to completely disable one of the regen methods,
  113. # simply put a ' # ' at the start of each line in the method.
  114. #-----------------------------------------------------------------------------
  115. # The Total Value for HP regen each second.
  116. def self.hp_regen(actor)
  117. sum = Base_HP + (actor.mhp/500) + (actor.hrg * 100)
  118. sum += (actor.mhp/250) if Keys.press?(Keys::Key[Regen_Key])
  119. actor.hp += sum.to_i
  120. end
  121. #-----------------------------------------------------------------------------
  122. # The Total Value for MP regen each second.
  123. def self.mp_regen(actor)
  124. sum = Base_MP + (actor.mmp/500) + (actor.mrg * 100)
  125. sum += (actor.mmp/250) if Keys.press?(Keys::Key[Regen_Key])
  126. actor.mp += sum.to_i
  127. end
  128. #-----------------------------------------------------------------------------
  129. # The Total Value for TP regen each second.
  130. def self.tp_regen(actor)
  131. sum = Base_TP + (actor.trg * 10)
  132. sum += 1 + (actor.trg * 10) if Keys.press?(Keys::Key[Regen_Key])
  133. actor.tp += sum
  134. end
  135. #####################
  136. # CUSTOMISATION END #
  137. end #####################
  138. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  139. # #
  140. # http://dekitarpg.wordpress.com/ #
  141. # #
  142. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  143. #===============================================================================#
  144. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  145. # YES?\.\. #
  146. # OMG, REALLY? \| #
  147. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  148. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  149. #===============================================================================#
  150. module MMO_Regen
  151. #===============================================================================
  152. #--------------------------------------------------------------------------
  153. # Set Regen Frequency
  154. #--------------------------------------------------------------------------
  155. def setup_regen
  156. @last_regen = Time.now.sec
  157. end
  158. #--------------------------------------------------------------------------
  159. # Do The MMO Style Regen
  160. #--------------------------------------------------------------------------
  161. def do_deki_regen
  162. return if @last_regen == Time.now.sec
  163. return if !Regen_Per_Sec unless Keys.press?(Keys::Key[Regen_Key])
  164. @last_regen = Time.now.sec
  165. $game_party.battle_members.each do |actor|
  166. next if actor.hp <= 0
  167. MMO_Regen.hp_regen(actor)
  168. MMO_Regen.mp_regen(actor)
  169. MMO_Regen.tp_regen(actor)
  170. if Keys.press?(Keys::Key[Regen_Key])
  171. anim = Animation
  172. $game_player.animation_id = anim
  173. $game_player.followers.each do |char|
  174. next unless char.actor != nil
  175. char.animation_id = anim
  176. end
  177. end
  178. end
  179. if SceneManager.scene_is?(Scene_Battle)
  180. $game_troop.members.each do |actor|
  181. next if actor.hp <= 0
  182. break unless Enemy_Can_Regen
  183. MMO_Regen.hp_regen(actor)
  184. MMO_Regen.mp_regen(actor)
  185. MMO_Regen.tp_regen(actor)
  186. end
  187. @status_window.refresh if @status_window
  188. end
  189. end
  190.  
  191. end
  192.  
  193. #===============================================================================
  194. class Game_Battler < Game_BattlerBase
  195. #===============================================================================
  196. #--------------------------------------------------------------------------
  197. # Alias List
  198. #--------------------------------------------------------------------------
  199. alias :regen_all_SM :regenerate_all
  200. #--------------------------------------------------------------------------
  201. # Regenerate All
  202. #--------------------------------------------------------------------------
  203. def regenerate_all
  204. return if MMO_Regen::Disable_Default_Regen
  205. return regen_all_SM
  206. end
  207.  
  208. end
  209.  
  210. #===============================================================================
  211. class Scene_Map < Scene_Base
  212. #===============================================================================
  213. #--------------------------------------------------------------------------
  214. # Included Modules
  215. #--------------------------------------------------------------------------
  216. include MMO_Regen
  217. #--------------------------------------------------------------------------
  218. # Alias List
  219. #--------------------------------------------------------------------------
  220. alias :start_deki_regen_SM :start
  221. alias :update_deki_regen_SM :update
  222. #--------------------------------------------------------------------------
  223. # Start Processing
  224. #--------------------------------------------------------------------------
  225. def start
  226. start_deki_regen_SM
  227. setup_regen if MMO_Regen::Allow_On_Map
  228. end
  229. #--------------------------------------------------------------------------
  230. # Frame Update
  231. #--------------------------------------------------------------------------
  232. def update
  233. update_deki_regen_SM
  234. do_deki_regen if MMO_Regen::Allow_On_Map
  235. end
  236.  
  237. end
  238.  
  239. #===============================================================================
  240. class Scene_Battle < Scene_Base
  241. #===============================================================================
  242. #--------------------------------------------------------------------------
  243. # Included Modules
  244. #--------------------------------------------------------------------------
  245. include MMO_Regen
  246. #--------------------------------------------------------------------------
  247. # Alias List
  248. #--------------------------------------------------------------------------
  249. alias :start_deki_regen_SB :start
  250. alias :update_deki_regen_SB :update
  251. #--------------------------------------------------------------------------
  252. # Start Processing
  253. #--------------------------------------------------------------------------
  254. def start
  255. start_deki_regen_SB
  256. setup_regen if MMO_Regen::Allow_In_Battle
  257. end
  258. #--------------------------------------------------------------------------
  259. # Frame Update
  260. #--------------------------------------------------------------------------
  261. def update
  262. update_deki_regen_SB
  263. do_deki_regen if MMO_Regen::Allow_In_Battle
  264. end
  265.  
  266. end
  267.  
  268. #==============================================================================#
  269. # http://dekitarpg.wordpress.com/ #
  270. #==============================================================================#
  271. end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement