How to make characters evolve through leveling?

Hello,
I'd like to make characters evolve in a way similar to Pokémon. I followed this video's instructions but I failed. Admittedly it's for MV, not MZ. Does someone know how to make characters evolve through leveling in MZ?
Thanks for reading.
In what way did following the instructions fail?
In what way did following the instructions fail?
Not much happened. The messages were displayed, but the character didn't change. No error message, but no evolution either.
Did you turn switch 1 on?
You'll need to post screenshots of your events and class list for us to help.

I'd also suggest you avoid some of that user's habits in events...if you use a variable just to store one number and reference it one time, and you never do any manipulation to that variable, that's a waste. Never mind doing it multiple times in potentially every event 🙄
Did you turn switch 1 on?
Yes. I chose a different switch because 1 was used, but I made sure to turn the relevant switch on. I'm not sure the messages would have been displayed if I hadn't.
You would use a Common Event that checks the level of that character. If character reaches that level you could change their class.
Capture.PNG
You'll need to post screenshots of your events and class list for us to help.

I'd also suggest you avoid some of that user's habits in events...if you use a variable just to store one number and reference it one time, and you never do any manipulation to that variable, that's a waste. Never mind doing it multiple times in potentially every event 🙄
evolution common event.png
Class list.png

Here they are. I simplified the event a bit since I didn't care about seeing the name of the pokémon/evolution.
You would use a Common Event that checks the level of that character. If character reaches that level you could change their class.
View attachment 185081
That would work, but I'd have to do it for every single character and I plan to have around 50 (without the evolutions). I saw a tutorial for a more efficient way and I was hoping to see what I was doing wrong.
Why are you only setting 1 variable in your version when the original used four? The important ones are "the actor ID of party position 0" and "Party 0's class ID". You have neither of these in yours, so the code doesn't know which actor to change the class of. It is, in fact, trying to change the class of actor 0, which doesn't exist because the IDs of the database actors start at 1.
Why are you only setting 1 variable in your version when the original used four?
The original stored the names in two different variables. But I didn't see the last one for some reason, which might be why it didn't work. Sorry.
Edit: nevermind, I added that variable and it still doesn't work.
evolution common event.png
You are changing the class of the actor ID stored in variable 3. We never see where you set the value of that variable.

This is part of what I was talking about with the unnecessary use of variables...if you have too many that you only use once, it's easy to lose track. That line should read:
Code:
$gameActors.actor($gameParty.members()[0].actorId()).changeClass($gameActors.actor($gameParty.members()[0].actorId()).currentClass().id+1, true)

And then you don't need the line of script with n=. Or you can put back in the additional variables at the top, just substituting the appropriate numbers when his original script references $gameVariables.value(X), and putting the correct number for the X.

But if you're copying code, you need to copy it exactly...you can't just leave out those two variables he set at the top because he did use them later. So if you take out those variable declarations, you need to then replace the places where they're referenced. (and one of those references to a variable...was just to set another variable 😮 Good lord, dude...)
Yeah, I would just have done that part in JS code and assigned the final value to a single game variable, honestly.

But as ATT_Turan said, you still have 3 as the ID of the variable storing the ID of the actor whose class you're changing. But unless you actually assign a value to variable 3, it will default to 0, and actor ID 0 doesn't exist.
Yeah, I would just have done that part in JS code and assigned the final value to a single game variable, honestly.

But as ATT_Turan said, you still have 3 as the ID of the variable storing the ID of the actor whose class you're changing. But unless you actually assign a value to variable 3, it will default to 0, and actor ID 0 doesn't exist.
I don't know any JS, if that wasn't obvious enough. It's on my to-do list, but I'm already having enough trouble learning human languages. Thanks for the explanation.
You are changing the class of the actor ID stored in variable 3. We never see where you set the value of that variable.

This is part of what I was talking about with the unnecessary use of variables...if you have too many that you only use once, it's easy to lose track. That line should read:
Code:
$gameActors.actor($gameParty.members()[0].actorId()).changeClass($gameActors.actor($gameParty.members()[0].actorId()).currentClass().id+1, true)

And then you don't need the line of script with n=. Or you can put back in the additional variables at the top, just substituting the appropriate numbers when his original script references $gameVariables.value(X), and putting the correct number for the X.

But if you're copying code, you need to copy it exactly...you can't just leave out those two variables he set at the top because he did use them later. So if you take out those variable declarations, you need to then replace the places where they're referenced. (and one of those references to a variable...was just to set another variable 😮 Good lord, dude...)
Thanks for the explanation and the code.
Check out my Jump into JavaScript series, if you need a starting point for learning.
I don't know any JS
And that's fine, but it means it's even more important for you to make sure you're copying code exactly if you don't understand what you're changing.

For this kind of thing, you don't actually need to know any JavaScript in terms of being able to write code - he's just using script calls to reference things, so $gameVariables.value(3) means "the value of variable 3," which is pretty plain to understand if you read it.

That being said, this is not going to be the only time you want to do something in your game that is either easier or necessary to do with script, so doing the Jump into JavaScript and other tutorials is very worth your time.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-characters-evolve-through-leveling.135179/