FamilyGamer7

Veteran
Veteran
Joined
Jan 4, 2021
Messages
33
Reaction score
6
First Language
English
Primarily Uses
RMVXA
JRPG MP Levels
By: FamilyGamer7​

Introduction
This script was designed to imitate the Suikoden 1 & 2 MP level usage within your game. You have a total of 4 MP levels on each actor. For Ex: 0 / 0 / 0 / 0. When Skill LV1 is consumed, it will only deplete the first MP level usage and the same applies to each skill specifically. This script works around the default MP consumption and avoids using external scripts with the manipulation of $game_variables. The idea is to give more control with $game_variables.

Features
- MP level on all actors (Up to 25) - Ex: 4 / 2 / 1 / 0
- MP levels based on actor class (3 classes + 1 non-class)
- Able to set MP level maximum to 9 (Like Suikoden)
- Can define MP consumption
- Able to recover MP on level up
- Script call to restore MP for all party members (Inn type event)
- See more in script header...

Screenshots
Example1.png
Example2.png
Example3.png

How to Use
Add this script in the script editor under in the "Materials" section and above "Main Process".
The instructions and setup for the script are held within the script header itself. No need to repeat here.

Script
Ruby:
=begin
#==============================================================================
# Title: JRPG MP Levels
# Author: FamilyGamer7
# Date: Feb. 9th, 2021
# Version: 2.4
# (For RPG Maker VX Ace)
#==============================================================================
# ** Change Log |
# ---------------
# 1.0 => Created Script (Work in Progress)
# 1.1 => Started working more back on the script
# 1.2 => Made script independent - No longer requires "Hime - Tag Manager"
# 1.3 => Added support up to 25 actors
# 1.4 => Added in user friendly control with MP growth up to actor max level
# 1.5 => Added in actor classes that will boost the MP level growth
# 1.6 => Added in the option to remove MP guage from menu
# 1.7 => Added in custom MP level consumption versus the default of "1"
# 1.8 => Added in the option to remove LV1-4 on Skill names
# 1.9 => Added in script call to recover MP on all actors (Inn type event)
# 2.0 => Added in option to remove default actor MP maximum of "9"
# 2.1 => Added in Skill MP usage for battle
# 2.2 => Re-wrote various sections of script for efficiency
# 2.3 => Added in option to recover MP on level up
# 2.4 => Script now completed - No longer "Work in Progress"
#==============================================================================
# ** Description |
# ----------------
# This script was designed to imitate the Suikoden 1 & 2 MP level usage within
# game. You have a total of 4 MP Levels on each actor. For Ex: 0 / 0 / 0 / 0.
# When Skill LV1 is consumed, it will only deplete the first MP level usage and
# the same applies to each skill Specifically.
#
# This script works around the default MP consumption and avoids using external
# scripts with the manipulation of $game_variables.
#
# Overall, the purpose of the script was to imitate Suikoden 1 & 2 MP levels as
# mentioned above, but many options have been added in to customize your game to
# the way you want.
#==============================================================================
# ** Important Note(s) |
# ---------------------
# The script is only designed to work up to 6 actors in the party at a time.
# (Script modification will be needed to support more than 6 actors in party.)
#
# The script also uses the following $game_switches and $game_variables numbers
# within the script (Higher numbers were chosen for compatibility).
# - $game_variables: 900-999
# - $game_switches: 976-999
#
# Within this script, the default "death" state is used, which is id #1. If you
# have changed this to another id #, this script will not work as designed.
#==============================================================================
# ** Setup |
# ----------
#
#  ---------------------
# | Skill Configuration |
#  ---------------------------------------------------------------------------
# | When setting up your skills, you need to define 2 points for this script  |
# | to correctly work without issue. See below.                               |     
#  ---------------------------------------------------------------------------
#
#   Skill Cost:
#
#   - Skill MP Cost must be set as "0"
#
#   Skill Name:
#
#   - Skill name must have LV1, LV2, LV3, or LV4 at the end of its name
#
#     Ex: Healing Water LV1
#         Tsunami Power LV2
#         Thrashing Ocean LV3
#         Ultimate Flood LV4
#
#    -------
#   | Notes |
#    -------
#   The script will automatically remove the LV1, LV2, LV3, and LV4 from the
#   skill names. Unless you decide you want to keep it through the on and off
#   switch in the module configuration.
#
#  --------------------------
# | Skill LV1-4 Name Removal |
#  ---------------------------------------------------------------------------
# | The initial script setup removed the LV1-4 out of the skill name. The     |
# | option has been given to either keep LV in the skill name or remove.      |
#  ---------------------------------------------------------------------------
#
# - To keep "LV" in skill name:
#
#     Ex: RemoveSkill_LV_Name = false
#
# - To remove "LV" in skill name:
#
#     Ex: RemoveSkill_LV_Name = true
#
#  -----------------
# | MP Gauge Option |
#  ---------------------------------------------------------------------------
# | You have the option to turn off the default MP gauge in the game. Since   |
# | this script works around the default MP usage, the gauge will never       |
# | decrease. You can either keep the option on or turn off. Example below.   |
#  ---------------------------------------------------------------------------
#
# - To keep on:
#
#     Ex: RemoveMPGauge = false
#
# - To turn off:
#
#     Ex: RemoveMPGauge = true
#
#  ----------------------
# | MP Maximum Per Level |
#  ---------------------------------------------------------------------------
# | You have the option to go by script design where the maximum MP per level |
# | is "9" or remove it. To remove this maximum cap, see example below.       |
#  ---------------------------------------------------------------------------
#
# - To keep maximum MP of 9:
#
#     Ex: MaxMP9 = true
#
# - To remove maximum MP:
#
#     Ex: MaxMP9 = false
#
#  ------------------------
# | MP Recover on Level Up |
#  ---------------------------------------------------------------------------
# | Allows you to recover MP when the party members level up in battle.       |
#  ---------------------------------------------------------------------------
#
# - To recover MP on level up:
#
#     Ex: RecoverMPOnLvL = true
#
# - To not recover MP on level up:
#
#     Ex: RecoverMPOnLvL = false
#
#    -------
#   | Notes |
#    -------
#   If you win in battle and level up, the party members that are only alive
#   will recover MP when the RecoverMPOnLvL is set to "true".
#
#  ----------------
# | MP Consumption |
#  ---------------------------------------------------------------------------
# | Allows you to modify the value amount that is consumed from the specific  |
# | MP Level on the actor.                                                    |
#  ---------------------------------------------------------------------------
#
# - Default consumption:
#
#     Ex: MP_Consumption = 1
#
# - Custom consumption:
#   (The higher value will decrease MP level faster)
#
#     Ex: MP_Consumption = 2
#
#  -----------------
# | Actor MP Levels |
#  ---------------------------------------------------------------------------
# | These numbers are divided by the actors level which give a MP Level       |
# | Growth like effect. Example below.                                        |
#  ---------------------------------------------------------------------------
#
#     Ex: MP_Level_1 = 11
#
#     If Actor1 is level 39, and you define MP_Level_1 as 11, then...
#     39 / MP_Level_1 = 3.545. If the number is not a whole number and is a
#     decimal, the number will round up or down based off the decimal place.
#
#     What you want to keep in mind, the bigger the number, the slower the MP
#     level growth will be on the Actor. So, if you define a small number, the
#     MP level growth will be faster. Same applies when using the actor
#     class multiplier.
#
#    -------
#   | Notes |
#    -------
#   If an actor does not match one of the 3 classes, then it will use
#   the defined MP Levels without a multiplier, thus giving you essentially
#   4 differenct classes as a total.
#
#  --------------------------------
# | MP Levels Based On Actor Class |
#  ---------------------------------------------------------------------------
# | It would not be fun if everyone had the same MP Level growth. To make it  |
# | more interesting, you can define between 3 different classes within your  |
# | game. So for example, a Mage would have a higher MP level growth than a   |
# | warrior actor class.                                                      |
#  ---------------------------------------------------------------------------
#
#     The actors that are soldiers, you would define in Class1, Class2, and
#     Class3 as shown below. Remember to add the "Soldier" name to as the class
#     in the Game Database.
#
#     Actor 1-3 (Class = Soldier)
#     Ex: Class1 = "Soldier"
#
#     Actor 4-7 (Class = Mage)
#     Ex: Class2 = "Mage"
#
#     Actor 8-11 (Class = Bowman)
#     Ex: Class3 = "Bowman"
#
#    -------
#   | Notes |
#    -------
#   If you do not define a class on an actor that matches in the script setup,
#   it will just not use the defined multipliers for MP level growth.
#
#  ----------------------------------------------------
# | MP level Recovery - Party Members (Inn Type Event) |
#  ---------------------------------------------------------------------------
# | To recover all party members mp levels outside of an item, you can setup  |
# | an event within your game and use the script call below.                  |
#  ---------------------------------------------------------------------------
#
#     Script Call: $game_party.restore_mp_levels_party_members
#
#    -------
#   | Notes |
#    -------
#
#   Before using the script call to recover mp on all party members, be sure
#   to remove "death" state on in any actors in the party. Example below.
#
#   Event Example:
#
#   # Removes [Death] state all party members
#   Change State: Entire Party, + [Death]
#
#   # Restores all party members mp
#   Script: $game_party.restore_mp_levels_party_members
#
#==============================================================================
# ** Terms of Use |
# -----------------
# * Free to use in non-commercial projects and commercial projects
# * Feel free to modify and improve the script. Credit is still required.
# * Credit FamilyGamer7
#==============================================================================
# ** Special Thanks |
# -------------------
# * To the RM community for the assistance.
#   - Specifically: Roninator2, TheoAllen and A-Moonless-Night
#==============================================================================
=end

