Restrict skill usage when an enemy in battle has a certain state

● ARCHIVED · READ-ONLY
Started by JamesRyan 3 posts View original ↗
  1. I have been using YEP Skill Core plugin to restrict my actors from casting spells in some certain condition. Now i have a skill which applies a state to an actor, or an enemy. I want to restrict my actor from casting this skill when any member in battle (including actors and enemies) is still affected by this state. So far, i have been successfully doing this on my party by checking the number of actors affected by the state via this condition:
    Code:
    <Custom Requirement>
    if ($gameParty.battleMembers().filter( function (actor) { return actor.isStateAffected(67); } ).length > 0){
    value = false;
    }
    else{
    value = true;
    }
    </Custom Requirement>

    However, i haven't figured out a way to do so when the state affects an enemy. So i want to know how to apply the above condition to $gameTroop and check the number of enemies affected.
  2. Have you tried replacing $gameParty with $gameTroop?
  3. I haven't tried, because i'm not sure about the rest of the code. Can i use this:
    Code:
    $gameTroop.aliveMembers().filter( function (enemy) { return enemy.isStateAffected(67); } ).length > 0

    EDIT: It did work! Thank you for your help @SwiftSign :D