Need help with Transformation mechanic in MZ

BedamX

Villager
Member
Joined
Jan 15, 2022
Messages
6
Reaction score
3
First Language
German
Primarily Uses
RMMZ
Hello all.
So my promblem is this: I'm planning on using a Shaman type character that can transform different "animal stances" which grand them bonuses to different stats. In order to showcase the different stances, I want to change the character's SV Battler into the specific animal battle sprite for a short amount of time.
The stat changes work just fine but the transformation isn't happening in battle. I tried to create the effect with a skill that triggers 1. a status that changes the stats of the character and 2. a common event that triggers the change of sprites - waits - and then transforms the character back. But the sprite change just does not happen. I already tried just changing the sprite once (into a bear) but that also didn't work. I've attached what I've done in trying to make this work.

Thanks in advance for any help!
 

Attachments

  • troubleshoot1 skill.png
    troubleshoot1 skill.png
    298.1 KB · Views: 20
  • troubleshoot2 state.png
    troubleshoot2 state.png
    241.4 KB · Views: 20
  • troubleshoot3 common event.png
    troubleshoot3 common event.png
    101.8 KB · Views: 21

Htlaets

Veteran
Veteran
Joined
Feb 1, 2017
Messages
321
Reaction score
174
First Language
English
Primarily Uses
Yeah, irrc actor images don't get updated in the middle of battle unless you add and remove the actor from the party to force a refresh (I think the transformation in the store page video happens by swapping actors, you can tell because the TP and MP changes when the transformation happens). Could try the adding and removing thing with a bright flash so the player can't see the add remove movement.

For your use-case the common event would be:
Change actor image bear
Remove actor from party
Add actor to party
Force skill-whatever skill you're doing
change actor image back
remove
add

There might be a way to force a refresh with a script, but I don't know the script.

The way I did mid-battle transformations in MV was to use yanfly's plug-ins, you might be able to achieve the same thing with visutella's stuff.
that's the tutorial to do it with yanfly's, if you can find equivalent commands in visutella's stuff you could pull off the same thing.
 
Last edited:

Gallas

Villager
Member
Joined
Oct 1, 2018
Messages
25
Reaction score
22
First Language
English
Primarily Uses
RMMV
I've been porting my game from MV to MZ which includes a shapeshifter character. I will tell you how I did it using Visustella. The shapeshifter is one of the most annoying things to implement so I feel your pain. This solution is very simple and very effective (as opposed to the pages of notetags I was using in MV!)

For this example, my shapeshifter is turning into a mouse.

My Skill is very basic. An effect is 'Common Event Mouse' with a <Custom Action Sequence> in the notetag.

The State (of Mouse) is also fairly basic. For Traits, I add 'Add Skill Type: Mouse' with other effects being 'Seal Equip: Weapon', Seal Skill: Attack, Seal Skill Type: Shifter, as well as Lock Weapon.

The Common Event I put your usual 'spell casting' action sequence. It is there that I change the state of the actor. I also change the actor image there as well.

Then I have ANOTHER Common Event that is activated after the battle. This is toggled using a parameter found in Visustella BattleCore. This is where I REMOVE the animal state. It is also where I change the actor image back.

Those four 'things' above are fairly simple, and they work together to fluidly change the actor to whatever monster you want (with whatever skills) and change it back after the battle is over. I've hammed it up more where the image change alters the actor's portrait, map sprite, face sprite, even alters the map character's speed, and so on. But none of that is necessary to do what you want.
 
Joined
Jul 8, 2021
Messages
73
Reaction score
70
First Language
English
Primarily Uses
RMMZ
Interesting topic! Here are my suggestions, though this isn't a perfect solution. I'm setting up a transformation system as well, with a couple characters that transform, but only have one transformation each.

When my characters transform, they change in appearance, gain stat boosts and stay transformed for a limited number of turns. While they are transformed, they gain a new attack, but they only have access to that one attack until the transformation wears off.

