MZ Skill Limit Help

Hey folks! I've read previous threads about making skill limits, but they seem geared towards receiving skills from like Skill Vendors or Skill Point systems. What I want is for skills you get when leveling up, just like in Pokemon and Persona. You level up, you gain skill, if you exceed the cap then the game asks if you want to forget one to make room.

How would I do that? Would I need to make a plugin for it? Or is there a way to make a common event take care of it?
Well, you just need to set the level you the player to learn a certain skill in the class command found in the database. If I understood what you are saying, you want your player to be able to equip certain amount of skills and change them when they learn a new skill.
I know Yanfly has a plugin for rpg maker mv. But for mz you will need Equip Battle Skills VisuStella MZ . It will allow you to let your player have limit to number of skills to equip .

But I can't say it will be able to do the same forget mechanics in Pokemon games.
You can also search for Pokemon essentials plugins if they have some for mz.
Yeah, I am aware of VS Equip Battle Skills, but it's not quite what I was aiming for. It's less about equipping skills and more about being given the choice to forget a skill upon learning a new one after leveling up. 'Cause the threads and tutorials I've found so far don't include suggestions for skills gained when leveling up, only for skills learned by items or tutors.

And sadly Pokemon Essentials doesn't have anything for MZ, it's all for XP.
But if you're using VS Equip Battle Skills, I guess you can have a common event run when you exit the menu to make your actors forget the skills that you haven't equipped. And then when you level up you push that skill equip scene where they can change them.

Or make something yourself, maybe make a copypaste of Window_SkillList where you show the actor skills, rename it and then make the selection make the actor forget that skill and show that when you level up.
That looks like an option, yes! I think I could make a common event like that, but how would I get it to run when the actor levels up?

Though if multiple characters level up at same time, you'd have to think how to deal with that. Maybe try to change it in a way that if the scene is pushed when you turned some switch on, pressing esc throws you to the next character who level upped instead of leaving if you try to press that. But yeah, you either need to find a way to work with that or make a custom thing for the system.
Hi there!
Made a little mockup with events. Well, almost like a plugin in a common event... haha

1 - First you iterate through all party members and check if any of them has more than 4 skills (It says "> 3 " because arrays in javascript always start with the index 0. Meaning 0 is also a skill).
  • We flip a switch so we can use that as a condition to show the choice so the player can select what skill to forget.
  • If does, we store the Actor Name and id on variables.
  • then store all skill names on variables (to be used on choice commands)
  • then store all the skill ids to be used on later script calls.
1.PNG


2 - We make each choice with each skill the actor already have.
And for each choice, we use the script call so the actor can forget the skill related to the choice.
2.PNG

3.PNG


Then on the end of the choice event, turn off the Switch 270.

This is a basic structure, without plugins. I guess you can start with this if you want.

You can place this on a parallel event to run through all the game. Put a wait 10 frames on the end of the event so you don't need to worry about performance.

That will not only cover the cases when level up, but also if you want to teach a skill to an actor with event commands for example.

Hope it helps!
Script call text:
JavaScript:
for(const member of $gameParty.members()){
const skills = member.skills()
 if(skills.lenght > 3){
  $gameSwitches.setValue(270, true)
  $gameVariables.setValue(268, member.name())
  $gameVariables.setValue(269, member.actorId())

  $gameVariables.setValue(270, skills[0].name)
  $gameVariables.setValue(271, skills[1].name)
  $gameVariables.setValue(272, skills[2].name)
  $gameVariables.setValue(273, skills[3].name)
  $gameVariables.setValue(274, skills[4].name)

  $gameVariables.setValue(275, skills[0].id)
  $gameVariables.setValue(276, skills[1].id)
  $gameVariables.setValue(277, skills[2].id)
  $gameVariables.setValue(278, skills[3].id)
  $gameVariables.setValue(279, skills[4].id)
  // Necessary add a break here, in case more than one actor has more than 4 skill at the same time. 
  // With this we can deal with one at the time.
  break

 }
}
@Eliaquim Cool! But doesn't that also have the problem that if more than 1 character level up and get a skill at the same time.

EDIT: Though can be solved by making the choices for each dude in the loop I guess
@Eliaquim Cool! But doesn't that also have the problem that if more than 1 character level up and get a skill at the same time.
Yes, it does! nice catch. I guess is just a matter of add a break on the iteration when find a member with more than 4 skills:
JavaScript:
for(const member of $gameParty.members()){
const skills = member.skills()
 if(skills.lenght > 3){
  $gameSwitches.setValue(270, true)
  $gameVariables.setValue(268, member.name())
  $gameVariables.setValue(269, member.actorId())

  $gameVariables.setValue(270, skills[0].name)
  $gameVariables.setValue(271, skills[1].name)
  $gameVariables.setValue(272, skills[2].name)
  $gameVariables.setValue(273, skills[3].name)
  $gameVariables.setValue(274, skills[4].name)

  $gameVariables.setValue(275, skills[0].id)
  $gameVariables.setValue(276, skills[1].id)
  $gameVariables.setValue(277, skills[2].id)
  $gameVariables.setValue(278, skills[3].id)
  $gameVariables.setValue(279, skills[4].id)
  // This will stop iteration and move forward with the event
  break
    

 }
}