#==============================================================================
# ** MP Level Module - FG7_JRPG_MP_Levels::Variables
#---------------------------------------- --------------------------------------
# This module gives the user a friendly way of making the necessary changes.
# * Provides the ability to:
#   - Can remove the default MP gauge
#   - Can remove the LV1-4 from Skill name
#   - Can remove MP maximum cap of "9"
#   - Can recover MP on level up
#   - Define MP level 1-4
#   - Define MP level consumption
#   - Define actor classes for MP level growth and multiplier
#------------------------------------------------------------------------------
 
module FG7_JRPG_MP_Levels
  module Variables
    
#==============================================================================
# -------------------- ALLOWED TO EDIT BELOW THIS LINE ---------------------- #
#==============================================================================
 
  # Determines if the MP Guage should be removed or not
  # (This is set to "true" by default - MP system works around the default)
  RemoveMPGauge = true
 
  # Determines if the LV1-4 should be removed or not from the skill name
  # (This is set to "true" by default)
  RemoveSkill_LV_Name = true
 
  # Determines if the maximum MP level can go beyond "9"
  # (This is set to "true" by default)
  MaxMP9 = true
 
  # Determines if the party member recovers MP on level up
  # (This is set to "false" by default)
  RecoverMPOnLvL = false
 
  # Defines how much the skill MP consumes from the specific MP level
  # Note: This will affect all actors in game (Up to 25 actors per design)
  # (MP Consumption of "1" is the default)
  MP_Consumption = 1
 
  # Actor Defined MP levels - Values that divide into the actor levels
  MP_Level_1 = 11
  MP_Level_2 = 12
  MP_Level_3 = 20
  MP_Level_4 = 30
 
  # Low MP levels - Physical: multiplier to adjust the MP level growth
  Class1 = "Soldier"
  Class1_Multiplier = 1.2
 
  # High MP levels - Magic: multiplier to adjust the MP level growth
  Class2 = "Mage"
  Class2_Multiplier = 1.6
 
  # Normal MP levels - Balanced: multiplier to adjust the MP level growth
  Class3 = "Bowman"
  Class3_Multiplier = 1.4