To show how I programmed this, I have two skills and a common event set up for each character's transformation. In this test project, only two characters transform.

Transformation Programming Skill-Part 1.jpg
Transformation Programming Skill-Part 2.jpg
Transformation Programming Common Event-Part 1.jpg
Transformation Programming State-Part 1.jpg

I like my system except for one problem. When the characters' transformations wear off, their attack options and stats return to normal, but the character image shows the transformed form. Currently I'm trying to figure out a solution to this issue, and people have some good ideas about transformations on this topic so far.
 
Last edited:

Arthran

Veteran
Veteran
Joined
Jun 25, 2021
Messages
360
Reaction score
325
First Language
English
Primarily Uses
RMMZ
Actor images *do* refresh in battle, and the OP doesn't need a plugin to fix the problem that he/she is experiencing. The reason the OP's transformation isn't working is because of this:

Code:
◆Change Actor Images:Bear, bear(0), bear form(0), bears

You're using the command on the wrong actor. You're not supposed to be using it on an actor named "Bear". Presumably, you're supposed to be using the command on the actor named "Alok". Your command should look like this:

Code:
◆Change Actor Images:Alok, bear(0), bear form(0), bears

Though since your current 'Wait' is only set to 60 frames, he's only going to transform for 1 second, so you might miss it if you blink.
 
Last edited:

Arthran

Veteran
Veteran
Joined
Jun 25, 2021
Messages
360
Reaction score
325
First Language
English
Primarily Uses
RMMZ
@Magenta-Fantasies

There are 2-3 issues in the setup that you posted.

The first issue is that your Transformation Common Event is changing some of the actor's parameters, but then you aren't ever changing them back at any point. That means you're permanently adding +100 to Attack, Max HP, and Defense every time the player uses that skill. I assume this is not your intention.

The second issue is that your Transformation Common Event is adding the Transformed Test state. That is unnecessary, because you're already adding that state in the Skill Effects. Adding it twice won't necessarily harm anything in a default setup, but it can cause problems in conjunction with certain plugins, and since it's an unnecessary thing to do, it should probably be avoided.

The third issue may not be an issue, depending on your intentions, but with your current settings, it's possible for the character to remain transformed after the battle ends. Maybe you want that to be the case, but if not, you should tick the box that says "Remove at Battle End", on your Transformed Test state.

As far as your dilemma with reverting the image back to the original goes:
If you wanted the transformation to last the entire duration of a battle, it would be really simple to undo it after the battle, without any plugins. But if you want it to have a turn limit, it would be kind of a pain in the butt to implement without the use of a plugin, because you'd basically have to add some code into every one of your Troop events to check (every turn) whether or not the actor's appearance needs to be reverted.

The more efficient way to do it would be to use a plugin such as VisuStella's Skills and States Core. That would enable you to add some JavaScript code into the note tag of your Transformed Test state. You can specify when you want the code to be executed (i.e. when the state is added, or when the state is removed). You could use that feature to execute code that reverts the appearance of your character back to its original form once the state wears off.

You could either use JavaScript to call a common event which handles this for you, or you can just change the appearance through JavaScript calls.
 

BedamX

Villager
Member
Joined
Jan 15, 2022
Messages
6
Reaction score
3
First Language
German
Primarily Uses
RMMZ
@Gallas your solution works with what I want to do. Only problem is that stats change for a short moment because I'm changing actors and they might not be the same level (I would need to find a way to level the beast forms along with the character themselves). But it does what I want it to do on a visual level, so thank you!
@Arthran Your solution acutally works perfectly. I can't believe I didn't realize I can just change the images in the Common Event. I thought I had to prepare the forms beforehand and then change between them.

Problem solved, thank you again!
 
Joined
Jul 8, 2021
Messages
73
Reaction score
70
First Language
English
Primarily Uses
RMMZ
@Magenta-Fantasies

There are 2-3 issues in the setup that you posted.

