How do I use the player's current class as a condition (Yanfly's auto passive states)

● ARCHIVED · READ-ONLY
Started by nakina 5 posts View original ↗
  1. To clarify a bit more, I'm using yanfly's auto passive states plugin and I want to add a custom requirement based on the player's current class. For example, I'm making a berserk state that triggers when you reach max tp but only when you are using the berserker class.

    This is the code I'm modifying:

    Spoiler
    <Custom Passive Condition>
    // Check if the party is in battle.
    if ($gameParty.inBattle()) {
    // Default the user's trance state to false.
    user._trance = user._trance || false;
    // Sets the condition for the user to be either in the trance state or if the user's TP matches the user's MaxTP.
    condition = user._trance || user.tp === user.maxTp();
    } else {
    // Otherwise, the condition is false.
    condition = false;
    }
    // If the condition passes...
    if (condition) {
    // And if the user isn't in the trance state...
    if (!user._trance) {
    // Then play an animation as the user enters trance.
    user.startAnimation(120);
    }
    // Set the user's trance state to true.
    user._trance = true;
    }
    </Custom Passive Condition>

    <Custom Regenerate Effect>
    // Set the TP drain amount.
    var tp = 10;
    // Reduce the user's TP.
    user.gainTp(-tp);
    // If the user's TP is 0...
    if (user.tp === 0) {
    // ...then turn off trance.
    user._trance = false;
    }
    <Custom Regenerate Effect>


    Edit- I think I found a workaround. I'll just turn this state into more of an ultimate trigger and use gilgamar's state common events to determine which ultimate to use based on the player's class. This can be closed.

    Edit 2- I had a bit of a brain fart and forgot you can apply the passives to a class so I didn't even need a workaround.

    Edit 3- I can't get gilgamar's plugin to work correctly so I guess I'm gonna be putting events in each troop to check for this now unless I can find an alternative.
  2. If what you're asking for is a condition to use as a requirement for the state to be active you want if (target.isClass($dataClasses[classid])
  3. if ($gameParty.inBattle() && user.isClass($dataClasses[x]) {
    condition = user._trance || user.tp === user.maxTp();
    } else {
    condition = false;
    }
    Replace x with the id of the berseker class
  4. I've ended up making a troop event using yanfly's advanced switches and variables and yanfly's base troop events that makes certain skills happen based on your class exactly when you reach max tp. Thanks for showing me how to do class checks with auto passives still, I might still find a use for them somewhere down the line.

    This can be closed as I've figured out a solution.
  5. This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.