#==============================================================================
# ---------- DO NOT EDIT BELOW THIS LINE (FOR ADVANCED USERS) --------------- #
#==============================================================================

  end
end

#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
#  This class handles parties. Information such as gold and items is included.
# Instances of this class are referenced by $game_party.
#==============================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # * New Methods: Creates Actor MP level (Ex: 0 / 0 / 0 / 0)
  # Sets up MP Levels in an array (With $game_variables) for 25 Actors
  #--------------------------------------------------------------------------
  # Actor 1
  def actor_mp_levels_actor1; return [$game_variables[900], $game_variables[901], $game_variables[902], $game_variables[903], "900", "901", "902", "903"]; end
  # Actor 2
  def actor_mp_levels_actor2; return [$game_variables[904], $game_variables[905], $game_variables[906], $game_variables[907], "904", "905", "906", "907"]; end
  # Actor 3
  def actor_mp_levels_actor3; return [$game_variables[908], $game_variables[909], $game_variables[910], $game_variables[911], "908", "909", "910", "911"]; end
  # Actor 4
  def actor_mp_levels_actor4; return [$game_variables[912], $game_variables[913], $game_variables[914], $game_variables[915], "912", "913", "914", "915"]; end
  # Actor 5
  def actor_mp_levels_actor5; return [$game_variables[916], $game_variables[917], $game_variables[918], $game_variables[919], "915", "917", "918", "919"]; end
  # Actor 6
  def actor_mp_levels_actor6; return [$game_variables[920], $game_variables[921], $game_variables[922], $game_variables[923], "920", "921", "922", "923"]; end
  # Actor 7
  def actor_mp_levels_actor7; return [$game_variables[924], $game_variables[925], $game_variables[926], $game_variables[927], "924", "925", "926", "927"]; end
  # Actor 8
  def actor_mp_levels_actor8; return [$game_variables[928], $game_variables[929], $game_variables[930], $game_variables[931], "928", "929", "930", "931"]; end
  # Actor 9
  def actor_mp_levels_actor9; return [$game_variables[932], $game_variables[933], $game_variables[934], $game_variables[935], "932", "933", "934", "935"]; end
  # Actor 10
  def actor_mp_levels_actor10; return [$game_variables[936], $game_variables[937], $game_variables[938], $game_variables[939], "936", "937", "938", "939"]; end
  # Actor 11
  def actor_mp_levels_actor11; return [$game_variables[940], $game_variables[941], $game_variables[942], $game_variables[943], "940", "941", "942", "943"]; end
  # Actor 12
  def actor_mp_levels_actor12; return [$game_variables[944], $game_variables[945], $game_variables[946], $game_variables[947], "944", "945", "946", "947"]; end
  # Actor 13
  def actor_mp_levels_actor13; return [$game_variables[948], $game_variables[949], $game_variables[950], $game_variables[951], "948", "949", "950", "951"]; end
  # Actor 14
  def actor_mp_levels_actor14; return [$game_variables[952], $game_variables[953], $game_variables[954], $game_variables[955], "952", "953", "954", "955"]; end
  # Actor 15
  def actor_mp_levels_actor15; return [$game_variables[956], $game_variables[957], $game_variables[958], $game_variables[959], "956", "957", "958", "959"]; end
  # Actor 16
  def actor_mp_levels_actor16; return [$game_variables[960], $game_variables[961], $game_variables[962], $game_variables[963], "960", "961", "962", "963"]; end
  # Actor 17
  def actor_mp_levels_actor17; return [$game_variables[964], $game_variables[965], $game_variables[966], $game_variables[967], "964", "965", "966", "967"]; end
  # Actor 18
  def actor_mp_levels_actor18; return [$game_variables[968], $game_variables[969], $game_variables[970], $game_variables[971], "968", "969", "970", "971"]; end
  # Actor 19
  def actor_mp_levels_actor19; return [$game_variables[972], $game_variables[973], $game_variables[974], $game_variables[975], "972", "973", "974", "975"]; end
  # Actor 20
  def actor_mp_levels_actor20; return [$game_variables[976], $game_variables[977], $game_variables[978], $game_variables[979], "976", "977", "978", "979"]; end
  # Actor 21
  def actor_mp_levels_actor21; return [$game_variables[980], $game_variables[981], $game_variables[992], $game_variables[983], "980", "981", "982", "983"]; end
  # Actor 22
  def actor_mp_levels_actor22; return [$game_variables[984], $game_variables[985], $game_variables[986], $game_variables[987], "984", "985", "986", "987"]; end
  # Actor 23
  def actor_mp_levels_actor23; return [$game_variables[988], $game_variables[989], $game_variables[990], $game_variables[991], "988", "989", "990", "991"]; end
  # Actor 24
  def actor_mp_levels_actor24; return [$game_variables[992], $game_variables[993], $game_variables[994], $game_variables[995], "992", "993", "994", "995"]; end
  # Actor 25
  def actor_mp_levels_actor25; return [$game_variables[996], $game_variables[997], $game_variables[998], $game_variables[999], "996", "997", "998", "999"]; end
  #--------------------------------------------------------------------------
  # * New Method: Restore MP levels on all actors
  # (Script call for an event - Inn type event)
  #--------------------------------------------------------------------------
  def restore_mp_levels_party_members
    # Variable created for Loop (Party Member 1-6)
    a_1 = 0; a_2 = 5
    # Loops through variables until condition is met (Party Member 1-6)
    while a_1 < a_2 do
      # Check if Party Member is available for MP Recover
      if $game_party.members[a_1] && !$game_party.members[a_1].state?(1)
        mp_level_1_usage = $game_party.send("actor_mp_levels_actor#{$game_party.members[a_1].id}")[4]
        mp_level_2_usage = $game_party.send("actor_mp_levels_actor#{$game_party.members[a_1].id}")[5]
        mp_level_3_usage = $game_party.send("actor_mp_levels_actor#{$game_party.members[a_1].id}")[6]
        mp_level_4_usage = $game_party.send("actor_mp_levels_actor#{$game_party.members[a_1].id}")[7]
        # Variable created for Loop (Classes 1-3)
        b_1 = 1; b_2 = 3
        # Loops through variables until condition is met (Classes 1-3)
        while b_1 < b_2 do
          # Checks if Party Member matches Class #1, #2. or #3
          if $game_party.members[a_1].class.name == FG7_JRPG_MP_Levels::Variables.const_get("Class#{b_1}")
            $game_variables[mp_level_1_usage.to_i] = ($game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_1) * FG7_JRPG_MP_Levels::Variables.const_get("Class#{b_1}_Multiplier")
            $game_variables[mp_level_2_usage.to_i] = ($game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_2) * FG7_JRPG_MP_Levels::Variables.const_get("Class#{b_1}_Multiplier")
            $game_variables[mp_level_3_usage.to_i] = ($game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_3) * FG7_JRPG_MP_Levels::Variables.const_get("Class#{b_1}_Multiplier")
            $game_variables[mp_level_4_usage.to_i] = ($game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_4) * FG7_JRPG_MP_Levels::Variables.const_get("Class#{b_1}_Multiplier")
          # If Party Member does not match Class #1, #2, or #3
          else
            $game_variables[mp_level_1_usage.to_i] = $game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_1
            $game_variables[mp_level_2_usage.to_i] = $game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_2
            $game_variables[mp_level_3_usage.to_i] = $game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_3
            $game_variables[mp_level_4_usage.to_i] = $game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_4
          end
          # Increment the count by +1 in the loop (For Classes)
          b_1 += 1
        end
        # Adds variables into game_variables to recover party members MP
        if $game_variables[mp_level_1_usage.to_i] > 9 && FG7_JRPG_MP_Levels::Variables::MaxMP9 == true; $game_variables[mp_level_1_usage.to_i] = 9; else; $game_variables[mp_level_1_usage.to_i] = $game_variables[mp_level_1_usage.to_i].round; end
        if $game_variables[mp_level_2_usage.to_i] > 9 && FG7_JRPG_MP_Levels::Variables::MaxMP9 == true; $game_variables[mp_level_2_usage.to_i] = 9; else; $game_variables[mp_level_2_usage.to_i] = $game_variables[mp_level_2_usage.to_i].round; end
        if $game_variables[mp_level_3_usage.to_i] > 9 && FG7_JRPG_MP_Levels::Variables::MaxMP9 == true; $game_variables[mp_level_3_usage.to_i] = 9; else; $game_variables[mp_level_3_usage.to_i] = $game_variables[mp_level_3_usage.to_i].round; end
        if $game_variables[mp_level_4_usage.to_i] > 9 && FG7_JRPG_MP_Levels::Variables::MaxMP9 == true; $game_variables[mp_level_4_usage.to_i] = 9; else; $game_variables[mp_level_4_usage.to_i] = $game_variables[mp_level_4_usage.to_i].round; end 
      end
      # Increment the count by +1 in the loop (For next party member)
      a_1 += 1
    end
  end
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It is used within the Game_Actors class
# ($game_actors) and is also referenced from the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Alias Method: Level Up
  #--------------------------------------------------------------------------
  alias :fg7_jrpg_mp_levels_level_up :level_up
  def level_up
    fg7_jrpg_mp_levels_level_up
    # If Recover MP on Level Up is false - Ignore all logic below
    return false if FG7_JRPG_MP_Levels::Variables::RecoverMPOnLvL != true
    # Variable created for Loop (Party Member 1-6)
    a_1 = 0; a_2 = 5
    # Loops through variables until condition is met (Party Member 1-6)
    while a_1 < a_2 do
      if $game_party.members[a_1] && $game_party.members[a_1].name == actor.name && !$game_party.members[a_1].state?(1)
        mp_level_1_usage = $game_party.send("actor_mp_levels_actor#{$game_party.members[a_1].id}")[4]
        mp_level_2_usage = $game_party.send("actor_mp_levels_actor#{$game_party.members[a_1].id}")[5]
        mp_level_3_usage = $game_party.send("actor_mp_levels_actor#{$game_party.members[a_1].id}")[6]
        mp_level_4_usage = $game_party.send("actor_mp_levels_actor#{$game_party.members[a_1].id}")[7]
        # Variable created for Loop (Classes 1-3)
        b_1 = 1; b_2 = 3
        # Loops through variables until condition is met (Classes 1-3)
        while b_1 < b_2 do
          # Checks if Party Member matches Class #1, #2. or #3
          if $game_party.members[a_1].class.name == FG7_JRPG_MP_Levels::Variables.const_get("Class#{b_1}")
            $game_variables[mp_level_1_usage.to_i] = ($game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_1) * FG7_JRPG_MP_Levels::Variables.const_get("Class#{b_1}_Multiplier")
            $game_variables[mp_level_2_usage.to_i] = ($game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_2) * FG7_JRPG_MP_Levels::Variables.const_get("Class#{b_1}_Multiplier")
            $game_variables[mp_level_3_usage.to_i] = ($game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_3) * FG7_JRPG_MP_Levels::Variables.const_get("Class#{b_1}_Multiplier")
            $game_variables[mp_level_4_usage.to_i] = ($game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_4) * FG7_JRPG_MP_Levels::Variables.const_get("Class#{b_1}_Multiplier")
          # If Party Member does not match Class #1, #2, or #3
          else
            $game_variables[mp_level_1_usage.to_i] = $game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_1
            $game_variables[mp_level_2_usage.to_i] = $game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_2
            $game_variables[mp_level_3_usage.to_i] = $game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_3
            $game_variables[mp_level_4_usage.to_i] = $game_party.members[a_1].level / FG7_JRPG_MP_Levels::Variables::MP_Level_4
          end
          # Increment the count by +1 in the loop (For Classes)
          b_1 += 1
        end
        # Adds variables into game_variables to recover party members MP
        if $game_variables[mp_level_1_usage.to_i] > 9 && FG7_JRPG_MP_Levels::Variables::MaxMP9 == true; $game_variables[mp_level_1_usage.to_i] = 9; else; $game_variables[mp_level_1_usage.to_i] = $game_variables[mp_level_1_usage.to_i].round; end
        if $game_variables[mp_level_2_usage.to_i] > 9 && FG7_JRPG_MP_Levels::Variables::MaxMP9 == true; $game_variables[mp_level_2_usage.to_i] = 9; else; $game_variables[mp_level_2_usage.to_i] = $game_variables[mp_level_2_usage.to_i].round; end
        if $game_variables[mp_level_3_usage.to_i] > 9 && FG7_JRPG_MP_Levels::Variables::MaxMP9 == true; $game_variables[mp_level_3_usage.to_i] = 9; else; $game_variables[mp_level_3_usage.to_i] = $game_variables[mp_level_3_usage.to_i].round; end
        if $game_variables[mp_level_4_usage.to_i] > 9 && FG7_JRPG_MP_Levels::Variables::MaxMP9 == true; $game_variables[mp_level_4_usage.to_i] = 9; else; $game_variables[mp_level_4_usage.to_i] = $game_variables[mp_level_4_usage.to_i].round; end
      end
      # Increment the count by +1 in the loop (For next party member)
      a_1 += 1
    end
  end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This is a super class of all windows within the game.
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Override Method: Draw MP
  #--------------------------------------------------------------------------
  def draw_actor_mp(actor, x, y, width = 124)
    @actor = actor
    return if @actor.nil?
    # Checks if Module Variable is True or False (To Remove MP Gauge)
    if FG7_JRPG_MP_Levels::Variables::RemoveMPGauge == false
      draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
    end
    # Checks if Module Variable is True (To adjust MP level position)
    if FG7_JRPG_MP_Levels::Variables::MaxMP9 == true
      # Draws Actors MP Levels
      draw_text(x + 29, y, 350, line_height, $game_party.send("actor_mp_levels_actor#{@actor.id}")[0])
      draw_text(x + 58, y, 350, line_height, $game_party.send("actor_mp_levels_actor#{@actor.id}")[1])
      draw_text(x + 87, y, 350, line_height, $game_party.send("actor_mp_levels_actor#{@actor.id}")[2])
      draw_text(x + 114, y, 350, line_height, $game_party.send("actor_mp_levels_actor#{@actor.id}")[3])
      # Draws Dividers for MP Levels
      draw_text(x + 43, y, 350, line_height, "/")
      draw_text(x + 72, y, 350, line_height, "/")
      draw_text(x + 101, y, 350, line_height, "/")
    else
      # Draws Actors MP Levels
      draw_text(x - 309, y, 350, line_height, $game_party.send("actor_mp_levels_actor#{@actor.id}")[0], 2)
      draw_text(x - 280, y, 350, line_height, $game_party.send("actor_mp_levels_actor#{@actor.id}")[1], 2)
      draw_text(x - 251, y, 350, line_height, $game_party.send("actor_mp_levels_actor#{@actor.id}")[2], 2)
      draw_text(x - 223, y, 350, line_height, $game_party.send("actor_mp_levels_actor#{@actor.id}")[3], 2)
      # Draws Dividers for MP Levels
      draw_text(x + 41, y, 350, line_height, "/")
      draw_text(x + 70, y, 350, line_height, "/")
      draw_text(x + 99, y, 350, line_height, "/")
    end
    change_color(system_color)
    draw_text(x, y, 30, line_height, Vocab::mp_a)
  end
  #--------------------------------------------------------------------------
  # * New Method: Draw Item Name Trim (For Skill List Names)
  #     enabled : Enabled flag. When false, draw semi-transparently.
  #--------------------------------------------------------------------------
  def draw_item_name_trim(item, x, y, enabled = true, width = 172)
    return unless item
    draw_icon(item.icon_index, x, y, enabled)
    change_color(normal_color, enabled)
    # Removes LV1/LV2/LV3/LV4 from all Skill names
    draw_text(x + 24, y, width, line_height, item.name.tr('LV1', '').tr('LV2', '').tr('LV3', '').tr('LV4', '').strip)
  end
