DoubleX RMVXA Enemy MP/TP Bars Addon to Yanfly Engine Ace - Ace Battle Engine


DoubleX RMVXA Enemy MP/TP Bars Addon v1.03b to Yanfly Engine Ace - Ace Battle Engine
by DoubleX​

Note
This script is extremely similar to Yanfly Engine Ace - Battle Engine Add-On: Enemy HP Bars so crediting DoubleX or his alias will violate this script's terms of use.

Prerequisites
Yanfly Engine Ace - Ace Battle Engine(Created by Yanfly)

Introduction
Displays the enemy mp or/and tp bars

Spoiler
Ruby:
#==============================================================================|
# ** Mp bar notetags                                                           |
#------------------------------------------------------------------------------|
# * Notetag <hide mp gauge>, <show mp gauge>                                   |
#   Hides or shows mp gauge for that enemy in battle. The guage appear whenever|
#   that enemy is targeted for battle or taking mp damage. Using the latter    |
#   will bypass the requirement for needing to defeat that enemy once.         |
#------------------------------------------------------------------------------|
# * Notetag: <back mp gauge: x>                                                |
#   Sets the colour of that enemy's mp back gauge of to text color x.          |
#------------------------------------------------------------------------------|
# * Notetag <mp gauge 1: x>, <mp gauge 2: x>                                   |
#   Sets the colour 1 and 2 of that enemy's mp gauge to text color x.          |
#------------------------------------------------------------------------------|
# * Notetag <mp display: x>                                                    |
#   Displays that enemy's mp in the form of:                                   |
#   Don't display if x is 0                                                    |
#   Percentage if x is 1                                                       |
#   Actual number if x is 2                                                    |
#==============================================================================|
# ** Tp bar notetags                                                           |
#------------------------------------------------------------------------------|
# * Notetag <hide tp gauge>, <show tp gauge>                                   |
#   Hides or shows tp gauge for that enemy in battle. The guage appear whenever|
#   that enemy is targeted for battle or taking tp damage. Using the latter    |
#   will bypass the requirement for needing to defeat that enemy once.         |
#------------------------------------------------------------------------------|
# * Notetag: <back tp gauge: x>                                                |
#   Sets the colour of that enemy's tp back gauge of to text color x.          |
#------------------------------------------------------------------------------|
# * Notetag <tp gauge 1: x>, <tp gauge 2: x>                                   |
#   Sets the colour 1 and 2 of that enemy's tp gauge to text color x.          |
#------------------------------------------------------------------------------|
# * Notetag <tp display: x>                                                    |
#   Displays that enemy's tp in the form of:                                   |
#   Don't display if x is 0                                                    |
#   Percentage if x is 1                                                       |
#   Actual number if x is 2                                                    |
#------------------------------------------------------------------------------|

#==============================================================================|
#  ** You only need to edit this part as it's about what this script does      |
#------------------------------------------------------------------------------|

module DoubleX_RMVXA
  module YEA_BattleEngine_Enemy_MP_TP_Bars_Addon

