Advertisement
Dekita

Perfect MMORPG Meditate v1.3

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