Advertisement
Dekita

$D13x MMO Regen v1.0

Apr 8th, 2013
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.72 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.0
  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. # o4/o4/2o13 - Started, Finished,
  21. #
  22. #===============================================================================
  23. # ☆ Introduction
  24. #-------------------------------------------------------------------------------
  25. # This script adds a MMO style regeneration method into the game.
  26. # Each second you (all battle members) will regenerate hp/mp/tp according
  27. # to the formulas within this script. Can also enable for enemies.
  28. #
  29. # you can have extra regen bonuses for holding down a key
  30. # and disable all regen unless a key is being pressed.
  31. #
  32. # The default formulas will allow for more hp to be regenerated based on
  33. # the actors max hp, but you can make the formula check whatever actor stats
  34. # you want, for example, you could easily base the regen method against
  35. # an actors equipment or skills... ( << needs coding know-how )
  36. #
  37. # This script requires my $D13x Core, therefor most keyboard keys are available
  38. # as the "Regen" key. (By default its the 'R' Key)
  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. # ☆ HELP
  64. #-------------------------------------------------------------------------------
  65. # You really should'nt need any...
  66. #
  67. #===============================================================================
  68. module MMO_Regen
  69. #===============================================================================
  70. $D13x[:CORE]?Key=Keys::Key: Key={:Key=>'KEY'}# << KEEP
  71. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  72. # ☆ General Settings
  73. #-----------------------------------------------------------------------------
  74. # The key to press for 'bonus' Regeneration
  75. Regen_Key = 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. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  93. # ☆ Basic Calculation Settings
  94. #-----------------------------------------------------------------------------
  95. # The Min Value of regen each second.
  96. Base_HP = 1
  97. Base_MP = 1
  98. Base_TP = 0
  99.  
  100. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  101. # ☆ Advanced Calculation Settings
  102. #-----------------------------------------------------------------------------
  103. # This is where you would change the calculations used in determining
  104. # the total hp/mp/tp gained each regen.
  105. # if you wish to completely disable one of the regen methods,
  106. # simply make ' return sum ' say ' return 0 ' ( 0 = ZERO )
  107. #-----------------------------------------------------------------------------
  108. # The Total Value for HP regen each second.
  109. def self.hp_regen(actor)
  110. sum = Base_HP + (actor.mhp/500)
  111. sum += (actor.mhp/250) if Keys.press?(Regen_Key)
  112. actor.hp += sum
  113. end
  114. #-----------------------------------------------------------------------------
  115. # The Total Value for MP regen each second.
  116. def self.mp_regen(actor)
  117. sum = Base_MP + (actor.mmp/500)
  118. sum += (actor.mmp/250) if Keys.press?(Regen_Key)
  119. actor.mp += sum
  120. end
  121. #-----------------------------------------------------------------------------
  122. # The Total Value for TP regen each second.
  123. def self.tp_regen(actor)
  124. sum = Base_TP
  125. sum += 1 if Keys.press?(Regen_Key)
  126. actor.tp += sum
  127. end
  128. #####################
  129. # CUSTOMISATION END #
  130. end #####################
  131. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  132. # #
  133. # http://dekitarpg.wordpress.com/ #
  134. # #
  135. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  136. #===============================================================================#
  137. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  138. # YES?\.\. #
  139. # OMG, REALLY? \| #
  140. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  141. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  142. #===============================================================================#
  143. module MMO_Regen
  144. #===============================================================================
  145. #--------------------------------------------------------------------------
  146. # Set Regen Frequency
  147. #--------------------------------------------------------------------------
  148. def setup_regen
  149. @last_regen = Time.now.sec
  150. end
  151. #--------------------------------------------------------------------------
  152. # Do The MMO Style Regen
  153. #--------------------------------------------------------------------------
  154. def do_deki_regen
  155. return if @last_regen == Time.now.sec
  156. return if !Regen_Per_Sec unless Keys.press?(Regen_Key)
  157. @last_regen = Time.now.sec
  158. $game_party.battle_members.each do |actor|
  159. next if actor.hp <= 0
  160. MMO_Regen.hp_regen(actor)
  161. MMO_Regen.mp_regen(actor)
  162. MMO_Regen.tp_regen(actor)
  163. if Keys.press?(Regen_Key)
  164. anim = Animation
  165. $game_player.animation_id = anim
  166. $game_player.followers.each do |char|
  167. next unless char.actor != nil
  168. char.animation_id = anim
  169. end
  170. end
  171. end
  172. if SceneManager.scene_is?(Scene_Battle)
  173. $game_troop.members.each do |actor|
  174. next if actor.hp <= 0
  175. break unless Enemy_Can_Regen
  176. MMO_Regen.hp_regen(actor)
  177. MMO_Regen.mp_regen(actor)
  178. MMO_Regen.tp_regen(actor)
  179. end
  180. @status_window.refresh
  181. end
  182. end
  183.  
  184. end
  185.  
  186. #===============================================================================
  187. class Scene_Map < Scene_Base
  188. #===============================================================================
  189. #--------------------------------------------------------------------------
  190. # Included Modules
  191. #--------------------------------------------------------------------------
  192. include MMO_Regen
  193. #--------------------------------------------------------------------------
  194. # Alias List
  195. #--------------------------------------------------------------------------
  196. alias :start_deki_regen_SM :start
  197. alias :update_deki_regen_SM :update
  198. #--------------------------------------------------------------------------
  199. # Start Processing
  200. #--------------------------------------------------------------------------
  201. def start
  202. start_deki_regen_SM
  203. setup_regen if MMO_Regen::Allow_On_Map
  204. end
  205. #--------------------------------------------------------------------------
  206. # Frame Update
  207. #--------------------------------------------------------------------------
  208. def update
  209. update_deki_regen_SM
  210. do_deki_regen if MMO_Regen::Allow_On_Map
  211. end
  212.  
  213. end
  214.  
  215. #===============================================================================
  216. class Scene_Battle < Scene_Base
  217. #===============================================================================
  218. #--------------------------------------------------------------------------
  219. # Included Modules
  220. #--------------------------------------------------------------------------
  221. include MMO_Regen
  222. #--------------------------------------------------------------------------
  223. # Alias List
  224. #--------------------------------------------------------------------------
  225. alias :start_deki_regen_SB :start
  226. alias :update_deki_regen_SB :update
  227. #--------------------------------------------------------------------------
  228. # Start Processing
  229. #--------------------------------------------------------------------------
  230. def start
  231. start_deki_regen_SB
  232. setup_regen if MMO_Regen::Allow_In_Battle
  233. end
  234. #--------------------------------------------------------------------------
  235. # Frame Update
  236. #--------------------------------------------------------------------------
  237. def update
  238. update_deki_regen_SB
  239. do_deki_regen if MMO_Regen::Allow_In_Battle
  240. end
  241.  
  242. end
  243.  
  244. #==============================================================================#
  245. # http://dekitarpg.wordpress.com/ #
  246. #==============================================================================#
  247. end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement