How do i lock special or magic till a skill or magic is learned?

i am wanting to to seal way magic and special for my game but it seems i cant find any where for help.
basicly i hwabe the fire magic learned at level 5 but i want to gray out the option till fire is learned

I've moved this thread to RPG Maker MV. Thank you.

I have something that hides it until you learn a skill of that type, but not something that greys it out... just in case that's good enough for you, here it is:

Code:
(function(){
    Window_ActorCommand.prototype.addSkillCommands = function() {
        var skillTypes = this._actor.addedSkillTypes();
        skillTypes.sort(function(a, b) {
            return a - b;
        });
        var knownTypes = new Set();
        this._actor.skills().forEach(function(skill) {
            knownTypes.add(skill.stypeId);
        });
        skillTypes = skillTypes.filter(knownTypes.has.bind(knownTypes));
        skillTypes.forEach(function(stypeId) {
            var name = $dataSystem.skillTypes[stypeId];
            this.addCommand(name, 'skill', true, stypeId);
        }, this);
    };
})();

Note: with a few changes, that code could probably get the command greyed out instead of hidden.

To use it, copy-paste it into a plugin, save it as SFG_SkillTweaks.js (or whatever you want), and install it in your project.
thanks it works for my battles

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-lock-special-or-magic-till-a-skill-or-magic-is-learned.124016/