Enemy has letters added to its name after transforming

Hello everyone!

So, I have a battle where an enemy transforms depending on its "persona", problem is, after some transformations, instead of being just , say "Cookie-cutter rat" , it becomes "Cookie-cutter rat B" and from this transformation on, it then goes "Cookie-cutter rat C / D / E etc".

No eventing is set as "entire troop", neither the transformations nor the states modifications in the troops event.

Any idea why it could do such a thing? The enemy is all alone.

Thank you 🙂
It's next to impossible to say without seeing screenshots of how you're doing the transforming.

From a quick poke at the code, it looks like this should only happen if there are legitimately multiples of that enemy in the troop:
Code:
Game_Troop.prototype.updatePluralFlags = function() {
    for (const enemy of this.members()) {
        const name = enemy.originalName();
        if (this._namesCount[name] >= 2) {
            enemy.setPlural(true);
        }
    }
};

That's the only time setPlural() is used. Similarly, the letters are set in Game_Troop.makeUniqueNames() and should only happen if there are actually multiple enemies in that the troop of that name.

So...I guess provide screenshots and whether you're using any battle-related plugins.
It's next to impossible to say without seeing screenshots of how you're doing the transforming.

From a quick poke at the code, it looks like this should only happen if there are legitimately multiples of that enemy in the troop:
Code:
Game_Troop.prototype.updatePluralFlags = function() {
    for (const enemy of this.members()) {
        const name = enemy.originalName();
        if (this._namesCount[name] >= 2) {
            enemy.setPlural(true);
        }
    }
};

That's the only time setPlural() is used. Similarly, the letters are set in Game_Troop.makeUniqueNames() and should only happen if there are actually multiple enemies in that the troop of that name.

So...I guess provide screenshots and whether you're using any battle-related plugins.


I checked the two chunks of code. I think the problem is when the enemy comes back to a form it already turned into before, the code considers namesCount[name] as >=2.

I don't see any other explanation because I tried turning off all plugins that mess with battle and the result was still the same.

Also I found out that the letters are added only when a form it already went into appears again. Furthermore, it treats each forms individually.
For exemple, if it got into FormA twice, FormB thrice and FormC once, it displays for each form :
"FormA B"
"FormB C"
"FormC"

So from my nascent understanding of javascript, it seems to check out with the problem I think it is isn't it?

I guess in this case I would just need to know how to call a function for this battle only that neutralizes the function "Game_Troop.prototype.updatePluralFlags".

Regarding the eventing, I just use "Enemy Transform: #1 FormA (the initial form), *whatever form it turns into*"
Oh, I see what's happening now. It never skips anything, it always registers the enemy with a letter even if there's only one.

So you could put a script call into your transformation before actually transforming the enemy, with
Code:
$gameTroop._namesCount["Bat"]--;
where Bat is the database name of the enemy.
Oh, I see what's happening now. It never skips anything, it always registers the enemy with a letter even if there's only one.

So you could put a script call into your transformation before actually transforming the enemy, with
Code:
$gameTroop._namesCount["Bat"]--;
where Bat is the database name of the enemy.
Just tried it, works like a charm! Thank you so much!

Original thread: https://forums.rpgmakerweb.com/threads/enemy-has-letters-added-to-its-name-after-transforming.170926/