MZ Creating a Skill/State that Transforms an Actor and Temporarily Changes its Sprites

I am looking for a plugin to visually enhance a skill that inflicts a state on the user that transforms a character. This plugin would switch a character’s SV sprite sheet and walking sprite sheet (my game has map battles using the SRPG Core plugin) to different sprite sheets showing the transformed form for the duration of the transformation state (I’m thinking 5 turns) and would then change the sprite sheets back to the originals at the end. The transformation would boost the character’s stats for its duration, but only allows the transformed character to use one skill, an attack that is part of the state.

I set up most of this without plugins, but changing the sprite sheets for the character is where the problem lies. I can use a common event to change the sprite sheets, but they don’t revert back to the original sprite sheets once the transformation state wears off.

I believe Yanfly made a transformation plugin and I looked into it, but some of the major plugins I’m using in my game, such as SRPG Core, are not compatible with the Yanfly/VisuStella plugins.

I will credit whoever makes this plugin in my end-game credits.

Transformation skill
Transformation Common Event.jpg

Transformation state
Transformation State.jpg
Maybe you can add a state or buff. When the state/buff is removed, use the common event to change it back.
Hi there!

You can keep doing what you are doing. But before change the sprite, you can add the current sprite file names(Map, Battle, and face) into variables.

When the state/turns has expired, you can change the character image back to it's original using the variables.

You can find the proper script calls for that on the Master Script Call list.
Maybe you can add a state or buff. When the state/buff is removed, use the common event to change it back.
This is kind of what I did. The problem is triggering the common event that changes the transformed sprites back to the normal ones. Do you have any ideas on how to do this?
Hi there!

You can keep doing what you are doing. But before change the sprite, you can add the current sprite file names(Map, Battle, and face) into variables.

When the state/turns has expired, you can change the character image back to it's original using the variables.

You can find the proper script calls for that on the Master Script Call list.

This sounds great in theory. How do I set this up? A solution that doesn't require any plugins is actually ideal for me. Do I make the map, battle (I assume you mean SV sprites) and face sprite sheets each their own variable? Where do I insert the variables?

Also, where do I insert the script call? Script calls are something I've recently started experimenting with and learning how to use.
This is kind of what I did. The problem is triggering the common event that changes the transformed sprites back to the normal ones. Do you have any ideas on how to do this?


This sounds great in theory. How do I set this up? A solution that doesn't require any plugins is actually ideal for me. Do I make the map, battle (I assume you mean SV sprites) and face sprite sheets each their own variable? Where do I insert the variables?

Also, where do I insert the script call? Script calls are something I've recently started experimenting with and learning how to use.
There are several ways for it.
But I guess all of them will require the use of script call. That's why I gave you the link to the spreadsheet. Besides that, you can lear how to use script calls through the forum too.

But my first approach would be reserve 3 variables for each member or actor id that can use the transform feature.
Each variable will hold a filename, for Map, Sv, and face.

After that you can change the actor images, and then, when need to return to the originals, you would use the correct script calls to restore the original filenames that are stored on the variables.

Example:
$gameActors.actor(ID)._characterName // Returns the map character name.
$gameActors.actor(ID).setCharacterImage(file, index) // change the actor image.

// Restore the original image.
$gameActors.actor(ID)._characterName = $gameVariables.value(id)

You just need to find out the others on the Master Script Call list.
I have used script calls on maps with parallel events (and have done some aesthetic things with them like letting players walk on diagonal stairs and have reflections in mirrors,) but I’m confused about how to run script calls in battles.

I have tried using a common event that is activated as part of the Transformation skill to run the script call, but it keeps crashing my game.

Script Call Error Message.jpg

(I can take another one if the pop-up is blocking anything important)

I’m also unsure about how the game will recognize that five turns with the Transformed state have passed and activate the script call that will revert transformed characters to their normal selves.

I created three variables for the face, SV sprite sheet and walking sprite sheet like you suggested, though I am still not sure how the variables play a part in this.
I have tried using a common event that is activated as part of the Transformation skill to run the script call, but it keeps crashing my game.
Unexpected token means you have incorrect syntax, such as an extra parenthesis or brace. I don't see where you posted the actual code you're trying to use, but there's a syntactical error in it.

(It's generally more helpful to click over to the Console tab and post the error trace from there. It's the same info but more legible).

