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

Discussion in 'RPG Maker MV' started by nakina, Oct 15, 2018.

Thread Status:
Not open for further replies.
  1. nakina

    nakina Dat boi Veteran

    Messages:
    35
    Likes Received:
    20
    First Language:
    English
    Primarily Uses:
    RMMV
    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:

    <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.
     
    Last edited: Oct 15, 2018
    #1
  2. zarroc407

    zarroc407 Veteran Veteran

    Messages:
    104
    Likes Received:
    13
    First Language:
    english
    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])
     
    #2
    nakina likes this.
  3. Zarsla

    Zarsla Veteran Veteran

    Messages:
    675
    Likes Received:
    190
    First Language:
    English
    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
     
    #3
    nakina likes this.
  4. nakina

    nakina Dat boi Veteran

    Messages:
    35
    Likes Received:
    20
    First Language:
    English
    Primarily Uses:
    RMMV
    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.
     
    #4
  5. slimmmeiske2

    slimmmeiske2 Little Red Riding Hood Moderator

    Messages:
    4,999
    Likes Received:
    3,892
    Location:
    Belgium
    First Language:
    Dutch
    Primarily Uses:
    RMXP

    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.

     
    #5
Thread Status:
Not open for further replies.

Share This Page