じ☆ve冰风 发表于 6 天前

MP Regen System

Mp Regeneration System

v 1.4

FenixFyreX



Introduction

This script sets everyone's MP to 0 (one actually, cause of the first turn) at the beginning of the battle and gives each actor and enemy a defined amount of MP each turn.

Features


[*]-=- Make MP start at 0 and work it's way up, making battles much more strategic.
-=- Turn the whole system off entirely, just for actors, or just for enemies via script calls.
-=- Manipulate the amount of MP Regen via a script call.

Version Changes


[*]-=- v1.0 -- Added in switches and such, allowing for more customization.
-=- v1.1 -- Fixed a bug
-=- v1.2 -- Added support for and intelligence boost
-=- v1.3 -- Fixed a bug and changed one method
-=- v1.4 -- Changed the system to regen mp per actor, not to whole party / troop

How To

To turn the whole system off, call this in an event:



                Code:        
mpreg_sys(true / false)

To disable the whole system for actors, call this in an event:



                Code:        
mpreg_act(true / false)

To disable the whole system for enemies, call this in an event:



                Code:        
mpreg_eny(true / false)

To change the amount of mp regeneration per turn, call this in an event:



                Code:        
mpreg_amt(type, number)

Where type is 0 (actors) or 1 (enemies) and number is the amount you wish to change to.

Script

Spoiler                 Code:        
=begin -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=                                           MP Regenerator System v1.4                                                   -= -=                                                          FenixFyreX                                                                        -= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=   There are a couple commands to be aware of.To turn the whole system off, use this script call:   mpreg_sys(true / false)   To turn the system off only for actors, use this:   mpreg_act(true / false)   To turn the system off only for enemies, use this:   mpreg_eny(true / false)   To change how much mp each turn regenerates, use this:   mpreg_amt(type, number)    Where type is 0(actors) or 1(enemies) and number is the amount to regen each   turn.    Other setup is below.=endmodule Mp_Reg_Setup    # If the below is 0, mp will be returned to 0 after battle. if 1, mp will   # be fully restored. any other number will result in mp staying the same.    Mp_Return_Action = 0    #--------------------------   # What each actor's mp will be set as at the beginning of battle.    Mp_Start_Value   = 0    #--------------------------   # How much mp each actor and enemy gains per turn.    Regen_Amount_A   = 1# Actors   Regen_Amount_E   = 1# Enemies    #--------------------------   # Which options to start with    Start_System       = true   Start_Actors       = true   Start_Enemys       = true    #--------------------------   # do you want the system to NOT effect those who are dead?   Stop_When_Dead   = true    #--------------------------   # If true, intelligence will affect the mp gained.    Use_Int_Effect   = true    #---------------------------   # You can use your own formula for the above switch via the global variable:   # To specify the active battler be it actor or enemy, use i. So, i is the   # active battler.    $mp_reg_form = "((i.spi / 100) * 4)"endclass Scene_Battle < Scene_Base    alias mpregen_prog start unless $@   def start         mpregen_prog         start_mp_regen   end    def start_mp_regen         if $game_system.mp_regen_switch           if $game_system.mp_regen_switch                 $game_party.members.each {|i| i.mp = Mp_Reg_Setup::Mp_Start_Value}           end           if $game_system.mp_regen_switch                 $game_troop.members.each {|i| i.mp = Mp_Reg_Setup::Mp_Start_Value}           end           $game_party.members.each {|i| do_add_mp_regen(i)}         end   end    alias mpreg_s_main process_action unless $@   def process_action         if !Mp_Reg_Setup::Stop_When_Dead           do_add_mp_regen(@active_battler) if $game_system.mp_regen_switch         else           if !@active_battler.nil?                 if !@active_battler.state?(1)                   do_add_mp_regen(@active_battler) if $game_system.mp_regen_switch                 end           end         end         mpreg_s_main   end    def do_add_mp_regen(i)         if $game_system.mp_regen_switch and @active_battler.is_a?(Game_Actor)           if Mp_Reg_Setup::Use_Int_Effect                 number = ((i.spi / 100) * 4).to_i if $mp_reg_form == nil                 number = eval($mp_reg_form) if $mp_reg_form != nil                 i.mp += $game_system.mp_regen_amt + number                 if i.mp > i.maxmp                   i.mp = i.maxmp                 end           else                 i.mp += $game_system.mp_regen_amt                 if i.mp > i.maxmp                   i.mp = i.maxmp                 end           end         end         if $game_system.mp_regen_switch and @active_battler.is_a?(Game_Enemy)           if Mp_Reg_Setup::Use_Int_Effect                 number = ((i.spi / 100) * 4).to_i if $mp_reg_form == nil                 number = eval($mp_reg_form) if $mp_reg_form != nil                 i.mp += $game_system.mp_regen_amt + number                 if i.mp > i.maxmp                   i.mp = i.maxmp                 end           else                 i.mp += $game_system.mp_regen_amt                 if i.mp > i.maxmp                   i.mp = i.maxmp                 end           end         end   end    def do_regen_end         regener = Mp_Reg_Setup::Mp_Return_Action         if regener == 0           $game_party.members.each {|i| i.mp = 0}         elsif regener == 1           $game_party.members.each {|i| i.mp = i.maxmp}         end   end    alias mp_regen_batend battle_end unless $@   def battle_end(*args)         switch = $game_system.mp_regen_switch         do_regen_end if switch and switch         mp_regen_batend(*args)   end endclass Game_System    include Mp_Reg_Setup    attr_accessor :mp_regen_switch   attr_accessor :mp_regen_amt    alias mp_regen_init initialize unless $@   def initialize         mp_regen_init         @mp_regen_switch =         @mp_regen_amt        =    end endclass Game_Interpreter    def mpreg_amt(item, number)         $game_system.mp_regen_amt = number   end    def mpreg_sys(sys)         $game_system.mp_regen_switch = sys   end    def mpreg_act(actr)         $game_system.mp_regen_switch = actr   end    def mpreg_eny(eny)         $game_system.mp_regen_switch = eny   end end #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# # END #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#





Notes / Credit

Give credit to me for creating this and Rezna for requesting it, please
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7

Also, this should work with any battle system out there. If not, just yell and I'll patch it.

EDIT: It should work with any battle system now o.0 But as most battle systems are different, I can't guarantee that XD


本贴来自国际rpgmaker官方论坛作者:FenixFyreX处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/mp-regen-system.3379/
页: [1]
查看完整版本: MP Regen System