end

#==============================================================================
# ** Window_SkillList
#------------------------------------------------------------------------------
#  This window is for displaying a list of available skills on the skill window.
#==============================================================================

class Window_SkillList < Window_Selectable
  #--------------------------------------------------------------------------
  # * Override Method: Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    if skill
      rect = item_rect(index)
      rect.width -= 4
      # Draws Item Name Trim (New) - Only one item name will be used
      draw_item_name_trim(skill, rect.x, rect.y, enable?(skill)) if FG7_JRPG_MP_Levels::Variables::RemoveSkill_LV_Name == true
      # Draws Item Name - Only one item name will be used
      draw_item_name(skill, rect.x, rect.y, enable?(skill)) if FG7_JRPG_MP_Levels::Variables::RemoveSkill_LV_Name == false
      draw_skill_cost(rect, skill)
    end
  end
  #--------------------------------------------------------------------------
  # * Override Method: Get Activation State of Selection Item
  #--------------------------------------------------------------------------
  def current_item_enabled?
    enable?(@data[index])
    item = @data[index]
    return false unless enable?(item)
    actor = @actor
    # Checks if Skill Name matches "LV1"
    if item.name.match("LV1")
      $game_party.send("actor_mp_levels_actor#{@actor.id}")[0] -= FG7_JRPG_MP_Levels::Variables::MP_Consumption
    # Checks if Skill Name matches "LV2"
    else if item.name.match("LV2")
      $game_party.send("actor_mp_levels_actor#{@actor.id}")[1] -= FG7_JRPG_MP_Levels::Variables::MP_Consumption
    # Checks if Skill Name matches "LV3"
    else if item.name.match("LV3")
      $game_party.send("actor_mp_levels_actor#{@actor.id}")[2] -= FG7_JRPG_MP_Levels::Variables::MP_Consumption
    # Checks if Skill Name matches "LV4"
    else if item.name.match("LV4")
      $game_party.send("actor_mp_levels_actor#{@actor.id}")[3] -= FG7_JRPG_MP_Levels::Variables::MP_Consumption
    end end end end
  end
  #--------------------------------------------------------------------------
  # * Override Method: Display Skill in Active State?
  #--------------------------------------------------------------------------
  def enable?(item)
    @actor && @actor.usable?(item)
    return false unless @actor && @actor.usable?(item)
    actor = @actor
    # Creates MP level variables that contains the correct game variable #
    mp_level_1 = $game_party.send("actor_mp_levels_actor#{@actor.id}")[0]
    mp_level_2 = $game_party.send("actor_mp_levels_actor#{@actor.id}")[1]
    mp_level_3 = $game_party.send("actor_mp_levels_actor#{@actor.id}")[2]
    mp_level_4 = $game_party.send("actor_mp_levels_actor#{@actor.id}")[3]
    # Return true if Item Name matches "LV1"
    return true if item.name.match("LV1") and mp_level_1 >= 1
    # Return true if Item Name matches "LV2"
    return true if item.name.match("LV2") and mp_level_2 >= 1
    # Return true if Item Name matches "LV3"
    return true if item.name.match("LV3") and mp_level_3 >= 1
    # Return true if Item Name matches "LV4"
    return true if item.name.match("LV4") and mp_level_4 >= 1
  end
  #--------------------------------------------------------------------------
  # * Override Method: Draw Skill Use Cost
  #--------------------------------------------------------------------------
  def draw_skill_cost(rect, skill)
    # Checks if Skill Name matches "LV1"
    if skill.name.match("LV1")
      draw_text(rect, $game_party.send("actor_mp_levels_actor#{@actor.id}")[0], 2)
    end
    # Checks if Skill Name matches "LV2"
    if skill.name.match("LV2")
      draw_text(rect, $game_party.send("actor_mp_levels_actor#{@actor.id}")[1], 2)
    end
    # Checks if Skill Name matches "LV3"
    if skill.name.match("LV3")
      draw_text(rect, $game_party.send("actor_mp_levels_actor#{@actor.id}")[2], 2)
    end
    # Checks if Skill Name matches "LV4"
    if skill.name.match("LV4")
      draw_text(rect, $game_party.send("actor_mp_levels_actor#{@actor.id}")[3], 2)
    end
  end