Edited the first code!
@Eliaquim Hmmm, but don't you still need to restructure the event so that it goes through all the members? Now when you break you get the first dude who got more skills, but then it never checks the others after that.
@Eliaquim Hmmm, but don't you still need to restructure the event so that it goes through all the members? Now when you break you get the first dude who got more skills, but then it never checks the others after that.
It will check the others because it's a parallel event. When the break is used, the loop will stop with the variables assigned.
Then it will proceed to what left of the event list.
When the event ends, since it is a parallel event, it will run again, checking the party members all over again.
Ah ok cool, yeah if you keep running it on parallel.
Eliaquim, I could kiss your right now! I'll go ahead and test this right away, and I'll report with my findings!
@Eliaquim Well, reporting with good news and bad news! The good news, the event runs! It detects when a new skill is being added and procs the choice menu...

The bad news is that it doesn't actually delete the skill... or move on to another Actor. It just repeats the same set of names and variables as many times as Actors have gained skills.
@Eliaquim Well, reporting with good news and bad news! The good news, the event runs! It detects when a new skill is being added and procs the choice menu...

The bad news is that it doesn't actually delete the skill... or move on to another Actor. It just repeats the same set of names and variables as many times as Actors have gained skills.
I found the problems, my bad!

1 - There was a typo on skills.lenght. The right would be `skills.length`
2 - The amount of skills to check was wrong. Before we have skills.length > 3. The right would be skills.length > 4
You can replace the first script call block with this already fixed:
JavaScript:
for(const member of $gameParty.members()){
    const skills = member.skills()

    if(skills.length > 4){
        $gameSwitches.setValue(499, true)
        $gameVariables.setValue(268, member.name())
        $gameVariables.setValue(269, member.actorId())

        $gameVariables.setValue(270, skills[0].name)
        $gameVariables.setValue(271, skills[1].name)
        $gameVariables.setValue(272, skills[2].name)
        $gameVariables.setValue(273, skills[3].name)
        $gameVariables.setValue(274, skills[4].name)

        $gameVariables.setValue(275, skills[0].id)
        $gameVariables.setValue(276, skills[1].id)
        $gameVariables.setValue(277, skills[2].id)
        $gameVariables.setValue(278, skills[3].id)
        $gameVariables.setValue(279, skills[4].id)
        break
    }

}

3 - There is another typo on each choice script command to forget the skill:
1774640859884.png

the first line `const actorId...` has a typo. It's missing an "s" at the end of $gameVariable. You need to fix that on each script block.

4 - You need to turn the switch off at the end of the choice command:

1774641120541.png


I tested it now and it worked!
[EDIT] If you still having problems, and checked that every switch and variable id are right, send me a screenshot so I can take a look
@Eliaquim This is what I have! I did notice the typos and the > 3, so don't worry about them!1774643715538.png
1774643949510.png

It works pretty well, but what ends up happening is that for some reason, it runs twice. First time it runs okay, displays the message X forgot the move... and then it prompts to choose which move to forget once more before ending. And if more than 1 Actors gain skills, the second loop has the skills of the next Actor but still displays the first actor's name, the third loop has the the second Actor's name and skills, and then it repeats that once more before it finishes.
@Eliaquim This is what I have! I did notice the typos and the > 3, so don't worry about them!View attachment 363619
View attachment 363620

It works pretty well, but what ends up happening is that for some reason, it runs twice. First time it runs okay, displays the message X forgot the move... and then it prompts to choose which move to forget once more before ending. And if more than 1 Actors gain skills, the second loop has the skills of the next Actor but still displays the first actor's name, the third loop has the the second Actor's name and skills, and then it repeats that once more before it finishes.
That is strange... The only reason I can see that happening is if you have another parallel common event doing the same thing.
maybe also if an actor learn more than one skill per level up(or event command)? That maybe would cause a strange behavior.
I did manage to make it work here. So, if you want you can send me a sample project replicating the error so I can take a look.
That is strange... The only reason I can see that happening is if you have another parallel common event doing the same thing.
maybe also if an actor learn more than one skill per level up(or event command)? That maybe would cause a strange behavior.
I did manage to make it work here. So, if you want you can send me a sample project replicating the error so I can take a look.

Here it is! Hopefully this works?
Here it is! Hopefully this works?

There are two problems here.
1 - You are using the same switch that activates the common parallel event to also checks when the actor has gained more than 4 skills on the conditional branch. They need to be different switches. One for activate the event. Another one to be set to true inside the script call and on the conditional branch.
1774656630622.png

2 - You have a plugin called SkillCheck that is calling the same common event. So that is why the common event is being called twice.
1774656727130.png


once I deactivate that plugin and fixed the switches, everything worked just fine.
1774656781105.png
Oooh, I completely forgot about that plugin! A friend from Discord was helping me out and made it for me, I forgot to remove it once I asked here. Oh my God, I feel so embarrassed...

As for the switch, I for sure confused your screenshots. I thought the switch you activated by code and the one on the conditional branch where the same. Now I know

Original thread: https://forums.rpgmakerweb.com/threads/skill-limit-help.183017/