How to change Max Level of Actor?

Hi, I want to implement a system where a character needs to fulfill certain requirements (using variables) to increase their maximum attainable level.
Say when you're in stage 1, you can only get to level 10 and all additionally gained exp will be useless and count for nothing, until you reach stage 2 where you can suddenly reach a maximum level of 20. You will then need to start gaining experience again because any excess experience from before doesn't count.
I also want you to be able to get demoted, so when you fall back down from stage 2 to stage 1, your level will shrink back to level 10 and you will need to start over, and you won't reach level 20 instantly when you return to stage 2.
Any ideas?
I know how to change levels with events, but i'd like away to change a max level parameter like you can change max hp etc.
Did you look? I've provided code for this several times (and seen other threads as well).

Here's a thread that allows you to change the level cap.

Here's a version that has individual level caps per actor.

I also want you to be able to get demoted, so when you fall back down from stage 2 to stage 1, your level will shrink back to level 10
Just use event commands to change the level down.
Did you look? I've provided code for this several times (and seen other threads as well).

Here's a thread that allows you to change the level cap.

Here's a version that has individual level caps per actor.


Just use event commands to change the level down.
Thanks, I did look for something lik this but didnt see them for some reason
I searched max level so maybe thats why the level cap titled thread didnt show up
Probably because you saw the solution was originally for MV? The yanfly solution, for example, might not work in MZ.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-change-max-level-of-actor.169144/