Battle transformation help

Hi everyone.
I am trying to use a transformation for a character in battle for MZ. I watched Yanflys video and got the code for the state on this forum. I also use stella and have the states core active. I eventually want a character to change into a werewolf for a set number of turns. When I try it in a battle nothing happens. I'm still new at this too. Any help is apperciated. Heres the code and the images for states and skills:

<JS On Add State>

if (user.isActor()) {

user._prevCharName ??= user._characterName;

user._prevCharIndex ??= user._characterIndex;

user._prevFaceName ??= user._faceName;

user._prevFaceIndex ??= user._faceIndex;

user._prevBattlerName ??= user._battlerName;

const charName = "SF_Actor1";

const charIndex = 0;

const faceName = "SF_Actor1";

const faceIndex = 0;

const battlerName = "SF_Actor1_1";

user.setCharacterImage(charName, charIndex);

user.setFaceImage(faceName, faceIndex);

user.setBattlerImage(battlerName);

user.refresh();

}

</JS On Add State>



<JS On Erase State>

const charName = user._prevCharName;

const charIndex = user._prevCharIndex;

const faceName = user._prevFaceName;

const faceIndex = user._prevFaceIndex;

const battlerName = user._prevBattlerName;

user.setCharacterImage(charName, charIndex);

user.setFaceImage(faceName, faceIndex);

user.setBattlerImage(battlerName);

delete user._prevCharacterName;

delete user._prevCharacterIndex;

delete user._prevFaceName;

delete user._prevFaceIndex;

delete user._prevBattlerName;

user.refresh();

</JS On Erase State>
The scope of the skill is set to none, so the state isn’t applied to anyone I think
The scope of the skill is set to none, so the state isn’t applied to anyone I think
I tried to change it to user and ally and still nothing.
I tried to change it to user and ally and still nothing.
Brother... "still nothing" is not exactly helpful. What exactly did you try? Do you get any errors? I just tried it on my end in a battle test and it works perfectly fine.

Before:
1718238981905.png


After:
1718239151216.png


JavaScript:
<JS On Add State>
if (user.isActor()) {
user._prevBattlerName ??= user._battlerName;
const battlerName = "acSjorgeLongSwordGG";
user.setBattlerImage(battlerName);
user.refresh();
}
</JS On Add State>


<JS On Erase State>
const battlerName = user._prevBattlerName;
user.setBattlerImage(battlerName);
delete user._prevBattlerName;
user.refresh();
</JS On Erase State>
Brother... "still nothing" is not exactly helpful. What exactly did you try? Do you get any errors? I just tried it on my end in a battle test and it works perfectly fine.

Before:
View attachment 308282

After:
View attachment 308283

JavaScript:
<JS On Add State>
if (user.isActor()) {
user._prevBattlerName ??= user._battlerName;
const battlerName = "acSjorgeLongSwordGG";
user.setBattlerImage(battlerName);
user.refresh();
}
</JS On Add State>


<JS On Erase State>
const battlerName = user._prevBattlerName;
user.setBattlerImage(battlerName);
delete user._prevBattlerName;
user.refresh();
</JS On Erase State>
OK, so it was a problem with the code. I replaced with your example and it works perfectly. Thank you!!
OK, so it was a problem with the code.
The code @werzaque used is the same as the code you originally posted. He just didn't bother changing the character and face images.
OK, so it was a problem with the code. I replaced with your example and it works perfectly. Thank you!!
I'm happy it works now! 👋

...but I don't think it was a problem with the code you used. This is why I asked you to be exact with what you have tried. We're all volunteers here, so let's try to be mindful of each other's time. 😤

Original thread: https://forums.rpgmakerweb.com/threads/battle-transformation-help.169445/