Help to turn off Yanfly's Trance state

yellowvictory

Warper
Member
Joined
May 16, 2017
Messages
4
Reaction score
0
First Language
Indonesian
Primarily Uses
RMMV
Hi, all!
I'm using this http://yanfly.moe/2016/08/24/tips-tricks-trance-final-fantasy-9-rpg-maker-mv/ for trance state.
It works really well, except I want to turn it off after battle end.
I tried checking the "remove at battle end" box, but didn't solve the problem.
So, I think I have to make a common event that works in parallel if party have certain state on, it would be removed. The problem is, the event must be triggered by a switch.
Is it possible to turn on a switch from inside a state?
Please help me.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,956
Reaction score
5,573
First Language
English
Primarily Uses
RMVXA
My guess is that inside the Lunatic Code where you are setting user._trance = true, you could also directly set a Switch using:
$gameSwitches.setValue(15, true)
(Replace 15 with the Switch # you want to use in your Parallel Event, and MAKE SURE you set that Switch OFF at the end of the Event).

If that doesn't work for some reason, you could always simply turn the Switch ON at the beginning of each battle using a Troop Event (Turn 0, Timing: Battle) instead. This will force the Parallel Event to run once at the end of every battle and you can use it to remove the Trance from every character. Again, make sure you turn the Switch OFF at the end of the Event.
 

yellowvictory

Warper
Member
Joined
May 16, 2017
Messages
4
Reaction score
0
First Language
Indonesian
Primarily Uses
RMMV
Thank you for fast response, I'll try it out. But, I'm just casual maker, not a lunatic(expert), so I can only copy paste or do a little adjustment.. where should I put $gameSwitches.setValue(15, true) in these:
<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(130);

}

// Set the user's trance state to true.

user._trance = 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>

exactly? Is it too much if I ask a full lunatic code? Thank you in advance
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,956
Reaction score
5,573
First Language
English
Primarily Uses
RMVXA
Place it directly below user._trance = true; (it's about halfway through what you pasted, near the end of the Custom Passive Condition block) and make sure it's above the following } curly-bracket symbol.
 

Lionheart_84

Veteran
Veteran
Joined
Oct 27, 2015
Messages
538
Reaction score
49
First Language
Italian
Primarily Uses
To me this trick doesn't work.

In the common event I set that the TP go down to 0 and the status is removed.
Well, the status is not removed. TP drop to 0, but status is always there.
Tips?
 

Latest Threads

Latest Posts

Latest Profile Posts

not me baking a pie because i was inspired by celeste
Doing RPG Maker News for 10th April, 2021. :LZScheeze: (Improving on the thumbnails, by using assets from the day's news.)
Just discovering the forum.
Since Final Fantasy VII has been trending today, decided to make a series of my favorite bars in the OG game! Check it out:

At 2021, we are now farther from the 1980's than they were from the 1950's. Consider that the next time you long for a 1980's song, when you thought your grandpa's taste for 1950's music was "outdated".

Forum statistics

Threads
110,296
Messages
1,052,054
Members
143,325
Latest member
Blaze163
Top