Enemy Transform modification

 I want to use the script call section to make custom enemy transform calls based on a game variable instead of the manual drop down menu in the editor. Doing so should allow designers to create one troop that can spawn any enemies in your game, eliminating the need for unique troops for every desired possibility of an encounter mix. This is the function for it but I'm not sure how to call it properly via script.

Code:
// Enemy TransformGame_Interpreter.prototype.command336 = function() {    this.iterateEnemyIndex(this._params[0], function(enemy) {        enemy.transform(this._params[1]);        $gameTroop.makeUniqueNames();    }.bind(this));    return true;};
Check out this script, I think its what your looking for.

http://himeworks.com/2013/07/troop-placeholders/
This is for MV, don't think that will work but thanks for the offer.

If I can get the script call code right I can work out my own algorithm for the rest of it.
I made this plugin, which will transform enemies with a certain note tag at the start of the battle into whatever is defined. Is that what you're looking for?
No, not specifically Rex. That script is controlled via note tag, I am planning on using something that is event oriented. I only need to know how to properly use the transform code.
No, not specifically Rex. That script is controlled via note tag, I am planning on using something that is event oriented. I only need to know how to properly use the transform code.
 Gotcha. In that case, here's a script call example:

Code:
var enemyId = [1,2,3,4,1,2,3,4];BattleManager.setup(1, true, false);for(var i = 1; i< $gameTroop.members().length; i++){$gameTroop.members()[i-1].transform(enemyId[i-1]);$gameTroop.makeUniqueNames();}BattleManager.setEventCallback(function(n) {this._branch[this._indent] = n;}.bind(this));$gamePlayer.makeEncounterCount();SceneManager.push(Scene_Battle);
Basically you have to call $gameTroop.transform after you setup the battle, otherwise it doesn't work.
Sorry to necro-post, but I am very interested in this topic as well, and the answer that was given doesn't quite make sense to me.
I'm using a troop event to transform enemies in a troop on the first turn of a battle.
This is the code I am using:

$gameTroop.members()[1].transform($gameVariable.value[14]);

variable 14 is a random number that I generate. This random number corresponds to an enemy in the enemy database.
Using this method would allow me to easily set up random encounters that correlate with the player's current level.

Is the script call I am using the correct way to transform an enemy mid-battle?

Original thread: https://forums.rpgmakerweb.com/threads/enemy-transform-modification.48350/