#------------------------------------------------------------------------------|
#  * MP Bars                                                                   |
#------------------------------------------------------------------------------|

    # SHOW_ENEMY_MP_GAUGE, default = true
    # Show the enemy mp gauge if SHOW_ENEMY_MP_GAUGE is true
    SHOW_ENEMY_MP_GAUGE = true

    # ANIMATE_MP_GAUGE, default = true
    # Animate the enemy mp gauge if ANIMATE_MP_GAUGE is true
    ANIMATE_MP_GAUGE = true

    # MP_DEFEAT_ENEMIES_FIRST, default = false
    # Show the enemy mp gauge only if it's been defeated before
    MP_DEFEAT_ENEMIES_FIRST = false

    # ENEMY_MP_GAUGE_WIDTH, ENEMY_MP_GAUGE_HEIGHT, default = 80, 20
    # Sets the enemy mp gauge width and height as ENEMY_MP_GAUGE_WIDTH and
    # ENEMY_MP_GAUGE_HEIGHT respectively
    ENEMY_MP_GAUGE_WIDTH = 48
    ENEMY_MP_GAUGE_HEIGHT = 12

    # ENEMY_MP_GAUGE_COLOUR1, ENEMY_MP_GAUGE_COLOUR2, default = 22, 23
    # Sets the colour 1 and colour 2 of the enemy mp gauge as
    # ENEMY_MP_GAUGE_COLOUR1 and ENEMY_MP_GAUGE_COLOUR2 respectively
    ENEMY_MP_GAUGE_COLOUR1 = 22
    ENEMY_MP_GAUGE_COLOUR2 = 23

    # ENEMY_MP_BACKGAUGE_COLOUR, default = 15
    # Sets the enemy mp back gauge colour as ENEMY_MP_BACK_GAUGE_COLOUR
    ENEMY_MP_BACKGAUGE_COLOUR = 15

    # ENEMY_MP_DISPLAY, default = 2
    # Display the enemy's mp in the form of:
    # Don't display if 0
    # Percentage if 1
    # Actual number if 2
    ENEMY_MP_DISPLAY = 2

    # (v1.03a+)MP_PERCENTAGE_DECIMAL_DIGHT_NUMBER, default = 0
    # Sets the number of decimal digits when showing mp percentages
    MP_PERCENTAGE_DECIMAL_DIGHT_NUMBER = 0

    # MP_TEXT_SIZE, default = ENEMY_MP_GAUGE_HEIGHT
    # Sets the size of the text shown on enemy mp bars as MP_TEXT_SIZE
    MP_TEXT_SIZE = ENEMY_MP_GAUGE_HEIGHT + 4

    # (v1.00b+)FIX_LARGE_MP_TEXT, default = false
    # Fixes issues when MP_TEXT_SIZE is much larger than ENEMY_MP_GAUGE_HEIGHT
    FIX_LARGE_MP_TEXT = false

    # (v1.02a+)MP_CRISIS_TEXT_COLOR, default = 17
    # Sets the mp text color with mp crisis as MP_CRISIS_TEXT_COLOR
    MP_CRISIS_TEXT_COLOR = 17

    # (v1.01a+)MP_TEXT_COLOR, default = 16
    # Sets the mp text color as MP_TEXT_COLOR
    MP_TEXT_COLOR = 0

    # (v1.01a+)MP_TEXT_X_OFFSET, MP_TEXT_Y_OFFSET, default = 0, 0
    # Sets the x and y offsets of the mp text relative to the mp bar
    MP_TEXT_X_OFFSET = 0
    MP_TEXT_Y_OFFSET = 0

#------------------------------------------------------------------------------|
#  * TP Bars                                                                   |
#------------------------------------------------------------------------------|

    # SHOW_ENEMY_TP_GAUGE, default = true
    # Show the enemy tp gauge if SHOW_ENEMY_TP_GAUGE is true
    SHOW_ENEMY_TP_GAUGE = true

    # ANIMATE_TP_GAUGE, default = true
    # Animate the enemy mp gauge if ANIMATE_TP_GAUGE is true
    ANIMATE_TP_GAUGE = true

    # TP_DEFEAT_ENEMIES_FIRST, default = false
    # Show the enemy tp gauge only if it's been defeated before
    TP_DEFEAT_ENEMIES_FIRST = false

    # ENEMY_TP_GAUGE_WIDTH, ENEMY_TP_GAUGE_HEIGHT, default = 80, 20
    # Sets the enemy tp gauge width and height as ENEMY_TP_GAUGE_WIDTH and
    # ENEMY_TP_GAUGE_HEIGHT respectively
    ENEMY_TP_GAUGE_WIDTH = 48
    ENEMY_TP_GAUGE_HEIGHT = 12

    # ENEMY_TP_GAUGE_COLOUR1, ENEMY_TP_GAUGE_COLOUR2, default = 20, 21
    # Sets the colour 1 and colour 2 of the enemy tp gauge as
    # ENEMY_TP_GAUGE_COLOUR1 and ENEMY_TP_GAUGE_COLOUR2 respectively
    ENEMY_TP_GAUGE_COLOUR1 = 20
    ENEMY_TP_GAUGE_COLOUR2 = 21

    # ENEMY_TP_BACKGAUGE_COLOUR, default = 15
    # Sets the enemy tp back gauge colour as ENEMY_TP_BACK_GAUGE_COLOUR
    ENEMY_TP_BACKGAUGE_COLOUR = 15

    # ENEMY_TP_DISPLAY, default = 2
    # Display the enemy's tp in the form of:
    # Don't display if 0
    # Percentage if 1
    # Actual number if 2
    ENEMY_TP_DISPLAY = 2

    # (v1.03a+)TP_PERCENTAGE_DECIMAL_DIGHT_NUMBER, default = 0
    # Sets the number of decimal digits when showing tp percentages
    TP_PERCENTAGE_DECIMAL_DIGHT_NUMBER = 0

    # TP_TEXT_SIZE, default = ENEMY_TP_GAUGE_HEIGHT
    # Sets the size of the text shown on enemy mp bars as TP_TEXT_SIZE
    TP_TEXT_SIZE = ENEMY_TP_GAUGE_HEIGHT + 4

    # (v1.00b+)FIX_LARGE_MP_TEXT, default = false
    # Fixes issues when MP_TEXT_SIZE is much larger than ENEMY_MP_GAUGE_HEIGHT
    FIX_LARGE_TP_TEXT = false

    # (v1.01a+)TP_TEXT_COLOR, default = 16
    # Sets the tp text color as TP_TEXT_COLOR
    TP_TEXT_COLOR = 0

    # (v1.01a+)TP_TEXT_X_OFFSET, TP_TEXT_Y_OFFSET, default = 0, 0
    # Sets the x and y offsets of the tp text relative to the tp bar
    TP_TEXT_X_OFFSET = 0
    TP_TEXT_Y_OFFSET = 0

