@Shaz Good point, I am actually thought about this problem last night.
While, I agree plugins and scripts are always the best way to solve problems, just.....as long as you have the knowledge to create them.
For people like me, who have no Javascript background, it is really improsible to write a script to solve the problem. It's much easier to just play with MV's default functions.
I always question myself why my major wasn't software programming, when everytime I stuck with my project. LOL!
Anyway, lets go back to the problem.
I spent some time this morning and played with MV a bit, and found a few other ways to set up the same function.
Among them I believe use parallel common event to set up this function is still the easiest way. But, if parallel common event really causes lagging problems to
@ddblue your project, I can give you an alternative solution.
Forgive me not upload images this time. It really gives me headache to adjust all the screenshots. If you're interested in the alternative solution, and need example of it. Just Notify me. I will upload images when I got time.
First of all, lets start with what we need.
We still need 3 variables:
good variable, evil variable, Actor level.
Then we need 5 switches:
Good skill learn, evil skill learn, Moral state check, Level Check, and Battle Check.
Now lets set up the events.
First of all, set up an autorun map event to turn on Battle Check switch. Remember to also turn on selfswithch-A for this event, and add a second page which runs when selfswitch-A is on. This is to stop this event.
As for my understanding, the good variable and the evil variable will be changed through events.
So, we can add a trigger at the end of those events to turn on Moral state check switch.
Create a common event that autoruns when Moral state check switch is on.
In this event, there are two conditional branches:
If good variable is greater than evil variable
------turn on Good skill learn switch
------turn off evil skill learn switch.
If evil variable is greater than good variable,
------turn on evil skill learn switch
------turn off good skill learn switch.
And below above two conditional branches, add 'turn on Level Check switch'.
At the end of this event, turn off Moral state check switch, so this event stops running.
Next, lets go to Troops page in database, in each Troop, add a battel event to turn on Level Check switch under condition when Battle Check switch is on, span: Battle.
Now, create an autorun common event when Level Check switch is on.

Add this at the top to get the actors level.
And then, add two Conditional Braches.
------If good skill learn switch is on.
------If evil skill learn switch is on.
Under each conditional brach, add below conditional braches to teach actor corresponding skills.
If: variable Actor Level = X
------Change Skils = ActorX, +Skill name
Finally, at the end of this event, turn off Level check switch.
Last but not least, upon revise my solution, I just realized that you may want to delete all the learned skills incase the actor changed his moral state halfway in the game.
I am guessing you don't want the actor to keep good skills when his evil variable becomes greater in the middle of the game, vice versa.
If I'm wrong, just ignore the following.
In the common event that runs when Level Check switch is on, add below content under conditional branches 'if good skill learn switch is on'.
Change skill = ActorsX, -All the evil skills
And add below content under conditional branches 'if evil skill learn switch is on'.
Change skill = ActorsX, -All the good skills
This should do the trick.
Hope this helps!
😂