MV How to use the Unused portion of Damage.png spritesheet

I think instead of doing all of this roundabout work... you should probably just use a plugin if you want a specific text image to say "no damage".

TSR Pop-Ups is what I use, and it allows you to use custom images for damage numbers while also playing nice with the Yanfly suite.
And I don't think mpAffected exists?
theres no mpAffected property you can use (without making it at least) to tell if the skill called gainMp and failed to do damage.
nope. although since itd be a boolean property itd be pretty safe to set one with gainMp.

I have used the condition "isMpEffect()" in a state before, but it doesn't seem to work in a plugin. I guess that's only a Yanfly notetag thing, or I'm getting the syntax wrong somehow.
that function is for Game_Actions, not Game_ActionResults. script doesnt stop working just because its being called from a plugin
if (result.hpAffected && result.mpDamage == 0 && result.hpDamage == 0 && result.isHit()) {
All of those conditions have to be true to get your popup.
mp damage doesnt call gainHp, so hpAffected cant be true in the case of mp damage.

Spoiler
Code:
(() => {
Sprite_Damage.prototype.setup = function(target) {
    this._result = target.shiftDamagePopup();
    var result = this._result;
    if (result.missed || result.evaded) {
        this.createMiss();
    } else if (result.hpDamage !== 0) {
        this.createDigits(0, result.hpDamage);
    } else if (result.mpDamage !== 0) {
        this.createDigits(2, result.mpDamage);
    } else if (result.hpAffected || result.mpAffected) {
        this.createNofx();
    }
    if (result.critical) {
        this.setupCriticalEffect();
    }
};

Sprite_Damage.prototype.createMiss = function() {
    var w = this.digitWidth();
    var h = this.digitHeight();
    var sprite = this.createChildSprite();
    sprite.setFrame(0, 4 * h, 4 * w, h);
    sprite.dy = 0;
};   
    
Sprite_Damage.prototype.createNofx = function() {
    var w = this.digitWidth();
    var h = this.digitHeight();
    var sprite = this.createChildSprite();
    sprite.setFrame(4 * w, 4 * h, 4 * w, h);
    sprite.dy = 0;
};


Game_Battler.prototype.startDamagePopup = function() {
    var result = this.result();
    if (result.missed || result.evaded) {
      var copyResult = JsonEx.makeDeepCopy(result);
      copyResult.hpAffected = false;
      copyResult.mpDamage = 0;
      this._damagePopup.push(copyResult);
      return;
    }
    if (result.hpDamage !== 0) {
      var copyResult = JsonEx.makeDeepCopy(result);
      copyResult.mpDamage = 0;
      copyResult.mpAffected = false;
      this._damagePopup.push(copyResult);
    }
    if (result.mpDamage !== 0) {
      var copyResult = JsonEx.makeDeepCopy(result);
      copyResult.hpDamage = 0;
      copyResult.hpAffected = false;
      this._damagePopup.push(copyResult);
    }
    if ((result.hpAffected && result.hpDamage === 0) || (result.mpAffected && result.mpDamage === 0)) {
      var copyResult = JsonEx.makeDeepCopy(result);
      this._damagePopup.push(copyResult);
    }   
};

Game_Battler.prototype.gainMp = function (value) {
    this._result.mpDamage = -value;
    this._result.mpAffected = true;
    this.setMp(this.mp + value);
};
})();
I think instead of doing all of this roundabout work... you should probably just use a plugin if you want a specific text image to say "no damage".
Everyone on these forums is always saying "you don't need plugins, just do it with events/JS". Give me a break! :hswt:

But I guess after spending like a month to get a MOG hunter plugin to work how I wanted I got pretty burned out. Not to mention, my project is already a jenga tower of plugins crammed together. I had a hunch that this could be done very simply and I didn't need a whole dang plugin to do what I needed.
that function is for Game_Actions, not Game_ActionResults. script doesnt stop working just because its being called from a plugin
Ahhh I see this explains my nightmare of wondering why sometimes JS stuff works and other times it goes "this is not a function". I really don't know how to figure that kind of thing out without just like... reading through ALL of the code?

Game_Battler.prototype.gainMp = function (value) { this._result.mpDamage = -value; this._result.mpAffected = true; this.setMp(this.mp + value); };
This is beautiful, sir! Thank you! I think this is the exact thing I needed. It looks like everything is in working order. I am curious why you put the OR into the conditional to check if it's hp damage or mp damage? I guess I should just point out that I'm good with the game showing a 0 when it's zero hp damage, so I left that out.

I also wanted to show this off just cuz:

JavaScript:
Sprite_Damage.prototype.digitHeight = function() {
    return this._damageBitmap ? this._damageBitmap.height / 6 : 0;
};

By default this is 5 and not 6. I added a row to the damage spritesheet so I could have a nice big "NO EFFECT" show. I also made my "PARRY" text not scrunched:

1756504807721.png
I really don't know how to figure that kind of thing out without just like... reading through ALL of the code?
the core files are divided in a way that tells you what objects they contain, and when in doubt its probably objects.js
If you know the name of the functions youre looking for you can just control+F inside the files for it or its definition if you know that too
when plugins are involved and what youre looking for gets used all over the place, the console can be used to search for the code used in the game as well across files
1756508989727.png


I am curious why you put the OR into the conditional to check if it's hp damage or mp damage?
I assumed you wanted damaging skills that failed to do damage to only have a no effect popup, so i adjusted the logic to do that.
the consecutive IFs in startDamagePopup create for popups for every one of those sections that are true (except i put a return in the miss case to end early and not need to check that later). that required conditions 2/3 and 4 to be exclusive.
then in setup, the IF-ELSE chain makes it so that every condition has a requirement of all the prior ones being false. by the time you get to result.hpAffected || result.mpAffected it must already be true that both hp and mp damage are 0 and the skill hit. that's not enough to tell if the skill intended to do damage or not and hp/mpAffected flags were needed

Original thread: https://forums.rpgmakerweb.com/threads/how-to-use-the-unused-portion-of-damage-png-spritesheet.179677/