- Joined
- Jul 20, 2012
- Messages
- 84
- Reaction score
- 55
- First Language
- English
- Primarily Uses
Hello, I'm using Yanfly's Auto Passive State to create the FFIX-style trance effect to the game from this video.
The code below is what it recommends adding to the State note box, but it doesn't work quite as advertised in the video, so I'm looking for a bit of help fine-tuning it. For starters, even though it has a condition to check if you're in combat, it doesn't actually remove the state when combat ends, so it can carry over from encounter to encounter. There is no way to remove the state manually through traditional means, either.
In addition, it also overrides the settings in Yanfly's "Enhanced TP" plugin which is supposed to reset the party's TP to 0 after every encounter.
Any tips you have to correct or modify the javascript below would be appreciated!
The code below is what it recommends adding to the State note box, but it doesn't work quite as advertised in the video, so I'm looking for a bit of help fine-tuning it. For starters, even though it has a condition to check if you're in combat, it doesn't actually remove the state when combat ends, so it can carry over from encounter to encounter. There is no way to remove the state manually through traditional means, either.
In addition, it also overrides the settings in Yanfly's "Enhanced TP" plugin which is supposed to reset the party's TP to 0 after every encounter.
Any tips you have to correct or modify the javascript below would be appreciated!
Code:
<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(338);
}
// Set the user's trance state to true.
user._trance = true;
$gameSwitches.setValue(686, true)
}
</Custom Passive Condition>
<Custom Regenerate Effect>
// Set the TP drain amount.
var tp = 25;
// 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>
