Hide Skill if another skill exists. (Skill replace)

● ARCHIVED · READ-ONLY
Started by Nohmaan 23 posts Page 1 of 2 View original ↗
  1. Now that Yanfly has released the Skill Learning system, I would like to be able to have 'upgradable skills' but I would like them to replace the prior skill.

    For example:

    I learn Fire 1.  After a few levels, I go back and learn Fire 2 which has some additional bonuses.  Now I have available Fire 2 but Fire 1 is not usable again as it is a lower level.

    Maybe a tag like <hide if learned: X>
  2. I'll second this... it will help a lot for quasi skill-trees. Also, I would think that hiding the skill from the list (not unlearning) is preferable. Otherwise if its unlearned, it may show back up on plugins that allow for unlearned skills to be learned somehow. ;)
  3. *Bump*

    Anyone else interested in this?
  4. Code:
    /*: * @plugindesc Allows to hide certain skills, when the actor already knows a different skill. * <Iavra Hide Skills If Learned> * @author Iavra * * @param Notetag * @desc Notetag to be used to specify another skill id. If that skill is already learned by the actor, the tagged skill is hidden. * @default hide if learned: * * @param Include Traits * @desc If set to true, skills that have been added (temporarily) by traits will also be checked. * @default true * * @help * This plugin can be used to implement a simple skill tree. If you want a character to not show skill 1, if he already knows skill * 2, put this notetag in the notebox of skill 2: * * <hide if learned: 2> * * The parameter "Include Traits" can be used to include or exclude skills that have been (temporarily) added by traits. */(function() {    var _params = $plugins.filter(function(p) { return p.description.contains('<Iavra Hide Skills If Learned>'); })[0].parameters;    var _regex = new RegExp('<[ ]*' + _params['Notetag'] + '[ ]+(\\d+?)[ ]*>', 'g');    var _includeTraits = _params['Include Traits'].toLowerCase() === 'true';        var skillsToCheck = function(actor) {        return _includeTraits ? actor._skills.concat(actor.addedSkills()) : actor._skills;    };        (function($) {              /**        * If our notetag is present, we check if the actor already knows the given skill and hide it. We need to reset lastIndex of        * the regex, otherwise it will skill every second skill.        */        var _alias_includes = $.prototype.includes;        $.prototype.includes = function(skill) {            var match;            _regex.lastIndex = 0;            while((match = _regex.exec(skill.note))) {                if(skillsToCheck(this._actor).contains(Number(match[1]))) { return false; }            }            return _alias_includes.call(this, skill);        };           })(Window_SkillList);    })();
    Assuming you want to hide skill 1, if skill 2 is already learned, put this in skill 1's note box:
    Code:
    <hide if learned: 2>
    The notetag is configurable via plugin parameter.
  5. Thanks for taking this one on- it works well for a 1 skill replace but I'm getting some odd behavior when replacing multiple skills

    So if I have Fire 1, Fire 2, Fire 3, Fire 4, and Fire 5 (all requiring the former skill and replacing it when learned) here's what happens.

    Learn Fire1.  Can see and use Fire1.

    Learn Fire2.  Can see and use Fire2.  Fire1 is gone.

    Learn Fire3.  Can see and use Fire2 and Fire3.

    Learn Fire4.  Can see and use Fire2 and Fire4.  Fire3 is now gone.

    Learn Fire5.  Can see and use Fire2 and Fire4 and Fire5.

    If I add Fire6 and test, this happens.

    Learn Fire6.  Can see and use Fire2, Fire4, and Fire6.  Fire5 is now gone.
  6. Thanks again Iavra!

    Nohmaan said:
    Thanks for taking this one on- it works well for a 1 skill replace but I'm getting some odd behavior when replacing multiple skills

    So if I have Fire 1, Fire 2, Fire 3, Fire 4, and Fire 5 (all requiring the former skill and replacing it when learned) here's what happens.

    Learn Fire1.  Can see and use Fire1.

    Learn Fire2.  Can see and use Fire2.  Fire1 is gone.

    Learn Fire3.  Can see and use Fire2 and Fire3.

    Learn Fire4.  Can see and use Fire2 and Fire4.  Fire3 is now gone.

    Learn Fire5.  Can see and use Fire2 and Fire4 and Fire5.

    If I add Fire6 and test, this happens.

    Learn Fire6.  Can see and use Fire2, Fire4, and Fire6.  Fire5 is now gone.

    Ditto that. ;)
  7. Fixed and also added a small plugin description.
  8. Iavra said:
    Fixed and also added a small plugin description.
    Works great. Thanks again!
  9. Iavra, Sorry to bother you again. But would you be willing to include skills learned from traits rather than only by 'Learn Skill' function? This way if the actor knows a skill, and equips something that grants a better version of that skill, they can only use the better version and not both.

    Un-equipping would then revert the skill back to the learned skill. :)
  10. Roguedeus said:
    Works great. Thanks again!
    Likewise, thanks Iavra 
  11. Roguedeus said:
    Iavra, Sorry to bother you again. But would you be willing to include skills learned from traits rather than only by 'Learn Skill' function? This way if the actor knows a skill, and equips something that grants a better version of that skill, they can only use the better version and not both.


    Un-equipping would then revert the skill back to the learned skill. :)
    Added. Should i make this optional (by plugin parameter)?
  12. Iavra said:
    Added. Should i make this optional (by plugin parameter)?
    Someone may wish to turn it off so it shouldn't hurt anything. ;)
  13. Added a new plugin parameter "Include Traits". You'll need to re-add the plugin to your plugin list if you use the new version, otherwise it won't be able to read the new parameter and crash.
  14. Iavra said:
    Added a new plugin parameter "Include Traits". You'll need to re-add the plugin to your plugin list if you use the new version, otherwise it won't be able to read the new parameter and crash.
    Soooo nice. Much love. :)
  15. how the compatibility with yanfly skill core?
  16. Radis3D said:
    how the compatibility with yanfly skill core?
    I haven't had any issues thus far, I use it with Yanfly skill core and skill learning.
  17. Ah, i didn't even think about disabling the skill as well. I never use auto battle, since it tends to waste mp and rather use something like "use auto attack on all characters" to kill weak mobs, so that wouldn't be an issue.
  18. Iavra said:
    Ah, i didn't even think about disabling the skill as well. I never use auto battle, since it tends to waste mp and rather use something like "use auto attack on all characters" to kill weak mobs, so that wouldn't be an issue.
    Technically your version is preferable to me because I will be making heavy use of trait based skills. Yanfly's version ignores trait learned skills.

    Are you going to add the disable as well? (out of curiosity)

    Edit:

    Auto battle doesn't kick in for confusion restrictions does it?
  19. Mine doesn't ignore trait learned skills.