Mp Regeneration System
v 1.4
FenixFyreX
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:
To disable the whole system for actors, call this in an event:mpreg_sys(true / false)Code:
To disable the whole system for enemies, call this in an event:mpreg_act(true / false)Code:
To change the amount of mp regeneration per turn, call this in an event:mpreg_eny(true / false)Code:
Where type is 0 (actors) or 1 (enemies) and number is the amount you wish to change to.mpreg_amt(type, number)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.
=end
module 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)"
end
class 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[0]
if $game_system.mp_regen_switch[1]
$game_party.members.each {|i| i.mp = Mp_Reg_Setup::Mp_Start_Value}
end
if $game_system.mp_regen_switch[2]
$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[0]
else
if !@active_battler.nil?
if !@active_battler.state?(1)
do_add_mp_regen(@active_battler) if $game_system.mp_regen_switch[0]
end
end
end
mpreg_s_main
end
def do_add_mp_regen(i)
if $game_system.mp_regen_switch[1] 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[0] + number
if i.mp > i.maxmp
i.mp = i.maxmp
end
else
i.mp += $game_system.mp_regen_amt[0]
if i.mp > i.maxmp
i.mp = i.maxmp
end
end
end
if $game_system.mp_regen_switch[2] 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[0] + number
if i.mp > i.maxmp
i.mp = i.maxmp
end
else
i.mp += $game_system.mp_regen_amt[1]
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[0] and switch[1]
mp_regen_batend(*args)
end
end
class 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 = [Start_System, Start_Actors, Start_Enemys]
@mp_regen_amt = [Regen_Amount_A,Regen_Amount_E]
end
end
class Game_Interpreter
def mpreg_amt(item, number)
$game_system.mp_regen_amt[item] = number
end
def mpreg_sys(sys)
$game_system.mp_regen_switch[0] = sys
end
def mpreg_act(actr)
$game_system.mp_regen_switch[1] = actr
end
def mpreg_eny(eny)
$game_system.mp_regen_switch[2] = eny
end
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
# END
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#Give credit to me for creating this and Rezna for requesting it, please ;)
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