The first issue is that your Transformation Common Event is changing some of the actor's parameters, but then you aren't ever changing them back at any point. That means you're permanently adding +100 to Attack, Max HP, and Defense every time the player uses that skill. I assume this is not your intention.

The second issue is that your Transformation Common Event is adding the Transformed Test state. That is unnecessary, because you're already adding that state in the Skill Effects. Adding it twice won't necessarily harm anything in a default setup, but it can cause problems in conjunction with certain plugins, and since it's an unnecessary thing to do, it should probably be avoided.

The third issue may not be an issue, depending on your intentions, but with your current settings, it's possible for the character to remain transformed after the battle ends. Maybe you want that to be the case, but if not, you should tick the box that says "Remove at Battle End", on your Transformed Test state.
These are all good points. I fixed these issues. Thanks for your feedback!
As far as your dilemma with reverting the image back to the original goes:
If you wanted the transformation to last the entire duration of a battle, it would be really simple to undo it after the battle, without any plugins. But if you want it to have a turn limit, it would be kind of a pain in the butt to implement without the use of a plugin, because you'd basically have to add some code into every one of your Troop events to check (every turn) whether or not the actor's appearance needs to be reverted.

The more efficient way to do it would be to use a plugin such as VisuStella's Skills and States Core. That would enable you to add some JavaScript code into the note tag of your Transformed Test state. You can specify when you want the code to be executed (i.e. when the state is added, or when the state is removed). You could use that feature to execute code that reverts the appearance of your character back to its original form once the state wears off.

You could either use JavaScript to call a common event which handles this for you, or you can just change the appearance through JavaScript calls.
I downloaded the Skills and States Core and I am looking into its features in-depth. I'm not exactly sure how to use this to get the effect I need. I've experimented with using the common event to turn on a "transformation" switch and then using the Transformation state notetag to remove the transformation after a certain number of turns. Neither of these worked.

Using JavaScript in the skill or state notes to tell the Transformation common event to end, or to trigger a second common event that would revert the character's appearance, would be the easiest way to handle this. Where can I find the JavaScript calls to do this?