end

#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
#  This class performs skill screen processing. Skills are handled as items for
# the sake of process sharing.
#==============================================================================

class Scene_Skill < Scene_ItemBase
  #--------------------------------------------------------------------------
  # * Added Method: Actor [OK]
  #--------------------------------------------------------------------------
  def on_actor_ok
    # Creates MP level variables that contains the correct game variable #
    mp_level_1_usage = $game_party.send("actor_mp_levels_actor#{@actor.id}")[4]
    mp_level_2_usage = $game_party.send("actor_mp_levels_actor#{@actor.id}")[5]
    mp_level_3_usage = $game_party.send("actor_mp_levels_actor#{@actor.id}")[6]
    mp_level_4_usage = $game_party.send("actor_mp_levels_actor#{@actor.id}")[7]
    if item_usable?
      empty = false
      # Checks for Skill "LV1"
      if item.name.match("LV1")
        $game_variables[mp_level_1_usage.to_i] > 0 ? $game_variables[mp_level_1_usage.to_i] -= FG7_JRPG_MP_Levels::Variables::MP_Consumption : empty = true
        $game_variables[mp_level_1_usage.to_i] = 0 if $game_variables[mp_level_1_usage.to_i] < 0
      end
      # Checks for Skill "LV2"
      if item.name.match("LV2")
        $game_variables[mp_level_2_usage.to_i] > 0 ? $game_variables[mp_level_2_usage.to_i] -= FG7_JRPG_MP_Levels::Variables::MP_Consumption : empty = true
        $game_variables[mp_level_2_usage.to_i] = 0 if $game_variables[mp_level_2_usage.to_i] < 0
      end
      # Checks for Skill "LV3"
      if item.name.match("LV3")
        $game_variables[mp_level_3_usage.to_i] > 0 ? $game_variables[mp_level_3_usage.to_i] -= FG7_JRPG_MP_Levels::Variables::MP_Consumption : empty = true
        $game_variables[mp_level_3_usage.to_i] = 0 if $game_variables[mp_level_3_usage.to_i] < 0
      end
      # Checks for Skill "LV4"
      if item.name.match("LV4")
        $game_variables[mp_level_4_usage.to_i] > 0 ? $game_variables[mp_level_4_usage.to_i] -= FG7_JRPG_MP_Levels::Variables::MP_Consumption : empty = true
        $game_variables[mp_level_4_usage.to_i] = 0 if $game_variables[mp_level_4_usage.to_i] < 0
      end
      # Checks if empty
      if empty == true
        Sound.play_buzzer
      else
        use_item
        @item_window.refresh
      end
    else
      Sound.play_buzzer
    end
  end
