YEP Auto Passive States + "Trance" Effect

Drunken Paladin

Veteran
Veteran
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!


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>
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Dad's watching a WWII documentary while I work on some cool assets for my games. I just love RPG Maker!
Also Happy Halloween! Dad's friend won't be coming unfortunately, but Dad will still be taking me to Boxi Park to have some fun tonight! I'll be posting a video on my YouTube channel of the show, and I'll be sure to post a link here.
"Nightmares exist outside of logic and there's little fun to be had in explanations. They're antithetical to the poetry of fear. In a horror story the victim keeps asking why, but there can be no explanation and there shouldn't be one..." - Stephen King
I feel people seek explanation and demand it sometimes in games, but in the horror genre, well, maybe you shouldn't have one. Silent Hill 1 comes to mind...
Managed to implement QSprite.

Always double check your plugin order.


Finally! I've been puzzling over why it wasn't working for two days now. Turns out all of my calculations were correct, I just forgot to give some events hitboxes. :kaoswt: Now my randomly generated maps check for collision errors, and move stuff around in real time if they finds any. :LZSexcite:
Ami
--- OP Candy ---

Kids: Trick Or Treat!
Hero: Alright,here's the Candies (Give A Bunch Of Candy).
Kids: Thank you,Mister! (Running)
Hero: How cute they are…
F.Archer: Did you give them a OP Candy,accidently?
Hero: Huh?

Forum statistics

Threads
104,680
Messages
1,008,055
Members
136,167
Latest member
Gbasire
Top