Another option I thought of (though I can't get it to work) is to have an always-running parallel event that checks if the character is in the Transformation state. If not, its appearance reverts to the normal appearance. Using a parallel event isn't ideal, and I have to have an event on each map (or even just the very first map in the game) to turn on the switch the parallel event connects to. I'm not sure why this isn't working as intended, or if I'm on the right track.
Transformation Comment Event Parallel 1.jpgTransformation Comment Event Parallel 2.jpg
 

Arthran

Veteran
Veteran
Joined
Jun 25, 2021
Messages
360
Reaction score
325
First Language
English
Primarily Uses
RMMZ
@Magenta-Fantasies

The parallel common event idea isn't going to work, because parallel common events don't run while you're in battle. This is actually the primary reason why I said it'd be a really simple matter if transformation lasted the entire battle, but it's a bit trickier if you want transformation to have a turn limit.

But as long as you don't mind using Skills and States Core, it's still pretty simple to achieve your goal. To make your State call a common event when it wears off, here is what you'd want in your State's note box:

Code:
<JS On Erase State>
  $gameTemp.reserveCommonEvent(ID);
</JS On Erase State>

Just replace ID with the numerical ID of your common event. But don't put the leading 0s--i.e. just put 7 instead of 007.

You can also use the <JS On Add State> tag to do stuff when the state gets applied, if you want. Since you're already calling the initial common event when the skill is used, that's not actually necessary, but if you'd prefer to consolidate things and call both common events from the state instead, you can.

So for example, suppose you wanna call Common Event 7 once the State is applied, and Common Event 8 once it is removed, here is what your State's note box would look like:

Code:
<JS On Add State>
  $gameTemp.reserveCommonEvent(7);
</JS On Add State>
<JS On Erase State>
  $gameTemp.reserveCommonEvent(8);
</JS On Erase State>

That way, you could have CE 7 apply the transformation, and CE 8 revert it. If you'd rather not use two different common events, they could be combined, and the common event that you posted is on the right track in terms of how. However, I'm not quite sure if your is affected by Transformed conditional will work or not.

The reason is because it depends on how the plugin was implemented. For example, I don't know if the On Add State code gets executed right before the state is added, or right after. That would determine whether the is affected by Transformed conditional evaluates to true or false. The same thing applies to the On Erase State code... we'd need to know whether it executes right before the state is removed, or right after. The wiki doesn't make this clear.

You could probably do some testing to figure out the answer to that question. Otherwise, you could just play it safe, and base your conditional on a switch instead. The pseudocode for your common event would look something like this:

Code:
if Switch is OFF
  do transformation
  turn Switch ON
else
  revert transformation
  turn Switch OFF
end

Then it would toggle the transformation every time that CE is called.
 
Last edited:
Joined
Jul 8, 2021
Messages
73
Reaction score
70
First Language
English
Primarily Uses
RMMZ
@Magenta-Fantasies

The parallel common event idea isn't going to work, because parallel common events don't run while you're in battle. This is actually the primary reason why I said it'd be a really simple matter if transformation lasted the entire battle, but it's a bit trickier if you want transformation to have a turn limit.

But as long as you don't mind using Skills and States Core, it's still pretty simple to achieve your goal. To make your State call a common event when it wears off, here is what you'd want in your State's note box:

Code:
<JS On Erase State>
  $gameTemp.reserveCommonEvent(ID);
</JS On Erase State>

Just replace ID with the numerical ID of your common event. But don't put the leading 0s--i.e. just put 7 instead of 007.

You can also use the <JS On Add State> tag to do stuff when the state gets applied, if you want. Since you're already calling the initial common event when the skill is used, that's not actually necessary, but if you'd prefer to consolidate things and call both common events from the state instead, you can.

So for example, suppose you wanna call Common Event 7 once the State is applied, and Common Event 8 once it is removed, here is what your State's note box would look like:

Code:
<JS On Add State>
  $gameTemp.reserveCommonEvent(7);
</JS On Add State>
<JS On Erase State>
  $gameTemp.reserveCommonEvent(8);
</JS On Erase State>

That way, you could have CE 7 apply the transformation, and CE 8 revert it. If you'd rather not use two different common events, they could be combined, and the common event that you posted is on the right track in terms of how. However, I'm not quite sure if your is affected by Transformed conditional will work or not.
I took out the conditional in the common event and created two common events as you suggested to apply and revert the transformation. It works perfectly! Thanks so much for your help!
I took out the conditional and structured the common event the way you suggested.
The reason is because it depends on how the plugin was implemented. For example, I don't know if the On Add State code gets executed right before the state is added, or right after. That would determine whether the is affected by Transformed conditional evaluates to true or false. The same thing applies to the On Erase State code... we'd need to know whether it executes right before the state is removed, or right after. The wiki doesn't make this clear.

You could probably do some testing to figure out the answer to that question. Otherwise, you could just play it safe, and base your conditional on a switch instead. The pseudocode for your common event would look something like this:

Code:
if Switch is OFF
  do transformation
  turn Switch ON
else
  revert transformation
  turn Switch OFF
end

Then it would toggle the transformation every time that CE is called.
 

Latest Threads

Latest Posts

Latest Profile Posts

And today we got some insides maps from the town i posted last time.

Map044.png
Map045.png
Map046.png
Map047.png Map048.png Map049.png Map050.png
So a big bug that was on a glue trap at home is now magically not on the glue trap. This feeling of terror I'm experiencing could be a fun thing to put in my game project (not the IGMC one).
Hoping that Unite has a character generator with black hairs/lips and other features.. it is such a pain making characters without these...
Today is my dad's birthday! And he's still going strong in his retirement days!

Forum statistics

Threads
123,395
Messages
1,156,260
Members
161,852
Latest member
Niks
Top