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

Status
Not open for further replies.

nakina

Dat boi
Veteran
Joined
Sep 17, 2016
Messages
37
Reaction score
21
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:

zarroc407

Veteran
Veteran
Joined
Jun 20, 2013
Messages
104
Reaction score
16
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])
 

Zarsla

Veteran
Veteran
Joined
Jan 23, 2015
Messages
710
Reaction score
228
First Language
English
Primarily Uses
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
 

nakina

Dat boi
Veteran
Joined
Sep 17, 2016
Messages
37
Reaction score
21
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.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,842
Reaction score
5,222
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.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:

Forum statistics

Threads
105,854
Messages
1,017,004
Members
137,562
Latest member
tamedeathman
Top