Dekita

Perfect MMORPG Meditate v1.2

Sep 4th, 2012
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.61 KB | None | 0 0
  1. #Dekita's=======================================================================
  2. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  3. #===============================================================================
  4. # v1.2
  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 [email protected]
  68. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  69. #===============================================================================
  70.  
  71. #===============================================================================
  72. # ☆ History:
  73. #============
  74. # D - M - Y
  75. # 02/09/2o12 - Added switches.
  76. # 30/08/2o12 - Fixed a silly fault.(stopped regen on the map and in standard battles)
  77. # - Finished.(v1.0)
  78. # 29/08/2o12 - Added a lil bit of customisation,
  79. # - Added TP Regen/Gain,
  80. # - Improved regeneration formula,
  81. # 28/08/2o12 - Fixed Meditate wait,
  82. # 25/08/2o12 - started,
  83. #===============================================================================
  84.  
  85. #===============================================================================
  86. # ☆ Credit and Thanks to :
  87. #==========================
  88. # N/A
  89. #===============================================================================
  90.  
  91. #===============================================================================
  92. # ☆ Foresight Into The Future:
  93. #==============================
  94. # Maybe a meditate buff for standard battles ?
  95. #-------------------------------------------------------------------------------
  96. # If you have any ideas e-mail me at [email protected]
  97. #===============================================================================
  98.  
  99. #===============================================================================
  100. # ☆ Known Bugs:
  101. #=================
  102. # if using a non action battle system your regen skills wont work :) as i disable
  103. # the regen function .
  104. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  105. # If a new bug is found please e-mail me at [email protected]
  106. #===============================================================================
  107.  
  108. #===============================================================================
  109. # ☆ INSTRUCTIONS:
  110. #=================
  111. # Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  112. #===============================================================================
  113.  
  114. #===============================================================================
  115. # ☆ Import:
  116. #===========
  117. $imported = {} if $imported.nil?
  118. $imported["DPB-PMEDI"] = true
  119. #
  120. #===============================================================================
  121. module DPB
  122. module PMEDITATE
  123. #===============================================================================#
  124. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  125. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  126. # #
  127. # ★ Perfect MMORPG Meditate™ ★
  128. #
  129. # - CUSTOMISATION - #
  130. # # #
  131. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  132. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  133. #===============================================================================#
  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. # Switch that enables meditate on the map.
  167. ENABLE_MEDITATE_SWITCH = 0 # Leave "0" if you wish to always use mediitate.
  168.  
  169. #Base wait time for meditate regeneration.
  170. Meditate_wait_time = 20 #(frames)
  171.  
  172. #animation_id for meditate
  173. MEDIANI = 112 # 38
  174.  
  175. #TURN_OFF_HP to not gain hp during meditate.
  176. GAIN_HP = true
  177. #BASE HP gain while meditating(in between wait time's (defined above))
  178. HPgain = 1
  179. # Switch that enables meditate on the map.
  180. ENABLE_HPgain_SWITCH = 0 # Leave "0" if you wish to always use mediitate.
  181.  
  182.  
  183. #TURN_OFF_MP to not gain hp during meditate.
  184. GAIN_MP = true
  185. #BASE MP gain while meditating(in between wait time's (defined above))
  186. MPgain = 1
  187. # Switch that enables meditate on the map.
  188. ENABLE_MPgain_SWITCH = 0 # Leave "0" if you wish to always use mediitate.
  189.  
  190.  
  191. #TURN_OFF_TP to not gain hp during meditate.
  192. GAIN_TP = true
  193. #BASE TP gain while meditating(in between wait time's (defined above))
  194. TPgain = 1
  195. # Switch that enables meditate on the map.
  196. ENABLE_TPgain_SWITCH = 0 # Leave "0" if you wish to always use mediitate.
  197.  
  198.  
  199. end #Pmeditate
  200. end # DPB
  201. #===============================================================================#
  202. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  203. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  204. # #
  205. # ★ Perfect MMORPG Meditate™ ★
  206. #
  207. # - SCRIPT BEGIN - #
  208. # # #
  209. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  210. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  211. #===============================================================================#
  212. #===============================================================================#
  213. #==============================================================================
  214. # ■ Switch
  215. #==============================================================================
  216.  
  217. module Switch
  218.  
  219. #--------------------------------------------------------------------------
  220. # self. use meditate
  221. #--------------------------------------------------------------------------
  222. def self.use_meditate
  223. return true if DPB::PMEDITATE::ENABLE_MEDITATE_SWITCH <= 0
  224. return $game_switches[DPB::PMEDITATE::ENABLE_MEDITATE_SWITCH]
  225. end
  226. #--------------------------------------------------------------------------
  227. # self. use meditate
  228. #--------------------------------------------------------------------------
  229. def self.meditate_hpgain
  230. return true if DPB::PMEDITATE::ENABLE_HPgain_SWITCH <= 0
  231. return $game_switches[DPB::PMEDITATE::ENABLE_HPgain_SWITCH]
  232. end
  233. #--------------------------------------------------------------------------
  234. # self. use meditate
  235. #--------------------------------------------------------------------------
  236. def self.meditate_mpgain
  237. return true if DPB::PMEDITATE::ENABLE_MPgain_SWITCH <= 0
  238. return $game_switches[DPB::PMEDITATE::ENABLE_MPgain_SWITCH]
  239. end
  240. #--------------------------------------------------------------------------
  241. # self. use meditate
  242. #--------------------------------------------------------------------------
  243. def self.meditate_tpgain
  244. return true if DPB::PMEDITATE::ENABLE_TPgain_SWITCH <= 0
  245. return $game_switches[DPB::PMEDITATE::ENABLE_TPgain_SWITCH]
  246. end
  247.  
  248.  
  249. end # Switch
  250. #####
  251. # Keyboard four de map ? no
  252. class Scene_Map < Scene_Base
  253. alias dpbzmediscene update_scene
  254. def update_scene
  255. dpbzmediscene
  256. # Define call meditate from map
  257. update_call_meditate unless scene_changing? or $game_player.moving?
  258. end # update scene
  259.  
  260. # Define call meditate from map
  261. def update_call_meditate
  262. if Input.press?(DPB::PMEDITATE::MEDITATEKEY) && Switch.use_meditate
  263. call_meditate
  264. end
  265. end
  266. # Define call meditate from map
  267. def call_meditate
  268. $game_player.animation_id = DPB::PMEDITATE::MEDIANI
  269. dpbzwait((DPB::PMEDITATE::Meditate_wait_time / $game_party.members[0].rec).to_i)
  270. if DPB::PMEDITATE::GAIN_HP && Switch.meditate_hpgain
  271. hpplusvaltote
  272. end
  273. if DPB::PMEDITATE::GAIN_MP && Switch.meditate_mpgain
  274. mpplusvaltote
  275. end
  276. if DPB::PMEDITATE::GAIN_TP && Switch.meditate_tpgain
  277. tpplusvaltote
  278. end
  279. ##
  280. end
  281. #--------------------------------------------------------------------------
  282. # * dpbzwait
  283. #--------------------------------------------------------------------------
  284. def dpbzwait(duration)
  285. fade_loop(duration) {|v| Graphics.frame_count = v }
  286. end
  287.  
  288. # formula for hp regen during meditate
  289. def hpplusvaltote
  290. hpval1 = DPB::PMEDITATE::HPgain
  291. hpval2 = ($game_party.members[0].hrg * 100).to_i
  292. hpvaltote = (hpval1 + hpval2)
  293. $game_party.members[0].hp += hpvaltote
  294. end
  295.  
  296. # formula for mp regen during meditate
  297. def mpplusvaltote
  298. mpval1 = DPB::PMEDITATE::MPgain
  299. mpval2 = ($game_party.members[0].mrg * 100).to_i
  300. mpvaltote = (mpval1 + mpval2)
  301. $game_party.members[0].mp += mpvaltote
  302. end
  303.  
  304. # formula for mp regen during meditate
  305. def tpplusvaltote
  306. tpval1 = DPB::PMEDITATE::TPgain
  307. tpval2 = ($game_party.members[0].trg * 100).to_i
  308. tpvaltote = (tpval1 + tpval2)
  309. $game_party.members[0].tp += tpvaltote
  310. end
  311.  
  312. end# scenemap
  313.  
  314. class Game_Player < Game_Character
  315. #--------------------------------------------------------------------------
  316. # * Determine if Movement is Possible
  317. #--------------------------------------------------------------------------
  318. alias dpbzmedimove? movable?
  319. def movable?
  320. return false if Input.press?(DPB::PMEDITATE::MEDITATEKEY)
  321. dpbzmedimove?
  322. end
  323. end
  324. #==============================================================================
  325. # Game_Battler
  326. #
  327. # Re-write #
  328. class Game_Battler < Game_BattlerBase
  329. def regenerate_all
  330. end # N/A
  331. end #class Game_Battler < Game_BattlerBase
  332. #
  333. #===============================================================================#
  334. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  335. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  336. # #
  337. # ★ Perfect MMORPG Meditate™ ★
  338. #
  339. # - SCRIPT END - #
  340. # # #
  341. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  342. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  343. #===============================================================================#
  344. #===============================================================================#
  345. #
  346. #
  347. # YOU CAN DELETE EVERYTHING BELOW THIS IF YOU DONT WANT TO SHOW THE HP/MP AND TP
  348. # GAUGES. I RECOMMEND USING A BETTER HUD SO YOU CAN "APPRECIATE" THE MEDITATE
  349. # FUNCTION (I find it "pleasing" to see my hp ect rise in the gauges lol)
  350. #
  351. #
  352. module DPB
  353. module PHUD
  354. HP_FONT_SIZE = 15
  355. MP_FONT_SIZE = 15
  356. TP_FONT_SIZE = 15
  357. HUDG_Z = 99 # the z for the hud graphic (from graphics folder)
  358. FACE_Z = 98 # the z value for the face image
  359. HP_Z = 98 # the z value for hp gauge
  360. MP_Z = 98 # the z value for mp gauge
  361. TP_Z = 98 # the z value for tp gauge
  362. end#phud
  363. end#DPB
  364.  
  365. if DPB::PMEDITATE::SHOW_GAUGES_ON_MAP_SCREEN
  366. class HP_HudThing < Window_Base
  367. #----------------------------------------------------
  368. # * Object Initialization
  369. #----------------------------------------------------
  370. def initialize
  371. super(-12, -12, Graphics.width, Graphics.height + 10)
  372. create_contents
  373. self.opacity = 0
  374. @actor = $game_party.members[0]
  375. refresh
  376. end
  377. def dpbzhp_gauge_color1; text_color(28); end; # HP gauge 1
  378. def dpbzhp_gauge_color2; text_color(29); end; # HP gauge 2
  379. def dpbzmp_gauge_color1; text_color(22); end; # MP gauge 1
  380. def dpbzmp_gauge_color2; text_color(23); end; # MP gauge 2
  381. def dpbztp_gauge_color1; text_color(10); end; # TP gauge 1
  382. def dpbztp_gauge_color2; text_color(2); end; # TP gauge 2
  383. #----------------------------------------------------
  384. # * Refresh
  385. #----------------------------------------------------
  386. def refresh
  387. self.contents.clear
  388. contents.clear
  389. draw_window_content
  390. end
  391. def draw_window_content
  392. dpbzhp
  393. dpbzmp
  394. dpbztp
  395. end
  396. def dpbzhp
  397. self.z = DPB::PHUD::HP_Z
  398. contents.font.size = DPB::PHUD::HP_FONT_SIZE
  399. @hp = @actor.hp
  400. rate = [@actor.hp_rate, 1.0].min
  401. draw_dpbzhp_gauge(5, -5, 112, rate, dpbzhp_gauge_color1, dpbzhp_gauge_color2)
  402. change_color(normal_color)
  403. draw_current_and_max_values(5, 0, 112, @actor.hp, @actor.mhp,
  404. hp_color(@actor), normal_color)
  405. end
  406. def draw_dpbzhp_gauge(dx, dy, dw, rate, color1, color2)
  407. dw -= 2
  408. fill_w = [(dw * rate).to_i, dw].min
  409. gauge_h = 14
  410. gauge_y = dy + line_height - 2 - gauge_h
  411. contents.gradient_fill_rect(dx, gauge_y, fill_w, gauge_h, color1, color2)
  412. end
  413. def dpbzmp
  414. self.z = DPB::PHUD::MP_Z
  415. contents.font.size = DPB::PHUD::MP_FONT_SIZE
  416. @mp = @actor.mp
  417. rate = [@actor.mp_rate, 1.0].min
  418. draw_dpbzmp_gauge(5, 15, 112, rate, dpbzmp_gauge_color1, dpbzmp_gauge_color2)
  419. change_color(normal_color)
  420. draw_current_and_max_values(5, 20, 112, @actor.mp, @actor.mmp,
  421. mp_color(@actor), normal_color)
  422. end
  423. def draw_dpbzmp_gauge(dx, dy, dw, rate, color1, color2)
  424. dw -= 2
  425. fill_w = [(dw * rate).to_i, dw].min
  426. gauge_h = 14
  427. gauge_y = dy + line_height - 2 - gauge_h
  428. contents.gradient_fill_rect(dx, gauge_y, fill_w, gauge_h, color1, color2)
  429. end
  430. def dpbztp
  431. self.z = DPB::PHUD::TP_Z
  432. contents.font.size = DPB::PHUD::TP_FONT_SIZE
  433. @tp = @actor.tp
  434. rate = [@actor.tp_rate, 1.0].min
  435. draw_dpbztp_gauge(5, 35, 112, rate, dpbztp_gauge_color1, dpbztp_gauge_color2)
  436. draw_text(62, 40, 112, line_height, @actor.tp)
  437. end
  438. def draw_dpbztp_gauge(dx, dy, dw, rate, color1, color2)
  439. dw -= 2
  440. fill_w = [(dw * rate).to_i, dw].min
  441. gauge_h = 14
  442. gauge_y = dy + line_height - 2 - gauge_h
  443. contents.gradient_fill_rect(dx, gauge_y, fill_w, gauge_h, color1, color2)
  444. end
  445. def update
  446. super
  447. return if !self.visible
  448. if @level != @actor.level or @hp != @actor.hp or @mp != @actor.mp or
  449. @tp != @actor.tp or @exp != @actor.exp or @gold != $game_party.gold
  450. refresh
  451. end
  452. end
  453. end
  454. class Spriteset_Map
  455. alias dpbzhud_initialize initialize
  456. alias dpbzhud_dispose dispose
  457. alias dpbzhud_update update
  458. def initialize
  459. @trash = []
  460. @winhud = HP_HudThing.new
  461. dpbzhud_initialize
  462. end
  463. def dispose
  464. dpbzhud_dispose
  465. @winhud.dispose
  466. end
  467. def update
  468. dpbzhud_update
  469. @winhud.update
  470. end
  471. end#spriteset map
  472. end
  473. #
  474. #end # switch
  475.  
  476.  
  477. ############################################################################
Advertisement
Add Comment
Please, Sign In to add comment