MZ MOG_DmgPopupEffects MZ with added features!

I'm trying to patch MOG_DmgPopupEffects to work in MZ. It throws this error because Sprite_Damage doesn't exist in MZ. FOSSIL doesn't fix it either.
1742329861072.png

1742329912022.png



UPDATE: Solved until further notice. MZ patched version attached below!
1744384811191.png

1744384700708.png


* Modded Version History
* 4/1/2025 v1.0 - Original Mod created
* 4/7/2025 V1.1 - Added Font Size, Popup Number Color, Number Outline Color Parameters
* 4/8/2025 V1.1.1 - Added Popup Number Outline Width and Space Between Digits Parameters
* 4/11/2025 V1.2 Fixed critical, miss, reflect and counter. Added color code examples to help file.
In MV there were these digitWidth and digitHeight functions. In MZ instead w and h are calculated this way:
JavaScript:
const h = this.fontSize();
const w = Math.floor(h * 0.75);

You can try adjusting.
EDIT: but you will run into problems probably later. This is how function looks in MZ:
JavaScript:
Sprite_Damage.prototype.createDigits = function(value) {
    const string = Math.abs(value).toString();
    const h = this.fontSize();
    const w = Math.floor(h * 0.75);
    for (let i = 0; i < string.length; i++) {
        const sprite = this.createChildSprite(w, h);
        sprite.bitmap.drawText(string[i], 0, 0, w, h, "center");
        sprite.x = (i - (string.length - 1) / 2) * w;
        sprite.dy = -i;
    }
};
In MV there were these digitWidth and digitHeight functions. In MZ instead w and h are calculated this way:
JavaScript:
const h = this.fontSize();
const w = Math.floor(h * 0.75);
1742336007240.png

Unfortunately just overwriting h and w makes it so no popup numbers show at all but it does stop the crash.
You can try adjusting.
EDIT: but you will run into problems probably later. This is how function looks in MZ:
JavaScript:
Sprite_Damage.prototype.createDigits = function(value) {
    const string = Math.abs(value).toString();
    const h = this.fontSize();
    const w = Math.floor(h * 0.75);
    for (let i = 0; i < string.length; i++) {
        const sprite = this.createChildSprite(w, h);
        sprite.bitmap.drawText(string[i], 0, 0, w, h, "center");
        sprite.x = (i - (string.length - 1) / 2) * w;
        sprite.dy = -i;
    }
};
Overwriting the createDigits function with that results in
1742335905995.png

e.g. sprite.bitmap is not recognized as an object
This is probably because MOG_DmgPopupEffects is overriding createChildSprite().
This is probably because MOG_DmgPopupEffects is overriding createChildSprite().
Huh, you're right, I didn't even notice that. I thought it was defined in the core files.

1742407506134.png

Well, commenting out the override and replacing createDigits with the new function makes it so there's no crashes and the numbers appear but there's no popup effects on the numbers (bouncing or rising). It's an improvement at least.
1742407730074.png


Looks like this might be more work than I thought and you'd have to tweak a lot of parts of this plugin.
So I took a look at Sprite_Damage in MV and MZ and the concept is different.
In MV it was based on loading this damage bitmap:
1742412266825.png

And then numbers were generated by setting a frame around certain portions of this bitmap. MOG enhanced this.
In MZ numbers are drawn on the fly with drawText on bitmap.

So entire portion of Sprite_Damage code in MOG plugin would need rewrite.
Hmm, well, that's more work than I thought and this isn't even for myself but for the community to have the entire Chrono Engine suite working in MZ. It's just the one Chrono Engine suite plugin that doesn't work 100 percent in MZ but isn't even neccessary, just "nice to have".
Hmm, well, that's more work than I thought and this isn't even for myself but for the community to have the entire Chrono Engine suite working in MZ. It's just the one Chrono Engine suite plugin that doesn't work 100 percent in MZ but isn't even neccessary, just "nice to have".
Okay, I took a peak at the script and the tweaks you two have done, implemented it, and fiddled around with it on my end. And the same results show for me, the numbers just pop up with no fanfare, and funnily enough, when I add the zoom setup function in the createDigits functions, the sprites do scale to double its size, but they don't animate.

So, it appears to me that the animation functions are broken due to them being optimized for MV and not MZ. I was honestly expecting that because it was a pain for me to get the spell animations working when porting the Chrono Engine, so I expected something similar to happen here. Keep in mind that I'm still learning JS scripting in MZ, so there's so much I can do, but the solutions here seems to be either fix what's bugging the animations or redo them entirely to make them optimized for MZ.

I'll come back when I eventually find a definitive solution to this.
Alright, I'm back, and I've found the solution to your problem, it was a lot easier than I thought it was gonna be. The issue was from the createChildSprite function, commenting that out was what caused the animations to not play. This is an MZ thing because of how MZ draws the damage numbers compared to MV.

Using MZ's own code rmmz_sprites.js as a reference, I managed to take the createChildSprite function from that and insert it into MOG_DmgPopupEffects's, and it's currently working well with me.

Here's the code that needs to be implemented. If I missed something, do tell

Screenshot 2025-04-01 205718.png

And yes, the this.setBaseData(sprite) line must be commented/removed because MZ relies on that one function alone to do all the work for it.
Nice, I don't know if it works for "bouncing" numbers but it works for the "floating" numbers. Definitely an improvement.
Nice, I don't know if it works for "bouncing" numbers but it works for the "floating" numbers. Definitely an improvement.
I tried it on both bouncing and floating, and messed around with the other parameters, all was working great with me, but glad to here that it's working for you!
Moghunter allows for redistribution of their plugins so I'll attach the patched version to the first post for anyone who wants it. If it's not allowed mods can remove it.
Would it be possible to add more parameters to this plugin? For example to change the numbers size, color, position.
Would it be possible to add more parameters to this plugin? For example to change the numbers size, color, position.
That would require more time to do and more code-altering to perform, which may take a while
I will look at it when I have time but I think this is being drawn by a pixi.js function? There are a lot of things there with white (FFFFFF) as the default color
1744061634046.png

I updated the file in the first post to add popup number color, outline color, and font size in the parameters
I added Outline Width and Space Between Digits as Parameters
1744147949779.png
You are doing God's work. Thank you!
Just found out Miss/Critical/Reflect crashes the game. I was able to fix it but now there can be potentially a lot more parameters if someone wanted to set the colors for all those messages individually.
First of all, well done for finding and fixing the error!
I think the more flexibility we have, the better. I would love to have more parameters.

What do you guys think of the idea of showing different types of damage as additional values instead of adding all those additional values to one number? I think it would be cool to see different numbers in the corresponding colors. For example: normal damage in white, fire damage in red and so on.

Original thread: https://forums.rpgmakerweb.com/threads/mog_dmgpopupeffects-mz-with-added-features.176344/