#==============================================================================|

Video


Features
Almost no scripting knowledge is needed to use this script(some is needed to edit it)

How to use
Open the script editor and put this script into an open slot between the script Yanfly Engine Ace - Ace Battle Engine and Main. Save to take effect.

FAQ
None

Credit and Thanks
Yanfly for Yanfly Engine Ace - Battle Engine Add-On: Enemy HP Bars
The terms of use are the same as that of Yanfly Engine Ace - Ace Battle Engine except that you're not allowed to give DoubleX or his alias credit

Compatibility
Same as that of Yanfly Engine Ace - Ace Battle Engine

Changelog
v1.03b(GMT 1000 21-5-2023):
- Fixed not updating the enemy mp and tp bars when their mp and tp becomes 0 respectively
v1.03a(GMT 1000 10-10-2022):
- Added MP_PERCENTAGE_DECIMAL_DIGHT_NUMBER and TP_PERCENTAGE_DECIMAL_DIGHT_NUMBER
v1.02b(GMT 1000 21-5-2016):
- Fixed not updating mp/tp bar fill ratio for mp/tp change on battle start
- If mmp is 0, the mp bar will be fully filled to show the mmp is 0
v1.02a(GMT 0200 6-4-2015):
- Added MP_CRISIS_TEXT_COLOR
v1.01e(GMT 0900 14-2-2014):
- Fixed the mp and tp bars of the hidden enemies being shown bug
- Further increased efficiency and reduced lag
v1.01d(GMT 0400 4-10-2014):
- Further increased efficiency and reduced lag
v1.01c(GMT 0300 4-9-2014):
- Updated compatibility with DoubleX RMVXA Percentage Addon to Yanfly Engine Ace - Battle Engine Add-On: Enemy HP Bars
v1.01b(GMT 0500 2-9-2014):
- Further increased efficiency and reduced size of this script
- Reduced lag induced from v1.00b efficiency upgrade
v1.01a(GMT 1700 1-9-2014):
- Added mp and tp texts x and y offsets relative to respective bars
- Added MP_TEXT_COLOR and TP_TEXT_COLOR
v1.00b(GMT 1600 1-9-2014):
- Fixed undesirable results when text size > bar height
- Increased efficiency and reduced size of this script
v1.00a(GMT 0500 29-8-2014):
- 1st version of this script finished

Download Link
Hey, I was wondering how I could not have the size of the text be linked to the same height of the MP/TP gauge? The number in the gauge shrinks to being unreadable if I want the height of the gauge to be...well, anything less than 20, which is just way too big and distracting for me. Know what I can do to fix this?  🤔
Hey, I was wondering how I could not have the size of the text be linked to the same height of the MP/TP gauge? The number shrinks to being unreadable if I want the height of the gauge to be...well, anything less than 20, which is just way too big and distracting for me. Know what I can do to fix this?  🤔
MP_TEXT_SIZE = ENEMY_MP_GAUGE_HEIGHT + 4
Code:
TP_TEXT_SIZE = ENEMY_TP_GAUGE_HEIGHT + 4
MP_TEXT_SIZE and TP_TEXT_SIZE are what you want to edit. Setting them as an actual number instead of ENEMY_MP_GAUGE_HEIGHT nor ENEMY_TP_GAUGE_HEIGHT will break the dependence.