end

#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
#  This window is for displaying the status of party members on the battle
# screen.
#==============================================================================

class Window_BattleStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # * Override Method: Draw Gauge Area (with TP)
  #--------------------------------------------------------------------------
  def draw_gauge_area_with_tp(rect, actor)
    # Removed TP for MP levels if "Display TP in Battle" is turned on
    draw_actor_hp(actor, rect.x + 0, rect.y, 72)
    draw_actor_mp(actor, rect.x + 82, rect.y, 64)
  end
  #--------------------------------------------------------------------------
  # * Override Method: Draw Gauge Area (without TP)
  #--------------------------------------------------------------------------
  def draw_gauge_area_without_tp(rect, actor)
    draw_actor_hp(actor, rect.x + 0, rect.y, 72)
    draw_actor_mp(actor, rect.x + 82, rect.y, 64)
  end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Override Method: To Previous Command Input
  #--------------------------------------------------------------------------
  def prior_command
    if BattleManager.prior_command
      # Creates MP level variables that contains the correct game variable #
      mp_level_1_usage = $game_party.send("actor_mp_levels_actor#{BattleManager.actor.id}")[4]
      mp_level_2_usage = $game_party.send("actor_mp_levels_actor#{BattleManager.actor.id}")[5]
      mp_level_3_usage = $game_party.send("actor_mp_levels_actor#{BattleManager.actor.id}")[6]
      mp_level_4_usage = $game_party.send("actor_mp_levels_actor#{BattleManager.actor.id}")[7]
      # Variable created for Loop (Party Member 1-6)
      a_1 = 0; a_2 = 5;
      # Loop through variables until complete
      while a_1 < a_2 do
        # Skill "LV1" - Check if Party Member and conditions are met
        if $game_party.members[a_1] && BattleManager.actor.name == $game_party.members[a_1].name && $game_switches[976 + a_1] == true
          # Re-add the Skill MP consumption back to Party Member
          $game_variables[mp_level_1_usage.to_i] += FG7_JRPG_MP_Levels::Variables::MP_Consumption; $game_switches[976 + a_1] = false
        end
        # Increment the count by +1 in the loop (For next party member)
        a_1 += 1
      end
      # Reset loop variable
      a_1 = 0
      # Loop through variables until complete
      while a_1 < a_2 do
        # Skill "LV2" - Check if Party Member and conditions are met
        if $game_party.members[a_1] && BattleManager.actor.name == $game_party.members[a_1].name && $game_switches[982 + a_1] == true
          # Re-add the Skill MP consumption back to Party Member
          $game_variables[mp_level_2_usage.to_i] += FG7_JRPG_MP_Levels::Variables::MP_Consumption; $game_switches[982 + a_1] = false
        end
        # Increment the count by +1 in the loop (For next party member)
        a_1 += 1
      end
      # Reset loop variable
      a_1 = 0
      # Loop through variables until complete
      while a_1 < a_2 do
        # Skill "LV3" - Check if Party Member and conditions are met
        if $game_party.members[a_1] && BattleManager.actor.name == $game_party.members[a_1].name && $game_switches[988 + a_1] == true
          # Re-add the Skill MP consumption back to Party Member
          $game_variables[mp_level_3_usage.to_i] += FG7_JRPG_MP_Levels::Variables::MP_Consumption; $game_switches[988 + a_1] = false
        end
        # Increment the count by +1 in the loop (For next party member)
        a_1 += 1
      end
      # Reset loop variable
      a_1 = 0
      # Loop through variables until complete
      while a_1 < a_2 do
        # Skill "LV4" - Check if Party Member and conditions are met
        if $game_party.members[a_1] && BattleManager.actor.name == $game_party.members[a_1].name && $game_switches[994 + a_1] == true
          # Re-add the Skill MP consumption back to Party Member
          $game_variables[mp_level_4_usage.to_i] += FG7_JRPG_MP_Levels::Variables::MP_Consumption; $game_switches[994 + a_1] = false
        end
        # Increment the count by +1 in the loop (For next party member)
        a_1 += 1
      end
      start_actor_command_selection
    else
      start_party_command_selection
    end
  end
  #--------------------------------------------------------------------------
  # * New Method: Skill MP LVL Check
  #--------------------------------------------------------------------------
  def skill_mp_lvl_check
    # Checks when the skill has been selected
    case @actor_command_window.current_symbol
    when :skill
      mp_level_1_usage = $game_party.send("actor_mp_levels_actor#{BattleManager.actor.id}")[4]
      mp_level_2_usage = $game_party.send("actor_mp_levels_actor#{BattleManager.actor.id}")[5]
      mp_level_3_usage = $game_party.send("actor_mp_levels_actor#{BattleManager.actor.id}")[6]
      mp_level_4_usage = $game_party.send("actor_mp_levels_actor#{BattleManager.actor.id}")[7]
      @skill = @skill_window.item
      # Variable created for Loop (Party Member 1-6)
      a_1 = 0; a_2 = 5
      # Checks for Skill "LV1"
      if @skill.name.match("LV1")
        while a_1 < a_2 do
          # Game Switch equals true if Party Member matches
          $game_switches[976 + a_1] = true if $game_party.members[a_1] && BattleManager.actor.name == $game_party.members[a_1].name
          a_1 += 1 # Increment loop +1
        end
        # Consume Skill MP from Party Member
        $game_variables[mp_level_1_usage.to_i] -= FG7_JRPG_MP_Levels::Variables::MP_Consumption
        $game_variables[mp_level_1_usage.to_i] = 0 if $game_variables[mp_level_1_usage.to_i] < 0
      end
      # Reset loop variable
      a_1 = 0
      # Checks for Skill "LV2"
      if @skill.name.match("LV2")
        while a_1 < a_2 do
          # Game Switch equals true if Party Member matches
          $game_switches[982 + a_1] = true if $game_party.members[a_1] && BattleManager.actor.name == $game_party.members[a_1].name
          a_1 += 1 # Increment loop +1
        end
        # Consume Skill MP from Party Member
        $game_variables[mp_level_2_usage.to_i] -= FG7_JRPG_MP_Levels::Variables::MP_Consumption
        $game_variables[mp_level_2_usage.to_i] = 0 if $game_variables[mp_level_1_usage.to_i] < 0
      end
      # Reset loop variable
      a_1 = 0
      # Checks for Skill "LV3"
      if @skill.name.match("LV3")
        while a_1 < a_2 do
          # Game Switch equals true if Party Member matches
          $game_switches[988 + a_1] = true if $game_party.members[a_1] && BattleManager.actor.name == $game_party.members[a_1].name
          a_1 += 1 # Increment loop +1
        end
        # Consume Skill MP from Party Member
        $game_variables[mp_level_3_usage.to_i] -= FG7_JRPG_MP_Levels::Variables::MP_Consumption
        $game_variables[mp_level_3_usage.to_i] = 0 if $game_variables[mp_level_1_usage.to_i] < 0
      end
      # Reset loop variable
      a_1 = 0
      # Checks for Skill "LV4"
      if @skill.name.match("LV4")
        while a_1 < a_2 do
          # Game Switch equals true if Party Member matches
          $game_switches[994 + a_1] = true if $game_party.members[a_1] && BattleManager.actor.name == $game_party.members[a_1].name
          a_1 += 1 # Increment loop +1
        end
        # Consume Skill MP from Party Member
        $game_variables[mp_level_4_usage.to_i] -= FG7_JRPG_MP_Levels::Variables::MP_Consumption
        $game_variables[mp_level_4_usage.to_i] = 0 if $game_variables[mp_level_1_usage.to_i] < 0
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Override Method: Actor [OK]
  #--------------------------------------------------------------------------
  def on_actor_ok
    BattleManager.actor.input.target_index = @actor_window.index
    skill_mp_lvl_check # Call method to decrease skill MP
    @actor_window.hide
    @skill_window.hide
    @item_window.hide
    next_command
  end
  #--------------------------------------------------------------------------
  # * Override Method: Skill [OK]
  #--------------------------------------------------------------------------
  def on_skill_ok
    @skill = @skill_window.item
    BattleManager.actor.input.set_skill(@skill.id)
    BattleManager.actor.last_skill.object = @skill
    if !@skill.need_selection?
      skill_mp_lvl_check # Call method to decrease skill MP
      @skill_window.hide
      next_command
    elsif @skill.for_opponent?
      select_enemy_selection
    else
      select_actor_selection
    end
  end
  #--------------------------------------------------------------------------
  # * Alias Method: End Turn
  #--------------------------------------------------------------------------
  alias :fg7_jrpg_mp_levels_turn_end :turn_end
  def turn_end
    fg7_jrpg_mp_levels_turn_end
    # Runs through the game variables to set to "false" for start of new turn
    24.times do |i|
      $game_switches[i + 976] = false
    end
  end
