MV I tried making singular ATB Visual Gauge for actor&enemies, need help.
BMM Archive · July 15, 2026
Original Source
- Original title: MV I tried making singular ATB Visual Gauge for actor&enemies, need help.
- Original author: EF2L
- Original date: December 6, 2024
- Source thread: https://forums.rpgmakerweb.com/threads/i-tried-making-singular-atb-visual-gauge-for-actor-enemies-need-help.173702/
- Source forum path: Game Development Engines > RPG Maker Javascript Plugins > Learning Javascript
Summary
Hello everyone, as the title said I tried making a custom ATB Gauge, there's already a good plugin to show both actor&enemies in one gauge like DoubleX's (but I can't figure out how to use it, so I tried making one, haha) This plugin is dependent on YEP_BattleEngineCore& YEP_X_BattleSysATB I used the image from img/characters/ to pick as battlerIcon, the current state of the plugin is still barebone (you can insert image to replace that blackline later) right now I'm stuck in figuring out how to make the sprite that...
Archived First Post
This plugin is dependent on YEP_BattleEngineCore& YEP_X_BattleSysATB
I used the image from img/characters/ to pick as battlerIcon, the current state of the plugin is still barebone (you can insert image to replace that blackline later) right now I'm stuck in figuring out how to make the sprite that has more gauge covering the one behind with less gauge.
1. ATB Gauge (Can replace with Image)
2. Battler goes from top to bottom as their ATB bar is filled
3. I added a stop gap when actor ATB bar is full and it's their turn at around 70% of the bar, then the remaining 30% is to show the ATB charge.
As you can see from the screenshot, the sprite layer priority(z-index?) is a mess, I think this is because how sprite coded, the one that is created first always stays on top of the others.
So, the question is if anyone knows how to add a condition that enable the sprite order being based on whoever has the most ATB fill rate?
Here's the messy plugin below (I can't figure out how to make a small sized demo)
/*:
* @plugindesc Make a customizable Vertical ATB Gauge display with Turn and Charging having their own section for Battle. Supports custom enemy/actor icons via notetags.
* @author EF2L
*
* @help
* This plugin displays a vertical ATB line for battlers during combat.
* - Battlers' icons move from 0% to 70% for regular ATB.
* - During the charging state, icons move from 70% to 100%.
*
* === Notetag Usage ===
* Use the following notetags in database entries:
* For actors: <actorIcon: ["FileName", X, Y]>
* For enemies: <battlerIcon: ["FileName", X, Y]>
* - FileName: The character file in img/characters (without extension).
* - X: Horizontal coordinate of the icon on the spritesheet.
* - Y: Vertical coordinate of the icon on the spritesheet.
*
* If no notetag is provided, default values will be used.
*/
(() => {
const iconWidth = 48;
const iconHeight = 48;
const defaultEnemyIconFile = 'Monster';
const defaultEnemyIconX = 0;
const defaultEnemyIconY = 0;
// Define ATB Line Sprite
class Sprite_ATBLine extends Sprite {
constructor() {
const bitmap = new Bitmap(32, 240);
super(bitmap);
this.updateDimensions();
}
updateDimensions() {
this.bitmap.clear();
this.bitmap.fillRect(8, 0, 8, 240, '#000000');
this.x = Graphics.width - 98;
this.y = 48;
}
}
// Define Battler Icon Sprite
class Sprite_BattlerIcon extends Sprite {
constructor(battler, lineSprite) {
super();
this._battler = battler;
this._lineSprite = lineSprite;
this.bitmap = this.loadBattlerIcon();
this.updatePosition();
}
loadBattlerIcon() {
const metaTag = this._battler.isEnemy()
? this._battler.enemy().meta.battlerIcon
: this._battler.actor().meta.actorIcon;
if (metaTag) {
try {
const [fileName, x, y] = JSON.parse(metaTag);
return this.createIconBitmap(fileName, x, y, iconWidth, iconHeight);
} catch (e) {
console.error('Invalid icon metadata format:', metaTag, e);
}
}
if (this._battler.isEnemy()) {
return this.createIconBitmap(defaultEnemyIconFile, defaultEnemyIconX, defaultEnemyIconY, iconWidth, iconHeight);
}
if (this._battler.isActor()) {
const fileName = this._battler.characterName();
const index = this._battler.characterIndex();
const x = index % 4;
const y = Math.floor(index / 4);
return this.createIconBitmap(fileName, x, y, iconWidth, iconHeight);
}
return null;
}
createIconBitmap(fileName, x, y, width, height) {
const bitmap = ImageManager.loadCharacter(fileName);
const iconBitmap = new Bitmap(width, height);
iconBitmap.blt(bitmap, x * width, y * height, width, height, 0, 0, width, height);
return iconBitmap;
}
calculateProgress() {
const atbRate = this._battler.atbRate();
const chargingRate = this._battler.atbChargeRate();
if (this._battler.isATBCharging()) {
return 0.7 + (chargingRate * 0.3);
} else {
return atbRate * 0.7;
}
}
updatePosition() {
const progress = this.calculateProgress();
const offsetX = this._battler.isEnemy() ? -50 : 50;
this.x = this._lineSprite.x + 12 - iconWidth / 2 + offsetX;
this.y = this._lineSprite.y + progress * 240 - iconHeight / 2;
}
update() {
super.update();
this.updatePosition();
}
}
// New sprite for the Gauge_VLine image centered on the ATB Line
class Sprite_GaugeVLine extends Sprite {
constructor(lineSprite) {
super();
this._lineSprite = lineSprite;
this.bitmap = ImageManager.loadPicture('Gauge_VLine'); // Load Gauge_VLine.png
this.updatePosition();
}
updatePosition() {
// Position the Gauge sprite in the center of the ATB line
this.x = this._lineSprite.x - (this.bitmap.width / 2) + 12; // Center the sprite horizontally on the ATB line
this.y = this._lineSprite.y; // Align it with the top of the ATB line
}
update() {
super.update();
this.updatePosition();
}
}
// Modify Spriteset_Battle to Include ATB Line and Gauge
const _Spriteset_Battle_initialize = Spriteset_Battle.prototype.initialize;
Spriteset_Battle.prototype.initialize = function () {
_Spriteset_Battle_initialize.call(this);
// Initialize the battler icons array
this._battlerIcons = [];
// Add ATB line
this._atbLine = new Sprite_ATBLine();
this._baseSprite.addChild(this._atbLine);
// Add the new Gauge_VLine sprite
this._gaugeVLine = new Sprite_GaugeVLine(this._atbLine);
this._baseSprite.addChild(this._gaugeVLine);
// Add battler icons
const allBattlers = $gameParty.battleMembers().concat($gameTroop.members());
for (const battler of allBattlers) {
this.addBattlerIcon(battler);
}
};
Spriteset_Battle.prototype.addBattlerIcon = function (battler) {
const iconSprite = new Sprite_BattlerIcon(battler, this._atbLine);
this._battlerIcons.push(iconSprite);
this._baseSprite.addChild(iconSprite);
};
const _Spriteset_Battle_update = Spriteset_Battle.prototype.update;
Spriteset_Battle.prototype.update = function () {
_Spriteset_Battle_update.call(this);
// Update ATB line and Gauge sprite
if (this._atbLine) this._atbLine.updateDimensions();
if (this._gaugeVLine) this._gaugeVLine.update();
// Check and update battler icons, remove defeated ones, and re-add revived ones
if (this._battlerIcons) {
this._battlerIcons = this._battlerIcons.filter(icon => {
const battler = icon._battler;
if (battler.isDead()) {
this._baseSprite.removeChild(icon);
return false;
}
icon.update();
return true;
});
// Check for revived battlers
const allBattlers = $gameParty.battleMembers().concat($gameTroop.members());
for (const battler of allBattlers) {
const hasIcon = this._battlerIcons.some(icon => icon._battler === battler);
if (!hasIcon && !battler.isDead()) {
this.addBattlerIcon(battler);
}
}
}
};
})();
Downloads / Referenced Files
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadCreator Claims / Removal
If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.
Replies (0)
No replies yet.
Topic Summary
Loading summary...