Advertisement
Dekita

Perfect MMORPG Meditate v1.1

Aug 31st, 2012
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 17.37 KB | None | 0 0
  1. #Dekita's=======================================================================
  2. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  3. #===============================================================================
  4. #                                                                          v1.1
  5. #                        ★ Perfect MMORPG Meditate™ ★
  6. #
  7. #===============================================================================
  8. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  9. #===============================================================================
  10. #
  11. # -- Last updated: 30/08/2o12
  12. #
  13. # -- Difficulty: N/A
  14. #
  15. # -- Customisation: Better Than A Kick In The Nuts - (Low)
  16. #
  17. # -- Requires: N/A
  18. #
  19. # -- Recommended: any "action" battle system, e.g fight on the map.
  20. #
  21. # -- Compatable: RPG Maker VX Ace ONLY!
  22. #                
  23. #===============================================================================
  24. #===============================================================================
  25. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  26. #===============================================================================
  27. #===============================================================================
  28. # ☆ Script Information:
  29. #=======================
  30. # This Script was designed for action battle systems, e.g
  31. # SAS - Saphire Action System
  32. # or
  33. # XAS - Xiderwong Action System
  34. # and NOT the standard battle style e.g a transistion from the map into
  35. # battle scene. (but you can still use it)
  36. #
  37. # THIS WILL OVERRIDE REGEN METHODS, e.g hp regen buffs from increased hrg rates
  38. #
  39. # This script was made for 1 player type games.(one actor in the party at a time)
  40. #
  41. # This script is simply a replica of most mmorpg games meditate function, e.g
  42. # press [x] button and regenerate hp/mp/ect (works on the map not in battle)
  43. #
  44. # If testing this script out for the first time i recommend setting your
  45. # actors hp and mp to 100.
  46. #
  47. # This will automatically play the sound effect for your chosen animation.
  48. #===============================================================================
  49. # ☆ TERMS OF USE:
  50. #===============================================================================
  51. #
  52. # 1. You must give credit to Dekita.
  53. #
  54. # 2. This script is for NON-Commercial use ONLY!*
  55. #
  56. # 3. You CANNOT give credit to yourself for Re-posting this script
  57. #    or Posting a modified version.*
  58. #
  59. # 4. Do not Re-Distribute this script.
  60. #
  61. # 5. You are NOT allowed to convert this script to any other engine,
  62. #    E.G converting it from RGSS3 into RGSS2.*
  63. #
  64. # 6. ENJOY!
  65. #
  66. #-------------------------------------------------------------------------------
  67. # * = Unless permissions are given by Dekita. < e-mail DekitaRPG@gmail.com
  68. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  69. #===============================================================================
  70.  
  71. #===============================================================================
  72. # ☆ History:
  73. #============
  74. # D - M - Y
  75. # 30/08/2o12 - Fixed a silly fault.(stopped regen on the map and in standard battles)
  76. #            - Finished.(v1.0)
  77. # 29/08/2o12 - Added a lil bit of customisation,
  78. #            - Added TP Regen/Gain,
  79. #            - Improved regeneration formula,
  80. # 28/08/2o12 - Fixed Meditate wait,
  81. # 25/08/2o12 - started,
  82. #===============================================================================
  83.  
  84. #===============================================================================
  85. # ☆ Credit and Thanks to :
  86. #==========================
  87. # N/A
  88. #===============================================================================
  89.  
  90. #===============================================================================
  91. # ☆ Foresight Into The Future:
  92. #==============================
  93. # Maybe a meditate buff for standard battles ?
  94. #-------------------------------------------------------------------------------
  95. # If you have any ideas e-mail me at DekitaRPG@gmail.com
  96. #===============================================================================
  97.  
  98. #===============================================================================
  99. # ☆ Known Bugs:
  100. #=================
  101. # if using a non action battle system your regen skills wont work :) as i disable
  102. # the regen function .
  103. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  104. # If a new bug is found please e-mail me at DekitaRPG@gmail.com
  105. #===============================================================================
  106.  
  107. #===============================================================================
  108. # ☆ INSTRUCTIONS:
  109. #=================
  110. # Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  111. #===============================================================================
  112.  
  113. #===============================================================================
  114. # ☆ Import:
  115. #===========
  116. $imported = {} if $imported.nil?
  117. $imported["DPB-PMEDI"] = true
  118. #
  119. #===============================================================================
  120. module DPB
  121.   module PMEDITATE
  122. #===============================================================================#
  123. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  124. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  125. #                                                                               #
  126. #                        ★ Perfect MMORPG Meditate™ ★
  127. #
  128. #                              - CUSTOMISATION -                                #
  129. #                                                                               #                                                                               #
  130. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  131. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  132. #===============================================================================#
  133. #                           - DekitaRPG@gmail.com -                             #
  134. #===============================================================================#
  135. # make this false if you dont want to draw the gauges on screen.
  136. # you can also go to line 300-ish if using a real hud script and delete everything
  137. # below it.(if you dont plan on ever using the gauges).
  138.  
  139. SHOW_GAUGES_ON_MAP_SCREEN = false
  140. #
  141. # NOTE:
  142. # Meditate regeneration has a formula for how much hp/mp you regain
  143. # the formula is:
  144. # HPgain (the base hp gain defined below)
  145. # + (actors hrg/mrg/trg * 100)(1% hrg/mrg/trg = 1 extra hp/mp/tp gained)
  146. # = total recovery value,
  147. # therefor more hp/mp/tp regen the more you gain per increase.
  148. #
  149. #
  150. #
  151. # Meditate_wait_time time also has a formula
  152. # the formula is:
  153. # Meditate_wait_time / Actors recovery rate.
  154. # therefor more rec value = faster regen , less = slower regen time
  155.    
  156.     #the keyboard key for meditating.
  157.     MEDITATEKEY = :L # :L = Q button on the keyboard.
  158.     #other keys:
  159.     #   :Button    Default Keyboard Button
  160.     #      :L        Q
  161.     #      :R        W
  162.     #      :X        A
  163.     #      :Y        S
  164.     #      :Z        D
  165.  
  166.     #Base wait time for meditate regeneration.
  167.     Meditate_wait_time = 20 #(frames)
  168.    
  169.     #animation_id for meditate
  170.     MEDIANI = 38#112 # 38
  171.  
  172.     #TURN_OFF_HP to not gain hp during meditate.
  173.     GAIN_HP = true
  174.     #BASE HP gain while meditating(in between wait time's (defined above))
  175.     HPgain = 1
  176.    
  177.     #TURN_OFF_MP to not gain hp during meditate.
  178.     GAIN_MP = true
  179.     #BASE MP gain while meditating(in between wait time's (defined above))
  180.     MPgain = 1
  181.    
  182.     #TURN_OFF_TP to not gain hp during meditate.
  183.     GAIN_TP = false
  184.     #BASE TP gain while meditating(in between wait time's (defined above))
  185.     TPgain = 1
  186.      
  187.   end #Pmeditate
  188. end # DPB
  189. #===============================================================================#
  190. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  191. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  192. #                                                                               #
  193. #                        ★ Perfect MMORPG Meditate™ ★
  194. #
  195. #                               - SCRIPT BEGIN -                                #
  196. #                                                                               #                                                                               #
  197. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  198. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  199. #===============================================================================#
  200. #                           - DekitaRPG@gmail.com -                             #
  201. #===============================================================================#
  202. # Keyboard four de map ? no
  203. class Scene_Map < Scene_Base
  204.   alias dpbzmediscene update_scene
  205.     def update_scene
  206.       dpbzmediscene
  207. # Define call meditate from map  
  208.      update_call_meditate unless scene_changing? or $game_player.moving?    
  209. end # update scene
  210.  
  211. # Define call meditate from map  
  212. def update_call_meditate
  213.    if Input.press?(DPB::PMEDITATE::MEDITATEKEY)
  214.        call_meditate
  215. end
  216. end
  217. # Define call meditate from map  
  218.   def call_meditate
  219.     $game_player.animation_id = DPB::PMEDITATE::MEDIANI
  220.     dpbzwait((DPB::PMEDITATE::Meditate_wait_time / $game_party.members[0].rec).to_i)
  221.   if DPB::PMEDITATE::GAIN_HP  
  222.     hpplusvaltote
  223.   end
  224.   if DPB::PMEDITATE::GAIN_MP
  225.     mpplusvaltote
  226.   end
  227.   if DPB::PMEDITATE::GAIN_TP
  228.     tpplusvaltote
  229.   end
  230.     ##
  231. end
  232.   #--------------------------------------------------------------------------
  233.   # * dpbzwait
  234.   #--------------------------------------------------------------------------
  235.   def dpbzwait(duration)
  236.     fade_loop(duration) {|v| Graphics.frame_count = v }
  237.   end
  238.  
  239. # formula for hp regen during meditate
  240. def hpplusvaltote
  241.     hpval1 = DPB::PMEDITATE::HPgain
  242.     hpval2 = ($game_party.members[0].hrg * 100).to_i
  243.     hpvaltote = (hpval1 + hpval2)
  244.     $game_party.members[0].hp += hpvaltote
  245. end
  246.  
  247. # formula for mp regen during meditate  
  248.  def mpplusvaltote
  249.     mpval1 = DPB::PMEDITATE::MPgain
  250.     mpval2 = ($game_party.members[0].mrg * 100).to_i
  251.     mpvaltote = (mpval1 + mpval2)
  252.     $game_party.members[0].mp += mpvaltote
  253. end
  254.  
  255. # formula for mp regen during meditate  
  256.  def tpplusvaltote
  257.     tpval1 = DPB::PMEDITATE::TPgain
  258.     tpval2 = ($game_party.members[0].trg * 100).to_i
  259.     tpvaltote = (tpval1 + tpval2)
  260.     $game_party.members[0].tp += tpvaltote
  261. end
  262.  
  263. end# scenemap
  264.  
  265. class Game_Player < Game_Character    
  266.   #--------------------------------------------------------------------------
  267.   # * Determine if Movement is Possible
  268.   #--------------------------------------------------------------------------
  269.   alias dpbzmedimove? movable?
  270.   def movable?
  271.     return false if Input.press?(DPB::PMEDITATE::MEDITATEKEY)
  272.     dpbzmedimove?
  273.   end
  274. end
  275. #==============================================================================
  276. # Game_Battler
  277. #
  278. # Re-write #
  279. class Game_Battler < Game_BattlerBase    
  280.   def regenerate_all
  281.   end # N/A
  282. end #class Game_Battler < Game_BattlerBase  
  283. #===============================================================================#
  284. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  285. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  286. #                                                                               #
  287. #                        ★ Perfect MMORPG Meditate™ ★
  288. #
  289. #                                - SCRIPT END -                                 #
  290. #                                                                               #                                                                               #
  291. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  292. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  293. #===============================================================================#
  294. #                           - DekitaRPG@gmail.com -                             #
  295. #===============================================================================#
  296. #
  297. #
  298. # YOU CAN DELETE EVERYTHING BELOW THIS IF YOU DONT WANT TO SHOW THE HP/MP AND TP
  299. # GAUGES. I RECOMMEND USING A BETTER HUD SO YOU CAN "APPRECIATE" THE MEDITATE
  300. # FUNCTION (I find it "pleasing" to see my hp ect rise in the gauges lol)
  301. #
  302. #
  303. module DPB
  304.   module PHUD    
  305. HP_FONT_SIZE = 15
  306. MP_FONT_SIZE = 15
  307. TP_FONT_SIZE = 15
  308. HUDG_Z = 99 # the z for the hud graphic (from graphics folder)
  309. FACE_Z = 98 # the z value for the face image  
  310.   HP_Z = 98 # the z value for hp gauge
  311.   MP_Z = 98 # the z value for mp gauge
  312.   TP_Z = 98 # the z value for tp gauge    
  313.   end#phud
  314. end#DPB
  315.  
  316. if DPB::PMEDITATE::SHOW_GAUGES_ON_MAP_SCREEN
  317. class HP_HudThing < Window_Base
  318. #----------------------------------------------------
  319. # * Object Initialization
  320. #----------------------------------------------------
  321.   def initialize
  322.         super(-12, -12, Graphics.width, Graphics.height + 10)
  323.         create_contents
  324.         self.opacity = 0
  325.         @actor = $game_party.members[0]
  326.         refresh
  327.   end
  328.   def dpbzhp_gauge_color1;   text_color(28);  end;    # HP gauge 1
  329.   def dpbzhp_gauge_color2;   text_color(29);  end;    # HP gauge 2
  330.   def dpbzmp_gauge_color1;   text_color(22);  end;    # MP gauge 1
  331.   def dpbzmp_gauge_color2;   text_color(23);  end;    # MP gauge 2
  332.   def dpbztp_gauge_color1;   text_color(10);  end;    # TP gauge 1
  333.   def dpbztp_gauge_color2;   text_color(2);  end;     # TP gauge 2
  334. #----------------------------------------------------
  335. # * Refresh
  336. #----------------------------------------------------
  337.   def refresh
  338.         self.contents.clear
  339.         contents.clear
  340.         draw_window_content
  341.         end
  342.   def draw_window_content
  343.      dpbzhp
  344.      dpbzmp
  345.      dpbztp
  346.   end
  347.   def dpbzhp
  348.     self.z = DPB::PHUD::HP_Z
  349.     contents.font.size = DPB::PHUD::HP_FONT_SIZE
  350.     @hp = @actor.hp
  351.     rate = [@actor.hp_rate, 1.0].min
  352.     draw_dpbzhp_gauge(5, -5, 112, rate, dpbzhp_gauge_color1, dpbzhp_gauge_color2)
  353.     change_color(normal_color)
  354.     draw_current_and_max_values(5, 0, 112, @actor.hp, @actor.mhp,
  355.     hp_color(@actor), normal_color)
  356.   end
  357.   def draw_dpbzhp_gauge(dx, dy, dw, rate, color1, color2)
  358.     dw -= 2
  359.     fill_w = [(dw * rate).to_i, dw].min
  360.     gauge_h = 14
  361.     gauge_y = dy + line_height - 2 - gauge_h
  362.     contents.gradient_fill_rect(dx, gauge_y, fill_w, gauge_h, color1, color2)
  363.   end  
  364.   def dpbzmp
  365.     self.z = DPB::PHUD::MP_Z  
  366.     contents.font.size = DPB::PHUD::MP_FONT_SIZE
  367.     @mp = @actor.mp
  368.     rate = [@actor.mp_rate, 1.0].min
  369.     draw_dpbzmp_gauge(5, 15, 112, rate, dpbzmp_gauge_color1, dpbzmp_gauge_color2)
  370.     change_color(normal_color)
  371.     draw_current_and_max_values(5, 20, 112, @actor.mp, @actor.mmp,
  372.     mp_color(@actor), normal_color)
  373.   end
  374.   def draw_dpbzmp_gauge(dx, dy, dw, rate, color1, color2)
  375.     dw -= 2
  376.     fill_w = [(dw * rate).to_i, dw].min
  377.     gauge_h = 14
  378.     gauge_y = dy + line_height - 2 - gauge_h
  379.     contents.gradient_fill_rect(dx, gauge_y, fill_w, gauge_h, color1, color2)
  380.   end  
  381.   def dpbztp
  382.     self.z = DPB::PHUD::TP_Z
  383.     contents.font.size = DPB::PHUD::TP_FONT_SIZE
  384.     @tp = @actor.tp
  385.     rate = [@actor.tp_rate, 1.0].min
  386.     draw_dpbztp_gauge(5, 35, 112, rate, dpbztp_gauge_color1, dpbztp_gauge_color2)
  387.     draw_text(62, 40, 112, line_height, @actor.tp)
  388.     end
  389.   def draw_dpbztp_gauge(dx, dy, dw, rate, color1, color2)
  390.     dw -= 2
  391.     fill_w = [(dw * rate).to_i, dw].min
  392.     gauge_h = 14
  393.     gauge_y = dy + line_height - 2 - gauge_h
  394.     contents.gradient_fill_rect(dx, gauge_y, fill_w, gauge_h, color1, color2)
  395.   end  
  396.   def update
  397.         super
  398.         return if !self.visible
  399.         if @level != @actor.level or @hp != @actor.hp or @mp != @actor.mp or
  400.           @tp != @actor.tp or @exp != @actor.exp or @gold != $game_party.gold
  401.           refresh
  402.         end
  403.       end
  404. end
  405. class Spriteset_Map
  406.   alias dpbzhud_initialize initialize
  407.   alias dpbzhud_dispose dispose
  408.   alias dpbzhud_update update
  409.   def initialize
  410.     @trash = []
  411.     @winhud = HP_HudThing.new    
  412.      dpbzhud_initialize
  413.   end
  414.   def dispose
  415.     dpbzhud_dispose
  416.     @winhud.dispose
  417.   end
  418.   def update
  419.     dpbzhud_update
  420.     @winhud.update
  421.       end
  422.     end#spriteset map
  423.   end
  424.   ############################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement