It was working before and it started to not work out of nowhere. I'm on RPG Maker MZ and I'm using Visustella's plugins.
In my game, I want some actors to be able to transform and I managed to find a script on the web that did exactly that.
By transform, I mean that I want an actor to change its physical appearance and gain some stats out of it but I want it to only stay during a fight. Once the battle ends, I want the transformation to cancel itself.
The stat part is working.
The appearance part WAS working before, but now it's giving me the error message "Cannot read property 'match' of undefined".
I checked in the console and I saw that the game was unable to load a file and that's what caused the crash. Again, it was working before and I didn't add any other plugins in between.
I did a lot of testing and I found this:
The error message only appears when the battle ends and the actor needs to go back to his original look.
The error message only appears when the transformation is used by any actor that is not the party leader.
It's not caused by one actor, I have 3 actors that can transform and all 3 of them works by themselves but makes the game crash when put in the 2nd, 3rd or 4th slot in the party.
Here's the code that I said I found on the web and it was working before yesterday:
<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;
if (user.actorId() === 1) {
var charName = 'Character Transformation name';
var charIndex = 0;
var faceName = 'Face Transformation name';
var faceIndex = 0;
var battlerName = 'Battler Transformation name';
}
if (user.actorId() === 2) {
var charName = '2nd Character Transformation name';
var charIndex = 0;
var faceName = '2nd Face Transformation name';
var faceIndex = 0;
var battlerName = '2nd Battler Transformation name';
}
user.setCharacterImage(charName, charIndex);
user.setFaceImage(faceName, faceIndex);
user.setBattlerImage(battlerName);
user.refresh();
}
</JS On Add State>
<JS On Erase State>
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();
</JS On Erase State>
So yeah, I just want this to work so you can change the script entirely if that's what needs to happen to fix it.
In my game, I want some actors to be able to transform and I managed to find a script on the web that did exactly that.
By transform, I mean that I want an actor to change its physical appearance and gain some stats out of it but I want it to only stay during a fight. Once the battle ends, I want the transformation to cancel itself.
The stat part is working.
The appearance part WAS working before, but now it's giving me the error message "Cannot read property 'match' of undefined".
I checked in the console and I saw that the game was unable to load a file and that's what caused the crash. Again, it was working before and I didn't add any other plugins in between.
I did a lot of testing and I found this:
The error message only appears when the battle ends and the actor needs to go back to his original look.
The error message only appears when the transformation is used by any actor that is not the party leader.
It's not caused by one actor, I have 3 actors that can transform and all 3 of them works by themselves but makes the game crash when put in the 2nd, 3rd or 4th slot in the party.
Here's the code that I said I found on the web and it was working before yesterday:
<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;
if (user.actorId() === 1) {
var charName = 'Character Transformation name';
var charIndex = 0;
var faceName = 'Face Transformation name';
var faceIndex = 0;
var battlerName = 'Battler Transformation name';
}
if (user.actorId() === 2) {
var charName = '2nd Character Transformation name';
var charIndex = 0;
var faceName = '2nd Face Transformation name';
var faceIndex = 0;
var battlerName = '2nd Battler Transformation name';
}
user.setCharacterImage(charName, charIndex);
user.setFaceImage(faceName, faceIndex);
user.setBattlerImage(battlerName);
user.refresh();
}
</JS On Add State>
<JS On Erase State>
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();
</JS On Erase State>
So yeah, I just want this to work so you can change the script entirely if that's what needs to happen to fix it.