Dekita

Perfect MMORPG Meditate v1.3

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