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.2
- # -- 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
- # 14/o6/2o14 - Updated efficiency,
- # - Added :second/:frames time counters
- # 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
- #-----------------------------------------------------------------------------
- # MODES:
- # :second = regen triggers every second.
- # :frames = regen triggers at a frequency equal to the number of frames equal
- # to the value of MMO_FRAME
- Regen_Mode = :frames
- #-----------------------------------------------------------------------------
- # If Regen_Mode is :frames this will be used.
- MMO_FRAME = 180
- #-----------------------------------------------------------------------------
- # The key to press for 'bonus' Regeneration
- Regen_Key = :E
- #-----------------------------------------------------------------------------
- # The animation displayed for 'bonus' regen
- Animation = 2
- #-----------------------------------------------------------------------------
- # 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, 512, 268, 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/100) 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/100) 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
- sum += Base_TP + (actor.trg * 100) 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
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def setup_regen
- @last_regen = Time.now.sec
- @regen_frames = MMO_FRAME
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def do_deki_regen
- @regen_frames -= 1
- return unless can_do_mmo_regen?
- reset_last_regen
- perform_mmo_regen
- mmo_battle_regen_for_enemies
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def can_do_mmo_regen?
- case Regen_Mode
- when :frames
- return false if @regen_frames > 0
- return false if !Regen_Per_Sec unless Keys.press?(Keys::Key[Regen_Key])
- else
- return false if @last_regen == Time.now.sec
- return false if !Regen_Per_Sec unless Keys.press?(Keys::Key[Regen_Key])
- end
- return true
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def reset_last_regen
- setup_regen
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def perform_mmo_regen
- $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])
- perform_mmo_regen_ani
- end
- actor.refresh
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def perform_mmo_regen_ani
- get_mmo_regen_ani_targets.each do |char|
- next unless char.actor != nil
- char.animation_id = Animation
- end
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def get_mmo_regen_ani_targets
- [$game_player] + $game_player.followers
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def mmo_battle_regen_for_enemies
- return unless SceneManager.scene_is?(Scene_Battle)
- $game_troop.compact.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)
- actor.refresh
- end
- @status_window.refresh if @status_window
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- end
- #===============================================================================
- class Game_Battler < Game_BattlerBase
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- alias :regen_all_SM :regenerate_all
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def regenerate_all
- return if MMO_Regen::Disable_Default_Regen
- return regen_all_SM
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- end
- #===============================================================================
- class Scene_Map < Scene_Base
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- include MMO_Regen
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- alias :start_deki_regen_SM :start
- alias :update_deki_regen_SM :update
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def start
- setup_regen if MMO_Regen::Allow_On_Map
- start_deki_regen_SM
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def update
- update_deki_regen_SM
- do_deki_regen if MMO_Regen::Allow_On_Map
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- end
- #===============================================================================
- class Scene_Battle < Scene_Base
- #===============================================================================
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- include MMO_Regen
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- alias :start_deki_regen_SB :start
- alias :update_deki_regen_SB :update
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- def start
- start_deki_regen_SB
- setup_regen if MMO_Regen::Allow_In_Battle
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- 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