MZ Changing actor image after a state end

Hi, I'm using RPG Maker MZ and VisuStella's basic plugin pack. I made a code so, when the character uses the Skill "Transform in Phoenix", his menu photo (and battle), turns into a Phoenix. Afterwards, I created a skill that appears on him in that form, thus making him change to human form.

But I have a problem, I wanted the transform to have time to expire. But if I do that, the character will not return to human form (only at the end of the battle, but I would like it to change before then.

I saw that there is a way to make a JavaScript code run when the State ends. I wanted to ask for help from those who would know how to help me to assemble a Javascript code that makes this change of images when the State for erase or ends.

Thank you for your attention and sorry for my English, it is not my native language.
If you do a Google for "transform," you'll find a bunch of threads about this. Here's an article that should help.

These notetags are for the Yanfly plugins from MV, so you'll need to replace them with the appropriate VisuStella Skills and States notetags.

If you do a Google for "transform," you'll find a bunch of threads about this. Here's an article that should help.

These notetags are for the Yanfly plugins from MV, so you'll need to replace them with the appropriate VisuStella Skills and States notetags.

I tried using this notetag several times, none of it worked exactly. And I already did a search on the forum, and I didn't find the JavaScript to change this character's photo with the state.
I tried using this notetag several times, none of it worked exactly.
Then tell us which parts of it didn't work, and we can try to help you.

And I already did a search on the forum, and I didn't find the JavaScript to change this character's photo with the state.
It's in the link I provided you. The JavaScript function to change the face image is:
Code:
user.setFaceImage("filename", index);
Then tell us which parts of it didn't work, and we can try to help you.


It's in the link I provided you. The JavaScript function to change the face image is:
Code:
user.setFaceImage("filename", index);
Can I change the menu image? because this is what is showing up in battles because of VisuStella's Battle Core. And about the Transformation script, it was crashing every time I used it. Even though I put everything correctly that I found.
Can I change the menu image? because this is what is showing up in battles because of VisuStella's Battle Core.
Sorry, I don't know what the "menu image" is. Typically the face image is what is shown in the party menu as well as the battle status window, but if you're using a plugin to change that to something else you'll either need to give more detail (is it a separately referenced file? A bust image?), or look at the plugin documentation to see how it's set.

And about the Transformation script, it was crashing every time I used it.
When you get crashes, press F8 and go to the Console tab and take a screenshot of the error trace. That can help us figure out the cause with you.

I will say that when you start mixing in VisuStella stuff it becomes harder to do things because their code is obfuscated. That means we can't actually know what's happening when the error trace references a line of code, and our ability to change code to accommodate the plugin is limited.

I recall a recent thread where someone else was having a hard time getting transformation to work with VisuStella plugins. They got support from the VS team, who said it was working on their side, but I think it was unresolved for the poster.


I would suggest you see if you can get it working with only Skills and States enabled, then turn back on other plugins and see if something breaks.
Sorry, I don't know what the "menu image" is. Typically the face image is what is shown in the party menu as well as the battle status window, but if you're using a plugin to change that to something else you'll either need to give more detail (is it a separately referenced file? A bust image?), or look at the plugin documentation to see how it's set.


When you get crashes, press F8 and go to the Console tab and take a screenshot of the error trace. That can help us figure out the cause with you.

I will say that when you start mixing in VisuStella stuff it becomes harder to do things because their code is obfuscated. That means we can't actually know what's happening when the error trace references a line of code, and our ability to change code to accommodate the plugin is limited.

I recall a recent thread where someone else was having a hard time getting transformation to work with VisuStella plugins. They got support from the VS team, who said it was working on their side, but I think it was unresolved for the poster.


I would suggest you see if you can get it working with only Skills and States enabled, then turn back on other plugins and see if something breaks.
1674573370182.png

In Battle Core, you can do this here.
1674573448586.png

And this.
1674573516878.png

In Main Menu Core, I put this style.
1674573602028.png

1674573662672.png


And in the notes, I put their configuration, both in the menu and in battle.
1674574517937.png

And it stays like that. (I didn't change the coordinates and sorry for the video driver appearing)
As I said above, if you're doing it through VisuStella plugins we can't give you the code to modify it unless that's provided by them in the plugin documentation.

I see the instructions have plugin commands to change the images. So you could make all of your transformation stuff into a common event, then just use the state notetags to call that common event.
Sorry, I don't know what the "menu image" is. Typically the face image is what is shown in the party menu as well as the battle status window, but if you're using a plugin to change that to something else you'll either need to give more detail (is it a separately referenced file? A bust image?), or look at the plugin documentation to see how it's set.


When you get crashes, press F8 and go to the Console tab and take a screenshot of the error trace. That can help us figure out the cause with you.

I will say that when you start mixing in VisuStella stuff it becomes harder to do things because their code is obfuscated. That means we can't actually know what's happening when the error trace references a line of code, and our ability to change code to accommodate the plugin is limited.

I recall a recent thread where someone else was having a hard time getting transformation to work with VisuStella plugins. They got support from the VS team, who said it was working on their side, but I think it was unresolved for the poster.


I would suggest you see if you can get it working with only Skills and States enabled, then turn back on other plugins and see if something breaks.
Is there a way to switch "off" when a state ends? Because if so, I already made a switch for it (change the image), but it only works when I leave the battle or disable the Transformation with another skill.
1674575441780.png

1674575461496.png

Sorry about the language, I wrote everything in the project in my native language. I hope you can understand.
I feel like we're going in a bit of a circle, here 😉

Back to my first reply, you'd look in Skills and States Core for a notetag equivalent to Custom Remove Effect - which you said you had already found and tried, because the code was giving you errors.

But in case you didn't actually get that far, we look in those instructions and find JS On Erase State.

I'm not sure whether you're using the word "switch" in the context of RPG Maker switches or not. If you're actually going off a switch somehow, then the script call for that is
Code:
$gameSwitches.setValue(X, false);
where X is the ID of the switch (no leading zeros).

If you want to queue up a common event, it's:
Code:
$gameTemp.reserveCommonEvent(X);

So stick the appropriate command inside of a JS On Erase State notetag.
I feel like we're going in a bit of a circle, here 😉

Back to my first reply, you'd look in Skills and States Core for a notetag equivalent to Custom Remove Effect - which you said you had already found and tried, because the code was giving you errors.

But in case you didn't actually get that far, we look in those instructions and find JS On Erase State.

I'm not sure whether you're using the word "switch" in the context of RPG Maker switches or not. If you're actually going off a switch somehow, then the script call for that is
Code:
$gameSwitches.setValue(X, false);
where X is the ID of the switch (no leading zeros).

If you want to queue up a common event, it's:
Code:
$gameTemp.reserveCommonEvent(X);

So stick the appropriate command inside of a JS On Erase State notetag.
I achieved! I made the notetag call the common event, and it was perfect! Really, Thanks for the help! And sorry for the time taken, I'm kinda noob yet.

My problem was solved, the post can be closed. Very Very Thanks.

Original thread: https://forums.rpgmakerweb.com/threads/changing-actor-image-after-a-state-end.154373/