Yanfly Skill Core - Custom Requirement Syntax Question

● ARCHIVED · READ-ONLY
Started by AdamSakuru 4 posts View original ↗
  1. In my project I've replaced the default buffs with states and I wanted to implement a feature to prevent accidental uses of buffing skills when they aren't necessary to use since the buff states don't disappear over turns like the default buffs.

    <Custom Requirement>
    if ($gameParty.gold() > 1000) {
    value = true;
    } else {
    value = false;
    }
    </Custom Requirement>

    What I would like to do is have the skill be disabled if all of the active battle party members have specific states (the highest tiers of the buffs). So let's say the skill raises 'offensive parameters' (both the ATK and M.ATK parameters). The custom requirement would be that if all the active party members in battle have the max tier states for both ATK and M.ATK, the skill in question should be disabled.

    Would anyone know how to write the syntax for this?
  2. for (i in $gameParty.members()) {
    if (!$gameParty.members()[0],isStateAffected(4))... Rest is easy :)
  3. The notetag would be:

    <Custom Requirement>
    var states = [id1, id2, id3]; // Add as many state ids as you want checked.
    var members = $gameParty.aliveMembers();
    var stateCheck = members.every(function(mem) {
    return mem._states.contains(states);
    });
    condition = !stateCheck;
    </Custom Requirement>

    Haven't tested it, but it should work.
  4. I tested it on a offense boosting skill using states 52 and 56, as those are the states for the highest tier buffs for ATK and M.ATK.

    <Custom Requirement>
    var states = [52, 56];
    var members = $gameParty.aliveMembers();
    var stateCheck = members.every(function(mem) {
    return mem._states.contains(states);
    });
    condition = !stateCheck;
    </Custom Requirement>

    But I was still able to pick the skill when all the party members in the active battle party had those states.