Changing classes using variables?

The game now crashes on launch with these changes. i determinded the issue lies within the state notetag so i'll add it here

1723055143494.png


<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 = user.transformTarget._characterName;

const charIndex = user.transformTarget._characterIndex;

const faceName = user.transformTarget._faceName;

const faceIndex = user.transformTarget._faceIndex;

const battlerName = user.transformTarget._battlerName;

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>
<JS On Erase State>
user.changeClass(user.origClass, true);
delete user.origClass;
</JS On Erase State>
The game now crashes on launch with these changes. i determinded the issue lies within the state notetag so i'll add it here

View attachment 313979

<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 = user.transformTarget._characterName;

const charIndex = user.transformTarget._characterIndex;

const faceName = user.transformTarget._faceName;

const faceIndex = user.transformTarget._faceIndex;

const battlerName = user.transformTarget._battlerName;

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>
<JS On Erase State>
user.changeClass(user.origClass, true);
delete user.origClass;
</JS On Erase State>
Nevermind, i've already determined the issue myself. The problem was that i had <on erase state> twice...Howver the visual transformation effect did not occur
Nevermind, i've already determined the issue myself. The problem was that i had <on erase state> twice...Howver the visual transformation effect did not occur
copy paste the contents of one of the erase state tags into the other. IDK how visustella plugins handle duplicates of a tag.
also i know i said "add this somewhere inside the skill notetag", but make it the first thing in the notetag. you didnt show a screenshot of the skill after putting it in, but if its after the addState line the then state's notetags wouldnt be able to use it
copy paste the contents of one of the erase state tags into the other. IDK how visustella plugins handle duplicates of a tag.
also i know i said "add this somewhere inside the skill notetag", but make it the first thing in the notetag. you didnt show a screenshot of the skill after putting it in, but if its after the addState line the then state's notetags wouldnt be able to use it
I've changed the location of the notetag in the skill and it works now! thank you so much! i was getting really worried that i'd need to scrap everything! you're a lifesaver!

I'm sorry a new issue has popped up. I'm using a plugin for custom equip slots per class. And it seems to conflict. the game crashes when i tried to flee a battle. I'm going to test if winning the battle or removing the state via time has the same effect

Winning a battle and letting the state expire have no effects. The issue seemed to be a one time thing somehow, because fleeing worked fine too. besides the state not ending one time...This is strange but i believe it works fine enough if i can find the root of the strange crash
I've changed the location of the notetag in the skill and it works now! thank you so much! i was getting really worried that i'd need to scrap everything! you're a lifesaver!

I'm sorry a new issue has popped up. I'm using a plugin for custom equip slots per class. And it seems to conflict. the game crashes when i tried to flee a battle. I'm going to test if winning the battle or removing the state via time has the same effect

Winning a battle and letting the state expire have no effects. The issue seemed to be a one time thing somehow, because fleeing worked fine too. besides the state not ending one time...This is strange but i believe it works fine enough if i can find the root of the strange crash
1723057663470.png
Here's the error message. I am once again a confused lost puppy with no idea how to/If it can be fixed
were you able to get that error consistently, or is it still unknown as to why it happens? I dont have the time to look into that equip slot plugin, but if you can find a consistent cause, gather the steps to reproduce it, and ask Puppet Knight about it, they might have an idea
were you able to get that error consistently, or is it still unknown as to why it happens? I dont have the time to look into that equip slot plugin, but if you can find a consistent cause, gather the steps to reproduce it, and ask Puppet Knight about it, they might have an idea
It seems to only happen if flee is the first action taken after using the skill
It seems to only happen if flee is the first action taken after using the skill
the first action in general, or the first action taken by the transformed actor?
the first action in general, or the first action taken by the transformed actor?
The first action taken post use of the skill by any actor

Upon further testing it happens if flee is used by any character that's not the actor with the state, timing doesn't matter

Another test later, ive tried with both Enhanced TP and the puppetknight plugin off, neither of which cause the issue as it still happens

I've decided on a makeshift solution. For some reason the escape skill does not trigger the crash. so i'll make it a universal skill and remove the escape command
The first action taken post use of the skill by any actor

Upon further testing it happens if flee is used by any character that's not the actor with the state, timing doesn't matter

Another test later, ive tried with both Enhanced TP and the puppetknight plugin off, neither of which cause the issue as it still happens

I've decided on a makeshift solution. For some reason the escape skill does not trigger the crash. so i'll make it a universal skill and remove the escape command
once again an issue arrises. The satte doesnt revert, if the battle ends before the state does. even with the "if battle end" trigger is on, it doesnt get removed by walking either. neither the image nor the class. I think it's a lost cause and i should just give up and stop wasting time on this

Original thread: https://forums.rpgmakerweb.com/threads/changing-classes-using-variables.170923/