Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if true # << Make true to use this script, false to disable.
- #===============================================================================
- #
- # ☆ $D13x - MMO Style Regen
- # -- Author : Dekita
- # -- Version : 1.1
- # -- Level : Easy
- # -- Requires : $D13x Core v1.6+
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:MMO_Regen]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 18/o5/2o13 - Update, (Key Menu HUD now shows regen key)
- # o4/o4/2o13 - Started, Finished,
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script adds a MMO style regeneration method into the game.
- # Each second you (all battle members) will regenerate hp/mp/tp according
- # to the formulas within this script. Can also enable for enemies.
- #
- # you can have extra regen bonuses for holding down a key
- # and disable all regen unless a key is being pressed.
- #
- # The default formulas will allow for more hp to be regenerated based on
- # the actors max hp, but you can make the formula check whatever actor stats
- # you want, for example, you could easily base the regen method against
- # an actors equipment or skills... ( << needs coding know-how )
- #
- # This script requires my $D13x Core, therefor most keyboard keys are available
- # as the "Regen" key. (By default its the 'R' Key)
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- #===============================================================================
- # 1. You MUST give credit to "Dekita" !!
- # 2. You are NOT allowed to repost this script.(or modified versions)
- # 3. You are NOT allowed to convert this script.
- # 4. You are NOT allowed to use this script for Commercial games.
- # 5. ENJOY!
- #
- # "FINE PRINT"
- # By using this script you hereby agree to the above terms and conditions,
- # if any violation of the above terms occurs "legal action" may be taken.
- # Not understanding the above terms and conditions does NOT mean that
- # they do not apply to you.
- # If you wish to discuss the terms and conditions in further detail you can
- # contact me at http://dekitarpg.wordpress.com/
- #
- #===============================================================================
- # ☆ Instructions
- #-------------------------------------------------------------------------------
- # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
- #
- #===============================================================================
- # ☆ HELP
- #-------------------------------------------------------------------------------
- # You really should'nt need any...
- #
- #===============================================================================
- module MMO_Regen
- #===============================================================================
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # ☆ General Settings
- #-----------------------------------------------------------------------------
- # The key to press for 'bonus' Regeneration
- Regen_Key = :R
- #-----------------------------------------------------------------------------
- # The animation displayed for 'bonus' regen
- Animation = 113
- #-----------------------------------------------------------------------------
- # Allow base regen to happen without key press
- Regen_Per_Sec = true
- #-----------------------------------------------------------------------------
- # Allow Regen in battle scene ?
- Allow_In_Battle = true
- #-----------------------------------------------------------------------------
- # Allow Regen on the game map ?
- Allow_On_Map = true
- #-----------------------------------------------------------------------------
- # Allow Enemies the stndard regen each second ? (disregard key press)
- Enemy_Can_Regen = true
- #-----------------------------------------------------------------------------
- # Disable Default Regen Method ? (eg. hrg, mrg, trg)
- Disable_Default_Regen = true
- #-----------------------------------------------------------------------------
- # Requires $D13x Key Menu HUD v1.2+
- # = [switch, show, x, y, icon, hue]
- Regen_HUD = [10 , true, 158, 2, 112, 0]
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # ☆ Basic Calculation Settings
- #-----------------------------------------------------------------------------
- # The Min Value of regen each second.
- Base_HP = 1
- Base_MP = 1
- Base_TP = 0
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # ☆ Advanced Calculation Settings
- #-----------------------------------------------------------------------------
- # This is where you would change the calculations used in determining
- # the total hp/mp/tp gained each regen.
- # if you wish to completely disable one of the regen methods,
- # simply put a ' # ' at the start of each line in the method.
- #-----------------------------------------------------------------------------
- # The Total Value for HP regen each second.
- def self.hp_regen(actor)
- sum = Base_HP + (actor.mhp/500) + (actor.hrg * 100)
- sum += (actor.mhp/250) if Keys.press?(Keys::Key[Regen_Key])
- actor.hp += sum.to_i
- end
- #-----------------------------------------------------------------------------
- # The Total Value for MP regen each second.
- def self.mp_regen(actor)
- sum = Base_MP + (actor.mmp/500) + (actor.mrg * 100)
- sum += (actor.mmp/250) if Keys.press?(Keys::Key[Regen_Key])
- actor.mp += sum.to_i
- end
- #-----------------------------------------------------------------------------
- # The Total Value for TP regen each second.
- def self.tp_regen(actor)
- sum = Base_TP + (actor.trg * 10)
- sum += 1 + (actor.trg * 10) if Keys.press?(Keys::Key[Regen_Key])
- actor.tp += sum
- end
- #####################
- # CUSTOMISATION END #
- end #####################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? \| #
- # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #===============================================================================#
- module MMO_Regen
- #===============================================================================
- #--------------------------------------------------------------------------
- # Set Regen Frequency
- #--------------------------------------------------------------------------
- def setup_regen
- @last_regen = Time.now.sec
- end
- #--------------------------------------------------------------------------
- # Do The MMO Style Regen
- #--------------------------------------------------------------------------
- def do_deki_regen
- return if @last_regen == Time.now.sec
- return if !Regen_Per_Sec unless Keys.press?(Keys::Key[Regen_Key])
- @last_regen = Time.now.sec
- $game_party.battle_members.each do |actor|
- next if actor.hp <= 0
- MMO_Regen.hp_regen(actor)
- MMO_Regen.mp_regen(actor)
- MMO_Regen.tp_regen(actor)
- if Keys.press?(Keys::Key[Regen_Key])
- anim = Animation
- $game_player.animation_id = anim
- $game_player.followers.each do |char|
- next unless char.actor != nil
- char.animation_id = anim
- end
- end
- end
- if SceneManager.scene_is?(Scene_Battle)
- $game_troop.members.each do |actor|
- next if actor.hp <= 0
- break unless Enemy_Can_Regen
- MMO_Regen.hp_regen(actor)
- MMO_Regen.mp_regen(actor)
- MMO_Regen.tp_regen(actor)
- end
- @status_window.refresh if @status_window
- end
- end
- end
- #===============================================================================
- class Game_Battler < Game_BattlerBase
- #===============================================================================
- #--------------------------------------------------------------------------
- # Alias List
- #--------------------------------------------------------------------------
- alias :regen_all_SM :regenerate_all
- #--------------------------------------------------------------------------
- # Regenerate All
- #--------------------------------------------------------------------------
- def regenerate_all
- return if MMO_Regen::Disable_Default_Regen
- return regen_all_SM
- end
- end
- #===============================================================================
- class Scene_Map < Scene_Base
- #===============================================================================
- #--------------------------------------------------------------------------
- # Included Modules
- #--------------------------------------------------------------------------
- include MMO_Regen
- #--------------------------------------------------------------------------
- # Alias List
- #--------------------------------------------------------------------------
- alias :start_deki_regen_SM :start
- alias :update_deki_regen_SM :update
- #--------------------------------------------------------------------------
- # Start Processing
- #--------------------------------------------------------------------------
- def start
- start_deki_regen_SM
- setup_regen if MMO_Regen::Allow_On_Map
- end
- #--------------------------------------------------------------------------
- # Frame Update
- #--------------------------------------------------------------------------
- def update
- update_deki_regen_SM
- do_deki_regen if MMO_Regen::Allow_On_Map
- end
- end
- #===============================================================================
- class Scene_Battle < Scene_Base
- #===============================================================================
- #--------------------------------------------------------------------------
- # Included Modules
- #--------------------------------------------------------------------------
- include MMO_Regen
- #--------------------------------------------------------------------------
- # Alias List
- #--------------------------------------------------------------------------
- alias :start_deki_regen_SB :start
- alias :update_deki_regen_SB :update
- #--------------------------------------------------------------------------
- # Start Processing
- #--------------------------------------------------------------------------
- def start
- start_deki_regen_SB
- setup_regen if MMO_Regen::Allow_In_Battle
- end
- #--------------------------------------------------------------------------
- # Frame Update
- #--------------------------------------------------------------------------
- def update
- update_deki_regen_SB
- do_deki_regen if MMO_Regen::Allow_In_Battle
- end
- end
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement