MV TSR_Popups by The Northern Frog

Okay, hold the phone, got my answer.

Nothing to do with plugins. For some reason, it just hates my font. Setting to the default MV font and there is no problem. Guess we're looking for something else.

Upon review, this font (Maiandra GD) is not for Commericial use in any case so I probably would have had to change it at some point.

EDIT: The plugin is very finicky about basically accepting any entry for font other than plain old 'GameFont', and having tried 12 different fonts, all of them have weird gaps, even with similar shape and size profiles.

Even if I import extra fonts using Yanfly, including the same original font (i.e. mplus-1m-regular) and then try to get TSR to use it with it's font selector in plugin manager to use THE Original Font, it still fails (crunching said normal font to a tiny size and missing out letters again).

Thankfully I can just tell it to use GameFont and then get Yanfly to set a different default for itself, but its very strange how weird this whole thing is.

Incidentally, it misses out including the '+' and '-' for the states, even with GameFont, I just realised, so I'm wondering if that is related.
It's me again, just a quick query- is there any easy way to randomise the pop-up direction when you get multiple stacking pop-ups from a single attack?

Basically, I have some skills that I'd like to have 6-10 hits (using Yanfly action sequences).

They work fine, but since the popups always go vertically upwards, you end up with a massive vertical column of popups that doesn't look very good (and might go off screen).

I tried altering the X-Anchor in the JS myself to add in a random number but that of course has the problem then that damage numbers more than single digits then don't align (i.e. 10 damage can end up showing 01 damage, or just having them overlap, since it calls the function seperately for each digit).

Any ideas if this is possible?
Hello!
I tried altering the X-Anchor in the JS myself to add in a random number but that of course has the problem then that damage numbers more than single digits then don't align (i.e. 10 damage can end up showing 01 damage, or just having them overlap, since it calls the function seperately for each digit).
I can't run MV on my computer anymore, so I'm limited in the help I can provide. Yet, I'll give a look to the code and try to give some advice, just give me some time... But at first glance, since each digit is a single sprite, you might want to try to offset the x position of the each sprites by a fixed number instead of playing with the anchors.
Or you can try to change the anchor.x of the whole container like this.anchor.x instead of each childrens.
Anyway, I'll give a closer look later and come back in a few days.

Regards!
TSR​
Anyway, I'll give a closer look later and come back in a few days.
Any advance on this front? I have tried a bunch of other things, including trying to change CreateDigits and pushDamageSprite, but I always end up desync'ed digits, sadly.
Any advance on this front? I have tried a bunch of other things, including trying to change CreateDigits and pushDamageSprite, but I always end up desync'ed digits, sadly.
Hello! Sorry, it got a bit out of my mind. But I did take a look at it.
I think the best way would be to add that sprite_battler function to the plugin and alter the x position of the popup container from there:
Code:
Sprite_Battler.prototype.setupDamagePopup = function() {
    if (this._battler.isDamagePopupRequested()) {
        if (this._battler.isSpriteVisible()) {
            var sprite = new Sprite_Damage();
            sprite.x = this.x + this.damageOffsetX();
            sprite.y = this.y + this.damageOffsetY();
            sprite.setup(this._battler);
            this._damages.push(sprite);
            this.parent.addChild(sprite);
        }
        this._battler.clearDamagePopup();
        this._battler.clearResult();
    }
};
You can use this._damages.length to check if there's other popups playing and add your offset accordingly. Should do the trick. Hope that help!
Regards.
Hello! Sorry, it got a bit out of my mind. But I did take a look at it.
I think the best way would be to add that sprite_battler function to the plugin and alter the x position of the popup container from there:
Code:
Sprite_Battler.prototype.setupDamagePopup = function() {
    if (this._battler.isDamagePopupRequested()) {
        if (this._battler.isSpriteVisible()) {
            var sprite = new Sprite_Damage();
            sprite.x = this.x + this.damageOffsetX();
            sprite.y = this.y + this.damageOffsetY();
            sprite.setup(this._battler);
            this._damages.push(sprite);
            this.parent.addChild(sprite);
        }
        this._battler.clearDamagePopup();
        this._battler.clearResult();
    }
};
You can use this._damages.length to check if there's other popups playing and add your offset accordingly. Should do the trick. Hope that help!
Regards.
Sorry to be giga-thick here, but I assume I'm inserting around line 2383 just before Sprite_Battler.prototype.setupDamagePopup ?

And then I'd presumably modify Sprite_Damage.prototype.createDigits with something like
if (this._damages.length >= 2)
{ this.damageOffsetX() = ((30 * Math.random()) + (-30 * Math.random()));}

Or am being a moron? (probably)
Hello again!
Sorry to be giga-thick here, but I assume I'm inserting around line 2383 just before Sprite_Battler.prototype.setupDamagePopup ?

And then I'd presumably modify Sprite_Damage.prototype.createDigits with something like
if (this._damages.length >= 2)
{ this.damageOffsetX() = ((30 * Math.random()) + (-30 * Math.random()));}