end

FAQ
Q: My party member has a death state (dead) and the MP is not restored when using the script call. How can I fix?
A: This is by design and I have no plans to change this feature. Feel free to modify the script to your liking - Credit still required.

Q: I have 8 actors in my party, why does it not work for 2 of them?
A: I have designed the script similar to Suikoden 1 & 2 - So, the party member size is supported up to 6 members. Feel free to modify the script to your liking - Credit still required.

Q: I cannot get the script to work. Can you help?
A: Please read the script header in full detail before requesting help. I will do my best to help within reason.

Q: Do you plan to add more enhancements or taking request for enhancements?
A: I am not. The script is provided as-is. I will look to fix any bugs if required, but nothing beyond that.

Terms of Use
- Free to use in non-commercial projects and commercial projects
- Feel free to modify and improve the script. Credit is still required.
- Credit FamilyGamer7

Special Thanks
To the RM community for the assistance.
- Specifically: Roninator2, TheoAllen and A-Moonless-Night
 

Latest Threads

Latest Profile Posts

Two NPCs blinking animations in VNMaker and two to go. Some progress!
Fun Fact: My last two projects (Fursona and A Postmortem Nation) were released before I could do post-completion playtesting because I got so excited and happy I released them on the spot. Sometimes I have rubbish impulse control. smh
Circle, circle, dot, dot... I got my first COVID shot! And I barely felt it, which shocked me. Usually having Autism causes my sense of touch to be amplified! I go for my second dose in June.
Another update, this time on moving. I got the keys to my apartment today, but it was poorly cleaned/repaired. They're working on it, don't worry!
:kaojoy:I just saw 2 players reached 10 hours.
The game is totally not for cult recruitment. As of yet, we have not summoned Cthulhu.
Unfortunately, besides that, many issues still need to be fixed for more common fellows.
To at least pretend everything is normal here. :kaoswt2:

Forum statistics

Threads
111,308
Messages
1,060,079
Members
144,629
Latest member
petebooh
Top