I know it carries over the HP and states, and I also know that it gives the enemies the attacks from what they transform into, but do they keep their old attacks, if they're not on the enemy they transformed into? How would I remove those attacks if it transforms? And what else does it do?
Transform Enemy, what are ALL the things it does?
RPG Maker MZ SupportNo. Without plugins, the Enemy Transform command:
- Sets the database ID for the enemy.
- Resets the battler's display name.
- Refreshes the battler, which updates resisted states, death state, and HP/MP/TP caps.
- Remakes the battler's actions (using the new enemy reference).
- Remakes display names for all members of the troop.
JavaScript:
Game_BattlerBase.prototype.refresh = function() {
for (const stateId of this.stateResistSet()) {
this.eraseState(stateId);
}
this._hp = this._hp.clamp(0, this.mhp);
this._mp = this._mp.clamp(0, this.mmp);
this._tp = this._tp.clamp(0, this.maxTp());
};
Game_Battler.prototype.refresh = function() {
Game_BattlerBase.prototype.refresh.call(this);
if (this.hp === 0) {
this.addState(this.deathStateId());
} else {
this.removeState(this.deathStateId());
}
};
Game_Enemy.prototype.transform = function(enemyId) {
const name = this.originalName();
this._enemyId = enemyId;
if (this.originalName() !== name) {
this._letter = "";
this._plural = false;
}
this.refresh();
if (this.numActions() > 0) {
this.makeActions();
}
};
// Enemy Transform
Game_Interpreter.prototype.command336 = function(params) {
this.iterateEnemyIndex(params[0], enemy => {
enemy.transform(params[1]);
$gameTroop.makeUniqueNames();
});
return true;
};
Original thread: https://forums.rpgmakerweb.com/threads/transform-enemy-what-are-all-the-things-it-does.171829/