Or am being a moron? (probably)
Not quite. Doesn't matter where you put it in the plugin. Just copy-paste the full default function Sprite_Battler.prototype.setupDamagePopup from rpg_sprite.js into my plugin then make the change directly into the function. Something like this:
Code:
Sprite_Battler.prototype.setupDamagePopup = function() {
    if (this._battler.isDamagePopupRequested()) {
        if (this._battler.isSpriteVisible()) {
            var sprite = new Sprite_Damage();
            
            /// example ///
            
            const offsetX = this._damages.length * 48
            sprite.x = this.x + this.damageOffsetX() + offsetX;
            
            ////////////////
            
            sprite.y = this.y + this.damageOffsetY();
            sprite.setup(this._battler);
            this._damages.push(sprite);
            this.parent.addChild(sprite);
        }
        this._battler.clearDamagePopup();
        this._battler.clearResult();
    }
};
Haven't tested it cause I can't run MV, but this example should add a 48px offset to the right to each popups but the first. The offset increase as there's more popups on screen, but you can use whatever you want like fix numbers or random. I could think of various approach, but that's probably the most straightforward. Of course assuming the function isn't referenced in other of your plugins.
Hope that help!
Regards.
Hello again!

Haven't tested it cause I can't run MV, but this example should add a 48px offset to the right to each popups but the first. The offset increase as there's more popups on screen, but you can use whatever you want like fix numbers or random. I could think of various approach, but that's probably the most straightforward. Of course assuming the function isn't referenced in other of your plugins.
Hope that help!
Regards.
Thankyou!! I was of course massively overcomplicating things lol. The example was all I really needed there. As YEP_CoreEngine is being used, I modified that formula for:
Code:
Sprite_Battler.prototype.setupDamagePopup = function() {
    if (this._battler.isDamagePopupRequested()) {
      if (this._battler.isSpriteVisible()) {
        var sprite = new Sprite_Damage();
        const ZoffsetX = (this._damages.length) * ((60 *  Math.random()) + (-60 * Math.random()))
        const ZoffsetY = (this._damages.length) * ((30 *  Math.random()) + (-30 * Math.random()))
        sprite.x = this.x + this.damageOffsetX() + ZoffsetX;
        sprite.y = this.y + this.damageOffsetY() + ZoffsetY;
        sprite.setup(this._battler);
        this.pushDamageSprite(sprite);
        BattleManager._spriteset.addChild(sprite);
        this._battler.clearResult();
      }
    } else {
      this._battler.clearDamagePopup();
    }
};

This works great when there is double digit or higher damage, but single digits of damage seem react far more wildly to these offsets than if you have 2 or 3 digits, almost like it's being multiplied by a hidden factor in this case. Using the above code, this often happens with my 6x hit (atk *0.2) skill:
1773100404893.png

Considering that the test sprite is 265 pixels wide, I'm pretty sure those numbers are jumping way more than 60 in either direction!! (also yes, the player sprites already have an alias to this function which makes them ignore the offset, as you can see with the TP stacking going on).

I tried using (this._damages.length + 1) in the formula to see if it was just an issue with that value presumably being 1 or 0 or something, but that has no effect.

Also tried an if (this._damages.length <= 2) with smaller offsets if true, but that just crashes with the constant not being defined, even though an else conditional is provided and you'd think at the very least the else branch would be retrieved, but apparently not.

Any ideas?
Hello!
This works great when there is double digit or higher damage, but single digits of damage seem react far more wildly to these offsets than if you have 2 or 3 digits, almost like it's being multiplied by a hidden factor in this case. Using the above code, this often happens with my 6x hit (atk *0.2) skill:
Of course, I cannot tell what's happening with the whole bunch of other plugins you might be using. Beside, it's been years since I've worked with YEP plugins, and I can't open MV anymore so I can't make any tests.

That said, unless there's something I don't see, the number of digits in a popup shouldn't affect the x position of the sprite container. You might want to make some tests with fix numbers first (instead of random) and see if it does change depending on the number of digits.

Also, just to be sure: this._damages is an array where currently playing popups are stacked. It's not related to the number of digits of the popups. In your formula, you multiply a random value by _damages.length which means the more popups are playing at once, more the offset is increase.
*like if you replace your random value by a fix value of 10, the first popup will have no offset (because damages length is 0), the second will be offset by 10, the third by 20, and so on. So on your 6 hits skill, the last popup would be offset by 50. And since you're using random value, it makes the popups behave even more erratically.

Regards!
Also, just to be sure: this._damages is an array where currently playing popups are stacked. It's not related to the number of digits of the popups. In your formula, you multiply a random value by _damages.length which means the more popups are playing at once, more the offset is increase.
*like if you replace your random value by a fix value of 10, the first popup will have no offset (because damages length is 0), the second will be offset by 10, the third by 20, and so on. So on your 6 hits skill, the last popup would be offset by 50. And since you're using random value, it makes the popups behave even more erratically.

Regards!
Ahhh! Yes, that will be it. 😅 For some reason I thought "We're using damages_length to address the original issue of the two digits being out of sync with each other".

So it turns out I don't need to refer to it at all, since we're actually not addressing the original anchor issue, but instead changing the container, and stepping around that issue entirely lol.

Thankyou, this entirely resolves my problem now. I apologise for being as dumb as rocks when it comes to the code, and thanks for your patience.
Thankyou, this entirely resolves my problem now. I apologise for being as dumb as rocks when it comes to the code, and thanks for your patience.
no one is dumb, its a mistake we learn from ^^

no one is perfect either, asking for a problem can solve what you need.

Original thread: https://forums.rpgmakerweb.com/threads/tsr_popups-by-the-northern-frog.118619/