P.S.: As the current v1.00a script has 0 downloads, it seems to me that you've downloaded the earliest version before I updated the v1.00a script to correct a minor bug. So you may want to download it again 🙂
That didn't solve the problem though, and I already knew about that...otherwise I wouldn't have asked, lol. I have the gauge height currently set to 6, with the text size at 24...and well, this is what happens:

TPNumber_zpsbd7f3672.png


Just a blank bar, with the number gone.  🙁  This happens whether or not I include ENEMY_TP_GAUGE_HEIGHT.
Updates

v1.00b(GMT 1400 1-9-2014):

- Fixed undesirable results when text size > bar height

- Increased efficiency and reduced size of this script
Uh...did you remove the way to move the number on the bar? I'm glad it's not linked to it anymore, but "now" I can't seem to find where to edit its position, and changing the height of the bar doesn't change the position of the number, making it stay where it is if the bar were still at 20 height. :l
Uh...did you remove the way to move the number on the bar? I'm glad it's not linked to it anymore, but "now" I can't seem to find where to edit its position, and changing the height of the bar doesn't change the position of the number, making it stay where it is if the bar were still at 20 height. :l
Actually I use a hidden bar to draw the numbers and the height of that bar is the larger value among the bar height and text size.

The y differences between mp and tp bars are also the larger values among their bar heights and text sizes.

Maybe you'll want to actually draw your desired result here so I can understand it better 🙂
Actually I use a hidden bar to draw the numbers and the height of that bar is the larger value among the bar height and text size.

The y differences between mp and tp bars are also the larger values among their bar heights and text sizes.

Maybe you'll want to actually draw your desired result here so I can understand it better 🙂
Forgive me for asking(unless I'm not understanding it correctly), but why would you make that hidden? I mean, it'd make this a whole lot easier to do..if it were included. I could just, ya know change the number in the script(like I did in your 1.00a version, and it moved the position, it's just that the bar kept being a hindrance to the number and wouldn't show if I changed the bar's height).

And, didn't I already include what I want the bar/text to be in my previous post with the screenshot? 🤔  I want the height of the bar to be at 6, and the size of the text to be 24, only now it works, except I can't change the position of the number.  😛
Updates

v1.01a(GMT 1700 1-9-2014):

- Added mp and tp texts x and y offsets relative to respective bars

- Added MP_TEXT_COLOR and TP_TEXT_COLOR
Thanks for helping Double, I got it to work like wanted it to. 🙂
Updates

v1.01d(GMT 0400 4-10-2014):

- Further increased efficiency and reduced lag

v1.01c(GMT 0300 4-9-2014):

- Updated compatibility with DoubleX RMVXA Percentage Addon to Yanfly Engine Ace - Battle Engine Add-On: Enemy HP Bars

v1.01b(GMT 0500 2-9-2014):

- Further increased efficiency and reduced size of this script

- Reduced lag induced from v1.00b efficiency upgrade
Updates

v1.01e(GMT 0900 14-2-2014):

- Fixed the mp and tp bars of the hidden enemies being shown bug

- Further increased efficiency and reduced lag
Updates

v1.02a(GMT 0200 6-4-2015):

- Added MP_CRISIS_TEXT_COLOR
Updates


v1.02b(GMT 1000 21-5-2016):


- Fixed not updating mp/tp bar fill ratio for mp/tp change on battle start


- If mmp is 0, the mp bar will be fully filled to show the mmp is 0
Updates
v1.03a(GMT 1000 10-10-2022):
- Added MP_PERCENTAGE_DECIMAL_DIGHT_NUMBER and TP_PERCENTAGE_DECIMAL_DIGHT_NUMBER
Updates
v1.03b(GMT 1000 21-5-2023):
- Fixed not updating the enemy mp and tp bars when their mp and tp becomes 0 respectively

Original thread: https://forums.rpgmakerweb.com/threads/doublex-rmvxa-enemy-mp-tp-bars-addon-to-yanfly-engine-ace-ace-battle-engine.31561/