I’m also unsure about how the game will recognize that five turns with the Transformed state have passed and activate the script call that will revert transformed characters to their normal selves.
1 - When your skill that transforms the actor puts the state on them, have a common event turn a switch on and sets a variable to 5.

2 - Make a troop event with the condition of that switch that runs each turn and decrements the variable. When it's 0, look for the actor that has the state, remove it, and run the code to transform the graphics back.

I created three variables for the face, SV sprite sheet and walking sprite sheet like you suggested, though I am still not sure how the variables play a part in this.
They don't really if you're going to do this via events. When you're checking for an actor to have a state using event commands, you have to do it by each specific actor, so all of the commands you put inside of that conditional branch can know which actor you're looking at.

If you were doing this through code, the code would need to be more ambiguous so it could be used on any actor, so you'd need to know which the original graphics were to set them back.
Unexpected token means you have incorrect syntax, such as an extra parenthesis or brace. I don't see where you posted the actual code you're trying to use, but there's a syntactical error in it.

(It's generally more helpful to click over to the Console tab and post the error trace from there. It's the same info but more legible).


1 - When your skill that transforms the actor puts the state on them, have a common event turn a switch on and sets a variable to 5.

2 - Make a troop event with the condition of that switch that runs each turn and decrements the variable. When it's 0, look for the actor that has the state, remove it, and run the code to transform the graphics back.


They don't really if you're going to do this via events. When you're checking for an actor to have a state using event commands, you have to do it by each specific actor, so all of the commands you put inside of that conditional branch can know which actor you're looking at.

If you were doing this through code, the code would need to be more ambiguous so it could be used on any actor, so you'd need to know which the original graphics were to set them back.
Thank you! This is the kind of information I was looking for. :LZSjoy:

So far, this is what I have for the common event.

Transformation Common Event V2.jpg


Here is how I set up the troop event.

Troop Transformation Settings.jpg


The actor sprites will change (for the sake of testing, I'm having these change to Reid's sprites,) but they will not change back to Dawn's (the actor) sprites once the state wears off.
Okay, there's a lot of stuff there.

1 - Why do you have quotation marks around your code? That's not JavaScript commands, that's a character string (e.g. actual words).

2 - Where did "actor" come from? Without that variable being defined someplace, it doesn't mean anything.

3 - Why are you using code at all? Why aren't you using the same Change Actor Images event command you're using in your common event?
Okay, there's a lot of stuff there.

1 - Why do you have quotation marks around your code? That's not JavaScript commands, that's a character string (e.g. actual words).

2 - Where did "actor" come from? Without that variable being defined someplace, it doesn't mean anything.

3 - Why are you using code at all? Why aren't you using the same Change Actor Images event command you're using in your common event?
So I don't need to use a script call at all? I posted what I came up with below. Even using the Change Actor Images command, the sprites still will not change back to the original actor sprites. I'm not sure what I did incorrectly. I didn't change anything in the Common Event I posted in the previous post, or the Skills or States involved.


Troop Transformation Settings V2.jpg
So I don't need to use a script call at all?
I don't see why you'd think so - your initial common event didn't use JavaScript, so why would the troop event have to? 😉

I'm not sure what I did incorrectly.
Your math is wrong. The first line is saying "variable 47 -= -1" which is the same as saying "variable 47 +1" - you're making the value higher not lower. Clearly, it will never reach 0 that way.
I don't see why you'd think so - your initial common event didn't use JavaScript, so why would the troop event have to? 😉


Your math is wrong. The first line is saying "variable 47 -= -1" which is the same as saying "variable 47 +1" - you're making the value higher not lower. Clearly, it will never reach 0 that way.
I changed the variable from -1 to 1 and now the transformation works correctly! Thanks!

It's good to know that having a negative variable subtract will actually add to the variable, not subtract from it. Logically it makes sense.

It's funny how I started this topic requesting a plugin and ended up learning more about how variables and script calls work. :LZSsmile: That works out well, since I had already started teaching myself about them and now I know more.
I did a plugin commission for this exact thing for battles recently, if you want I can see if the client is okay with me sharing it with you tweaked to change map graphics as well.

Original thread: https://forums.rpgmakerweb.com/threads/creating-a-skill-state-that-transforms-an-actor-and-temporarily-changes-its-sprites.152537/