Advertisement
Dekita

Perfect MMORPG Meditate v1.2

Sep 4th, 2012
355
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 DekitaRPG@gmail.com
  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 DekitaRPG@gmail.com
  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 DekitaRPG@gmail.com
  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. # - DekitaRPG@gmail.com - #
  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 = 20 #(frames)
  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. # - DekitaRPG@gmail.com - #
  214. #===============================================================================#
  215. #==============================================================================
  216. # ■ Switch
  217. #==============================================================================
  218.  
  219. module Switch
  220.  
  221. #--------------------------------------------------------------------------
  222. # self. use meditate
  223. #--------------------------------------------------------------------------
  224. def self.use_meditate
  225. return true if DPB::PMEDITATE::ENABLE_MEDITATE_SWITCH <= 0
  226. return $game_switches[DPB::PMEDITATE::ENABLE_MEDITATE_SWITCH]
  227. end
  228. #--------------------------------------------------------------------------
  229. # self. use meditate
  230. #--------------------------------------------------------------------------
  231. def self.meditate_hpgain
  232. return true if DPB::PMEDITATE::ENABLE_HPgain_SWITCH <= 0
  233. return $game_switches[DPB::PMEDITATE::ENABLE_HPgain_SWITCH]
  234. end
  235. #--------------------------------------------------------------------------
  236. # self. use meditate
  237. #--------------------------------------------------------------------------
  238. def self.meditate_mpgain
  239. return true if DPB::PMEDITATE::ENABLE_MPgain_SWITCH <= 0
  240. return $game_switches[DPB::PMEDITATE::ENABLE_MPgain_SWITCH]
  241. end
  242. #--------------------------------------------------------------------------
  243. # self. use meditate
  244. #--------------------------------------------------------------------------
  245. def self.meditate_tpgain
  246. return true if DPB::PMEDITATE::ENABLE_TPgain_SWITCH <= 0
  247. return $game_switches[DPB::PMEDITATE::ENABLE_TPgain_SWITCH]
  248. end
  249.  
  250.  
  251. end # Switch
  252. #####
  253. # Keyboard four de map ? no
  254. class Scene_Map < Scene_Base
  255. alias dpbzmediscene update_scene
  256. def update_scene
  257. dpbzmediscene
  258. # Define call meditate from map
  259. update_call_meditate unless scene_changing? or $game_player.moving?
  260. end # update scene
  261.  
  262. # Define call meditate from map
  263. def update_call_meditate
  264. if Input.press?(DPB::PMEDITATE::MEDITATEKEY) && Switch.use_meditate
  265. call_meditate
  266. end
  267. end
  268. # Define call meditate from map
  269. def call_meditate
  270. $game_player.animation_id = DPB::PMEDITATE::MEDIANI
  271. dpbzwait((DPB::PMEDITATE::Meditate_wait_time / $game_party.members[0].rec).to_i)
  272. if DPB::PMEDITATE::GAIN_HP && Switch.meditate_hpgain
  273. hpplusvaltote
  274. end
  275. if DPB::PMEDITATE::GAIN_MP && Switch.meditate_mpgain
  276. mpplusvaltote
  277. end
  278. if DPB::PMEDITATE::GAIN_TP && Switch.meditate_tpgain
  279. tpplusvaltote
  280. end
  281. ##
  282. end
  283. #--------------------------------------------------------------------------
  284. # * dpbzwait
  285. #--------------------------------------------------------------------------
  286. def dpbzwait(duration)
  287. fade_loop(duration) {|v| Graphics.frame_count = v }
  288. end
  289.  
  290. # formula for hp regen during meditate
  291. def hpplusvaltote
  292. hpval1 = DPB::PMEDITATE::HPgain
  293. hpval2 = ($game_party.members[0].hrg * 100).to_i
  294. hpvaltote = (hpval1 + hpval2)
  295. $game_party.members[0].hp += hpvaltote
  296. end
  297.  
  298. # formula for mp regen during meditate
  299. def mpplusvaltote
  300. mpval1 = DPB::PMEDITATE::MPgain
  301. mpval2 = ($game_party.members[0].mrg * 100).to_i
  302. mpvaltote = (mpval1 + mpval2)
  303. $game_party.members[0].mp += mpvaltote
  304. end
  305.  
  306. # formula for mp regen during meditate
  307. def tpplusvaltote
  308. tpval1 = DPB::PMEDITATE::TPgain
  309. tpval2 = ($game_party.members[0].trg * 100).to_i
  310. tpvaltote = (tpval1 + tpval2)
  311. $game_party.members[0].tp += tpvaltote
  312. end
  313.  
  314. end# scenemap
  315.  
  316. class Game_Player < Game_Character
  317. #--------------------------------------------------------------------------
  318. # * Determine if Movement is Possible
  319. #--------------------------------------------------------------------------
  320. alias dpbzmedimove? movable?
  321. def movable?
  322. return false if Input.press?(DPB::PMEDITATE::MEDITATEKEY)
  323. dpbzmedimove?
  324. end
  325. end
  326. #==============================================================================
  327. # Game_Battler
  328. #
  329. # Re-write #
  330. class Game_Battler < Game_BattlerBase
  331. def regenerate_all
  332. end # N/A
  333. end #class Game_Battler < Game_BattlerBase
  334. #
  335. #===============================================================================#
  336. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  337. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  338. # #
  339. # ★ Perfect MMORPG Meditate™ ★
  340. #
  341. # - SCRIPT END - #
  342. # # #
  343. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  344. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  345. #===============================================================================#
  346. # - DekitaRPG@gmail.com - #
  347. #===============================================================================#
  348. #
  349. #
  350. # YOU CAN DELETE EVERYTHING BELOW THIS IF YOU DONT WANT TO SHOW THE HP/MP AND TP
  351. # GAUGES. I RECOMMEND USING A BETTER HUD SO YOU CAN "APPRECIATE" THE MEDITATE
  352. # FUNCTION (I find it "pleasing" to see my hp ect rise in the gauges lol)
  353. #
  354. #
  355. module DPB
  356. module PHUD
  357. HP_FONT_SIZE = 15
  358. MP_FONT_SIZE = 15
  359. TP_FONT_SIZE = 15
  360. HUDG_Z = 99 # the z for the hud graphic (from graphics folder)
  361. FACE_Z = 98 # the z value for the face image
  362. HP_Z = 98 # the z value for hp gauge
  363. MP_Z = 98 # the z value for mp gauge
  364. TP_Z = 98 # the z value for tp gauge
  365. end#phud
  366. end#DPB
  367.  
  368. if DPB::PMEDITATE::SHOW_GAUGES_ON_MAP_SCREEN
  369. class HP_HudThing < Window_Base
  370. #----------------------------------------------------
  371. # * Object Initialization
  372. #----------------------------------------------------
  373. def initialize
  374. super(-12, -12, Graphics.width, Graphics.height + 10)
  375. create_contents
  376. self.opacity = 0
  377. @actor = $game_party.members[0]
  378. refresh
  379. end
  380. def dpbzhp_gauge_color1; text_color(28); end; # HP gauge 1
  381. def dpbzhp_gauge_color2; text_color(29); end; # HP gauge 2
  382. def dpbzmp_gauge_color1; text_color(22); end; # MP gauge 1
  383. def dpbzmp_gauge_color2; text_color(23); end; # MP gauge 2
  384. def dpbztp_gauge_color1; text_color(10); end; # TP gauge 1
  385. def dpbztp_gauge_color2; text_color(2); end; # TP gauge 2
  386. #----------------------------------------------------
  387. # * Refresh
  388. #----------------------------------------------------
  389. def refresh
  390. self.contents.clear
  391. contents.clear
  392. draw_window_content
  393. end
  394. def draw_window_content
  395. dpbzhp
  396. dpbzmp
  397. dpbztp
  398. end
  399. def dpbzhp
  400. self.z = DPB::PHUD::HP_Z
  401. contents.font.size = DPB::PHUD::HP_FONT_SIZE
  402. @hp = @actor.hp
  403. rate = [@actor.hp_rate, 1.0].min
  404. draw_dpbzhp_gauge(5, -5, 112, rate, dpbzhp_gauge_color1, dpbzhp_gauge_color2)
  405. change_color(normal_color)
  406. draw_current_and_max_values(5, 0, 112, @actor.hp, @actor.mhp,
  407. hp_color(@actor), normal_color)
  408. end
  409. def draw_dpbzhp_gauge(dx, dy, dw, rate, color1, color2)
  410. dw -= 2
  411. fill_w = [(dw * rate).to_i, dw].min
  412. gauge_h = 14
  413. gauge_y = dy + line_height - 2 - gauge_h
  414. contents.gradient_fill_rect(dx, gauge_y, fill_w, gauge_h, color1, color2)
  415. end
  416. def dpbzmp
  417. self.z = DPB::PHUD::MP_Z
  418. contents.font.size = DPB::PHUD::MP_FONT_SIZE
  419. @mp = @actor.mp
  420. rate = [@actor.mp_rate, 1.0].min
  421. draw_dpbzmp_gauge(5, 15, 112, rate, dpbzmp_gauge_color1, dpbzmp_gauge_color2)
  422. change_color(normal_color)
  423. draw_current_and_max_values(5, 20, 112, @actor.mp, @actor.mmp,
  424. mp_color(@actor), normal_color)
  425. end
  426. def draw_dpbzmp_gauge(dx, dy, dw, rate, color1, color2)
  427. dw -= 2
  428. fill_w = [(dw * rate).to_i, dw].min
  429. gauge_h = 14
  430. gauge_y = dy + line_height - 2 - gauge_h
  431. contents.gradient_fill_rect(dx, gauge_y, fill_w, gauge_h, color1, color2)
  432. end
  433. def dpbztp
  434. self.z = DPB::PHUD::TP_Z
  435. contents.font.size = DPB::PHUD::TP_FONT_SIZE
  436. @tp = @actor.tp
  437. rate = [@actor.tp_rate, 1.0].min
  438. draw_dpbztp_gauge(5, 35, 112, rate, dpbztp_gauge_color1, dpbztp_gauge_color2)
  439. draw_text(62, 40, 112, line_height, @actor.tp)
  440. end
  441. def draw_dpbztp_gauge(dx, dy, dw, rate, color1, color2)
  442. dw -= 2
  443. fill_w = [(dw * rate).to_i, dw].min
  444. gauge_h = 14
  445. gauge_y = dy + line_height - 2 - gauge_h
  446. contents.gradient_fill_rect(dx, gauge_y, fill_w, gauge_h, color1, color2)
  447. end
  448. def update
  449. super
  450. return if !self.visible
  451. if @level != @actor.level or @hp != @actor.hp or @mp != @actor.mp or
  452. @tp != @actor.tp or @exp != @actor.exp or @gold != $game_party.gold
  453. refresh
  454. end
  455. end
  456. end
  457. class Spriteset_Map
  458. alias dpbzhud_initialize initialize
  459. alias dpbzhud_dispose dispose
  460. alias dpbzhud_update update
  461. def initialize
  462. @trash = []
  463. @winhud = HP_HudThing.new
  464. dpbzhud_initialize
  465. end
  466. def dispose
  467. dpbzhud_dispose
  468. @winhud.dispose
  469. end
  470. def update
  471. dpbzhud_update
  472. @winhud.update
  473. end
  474. end#spriteset map
  475. end
  476. #
  477. #end # switch
  478.  
  479.  
  480. ############################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement