RPG Maker Forums

By now you're probably familiar with Yanfly's Enemy Transformation Trick.


Code:
<Custom Apply Effect>
if (user.isEnemy()) {
    user._prevEnemyId = user._enemyId;
    var transformEnemyId = 2;
    user.transform(transformEnemyId);
    }
</Custom Apply Effect>

<Custom Remove Effect>
if (user.isEnemy()) {
   var transformEnemyId = user._prevEnemyId;
   user.transform(transformEnemyId);
   user._prevEnemyId = undefined;
}
</Custom Remove Effect>
I'm an user of sv_battlers for enemies (no static images). And I'm also mostly code-illiterate.

And I've been thinking of using the Enemy Transformation Trick to change the enemy sv_battler appearance depending on it's current State. This is downright vital for the key feature in my game (Romantic Encounters you can control directly.)

I've found two problems with this Trick, however.

1) If I hit my enemy a second time with the same transformation skill, the enemy loses it's original enemy Id, and won't turn back once the status effect fades away.

I need the enemy to remember it's original enemy Id, and go back to it regardless of how many times they get hit by the same transformation attack.
2) The transformation skill will always transform the target into the same Enemy Id. In other words, if I use the Transformation skill on an Angel or a Slime, the result will always be a Vampire (or the enemy Id I set for default).

But I need the Transformation to change based on the Target. AKA Biting an Angel will turn them into a Vampire Angel, while biting a Slime will transform them into a Vampire Slime. (This is just an example.)
In other words, the Enemy Transform Trick is rather unintuitive compared to the Actor Transformation Trick.


Code:
<Custom Apply Effect>
if (user.isActor()) {
user._prevCharName = user._prevCharName || user._characterName;
  user._prevCharIndex = user._prevCharIndex || user._characterIndex;
  user._prevFaceName = user._prevFaceName || user._faceName;
  user._prevFaceIndex = user._prevFaceIndex || user._faceIndex;
  user._prevBattlerName = user._prevBattlerName || user._battlerName;
  if (user.actorId() === 1) {
  var charName = 'HaroldSSJ';
  var charIndex = 0;
  var faceName = 'HaroldSSJ';
  var faceIndex = 0;
  var battlerName = 'Harold_SSJ1';
   } else if (user.actorId() === 2) {
   var charName = 'ThereseSSJ';
   var charIndex = 0;
   var faceName = 'ThereseSSJ';
   var faceIndex = 0;
    var battlerName = 'Therese_SSJ1';
user.setCharacterImage(charName, charIndex);
user.setFaceImage(faceName, faceIndex);
user.setBattlerImage(battlerName);
user.refresh();
}
</Custom Apply Effect>

<Custom Remove Effect>
    var charName = user._prevCharName;
    var charIndex = user._prevCharIndex;
    var faceName = user._prevFaceName;
    var faceIndex = user._prevFaceIndex;
    var battlerName = user._prevBattlerName;
    user.setCharacterImage(charName, charIndex);
    user.setFaceImage(faceName, faceIndex);
    user.setBattlerImage(battlerName);
    user._priorityCharacterName = undefined;
user._priorityCharacterIndex = undefined;
user._prevFaceName = undefined;
user._prevFaceIndex = undefined;
user._priorityFaceName = undefined;
user._priorityFaceIndex = undefined;
user._prevFaceName = undefined;
user._prevFaceIndex = undefined;
user._priorityBattlerName = undefined;
user._prevBattlerName = undefined;
user.refresh();
</Custom Remove Effect>
In contrast, this Code works wonders and then some. With this, my actors can change sv_battlers at a moment's notice, based on their current State. It works perfectly with the system I am implementing, and I'd like the Enemy Transformation to work like this.

In other words, I'd like if the Enemy Transformation Trick worked more like the Actor Transformation Trick. Now the question is:

1) Is it possible to reuse or remake the Actor Transformation code to work on sv_battler enemies?
2) If not, is there a way to alter the Enemy Transformation Trick to fix the two limitations mentioned above?
I've been thinking of a work-around using Static Image Battlers, and the Weak Enemy Plugin to change enemy States. But I'd like to at least try and keep the battlers animated.

Any help would be appreciated. And thanks in advance.

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,050
Messages
1,018,548
Members
137,835
Latest member
yetisteven
Top