MV YEP Lunatic Mode that detects if actors or enemies are acting.

As title says.

Basically, I have a class with a state involves them gaining different effects depending on whose turn of the battle is (They gain X state on their party's turn, and Y state otherwise). However I have not found a way to make this exact function work. The best I've done is alternate between two of those states every time a new round begins (via Custom Start/End Effect tags). I was thinking if there was Lunatic Mode that checks the acting battler and then add/remove the right states when necessary. Anyone have thoughts? I'm Using YEP and Olivia's OTB, if that helps.

TIA.
I would put them both on the class as passive states, then give them these:
Code:
<Custom Passive Condition>
condition=BattleManager.actor().isActor();
</Custom Passive Condition>
for the one that's active on any party member's turn, and then the opposite:
Code:
<Custom Passive Condition>
condition=!BattleManager.actor().isActor();
</Custom Passive Condition>
for the one active on enemy turns.
I would put them both on the class as passive states, then give them these:
Code:
<Custom Passive Condition>
condition=BattleManager.actor().isActor();
</Custom Passive Condition>
for the one that's active on any party member's turn, and then the opposite:
Code:
<Custom Passive Condition>
condition=!BattleManager.actor().isActor();
</Custom Passive Condition>
for the one active on enemy turns.
Hi! Thanks for the response. I've tried both codes, but somehow only the one for the enemy turn works as intended (the on-ally-turn is active even when its the enemies' turn). I even made the states resist each other to be sure, but to no change. I'm guessing it needs something else. Thanks again.
the on-ally-turn is active even when its the enemies' turn
Huh. I suspect that might come down to when the plugin checks its conditions...that should work, so it's possible nothing will. But, hey, let's try this:
Code:
<Custom Passive Condition>
condition=$gameParty.members().includes(BattleManager.actor());
</Custom Passive Condition>
I think BattleManager.actor() is for the input phase, so it always returns an actor.

Try BattleManager._subject instead?
Ooh, that would make sense.
Code:
<Custom Passive Condition>
condition = BattleManager._subject;
</Custom Passive Condition>
I tried this, and it's now working as intended! Thanks y'all!

A warning to whoever will stumble on this thread: If you give the two states display icon, the one for the on-ally-turn will be displayed even if it's turned off. I'm not giving these states their own icon, so I won't have this problem.
Code:
<Custom Passive Condition>
condition = BattleManager._subject;
</Custom Passive Condition>
I think that will return truthy iff anyone is acting, i.e. for both actors and enemies.

If you want to distinguish them, I recommend something like what ATT_Turan suggested earlier, e.g.
  • True iff it's an actor's turn:
    JavaScript:
    condition = BattleManager._subject && BattleManager._subject.isActor();
  • True iff it's an enemy's turn:
    JavaScript:
    condition = BattleManager._subject && BattleManager._subject.isEnemy();
  • True iff it's an actor's turn:
    JavaScript:
    condition = BattleManager._subject && BattleManager._subject.isActor();
  • True iff it's an enemy's turn:
    JavaScript:
    condition = BattleManager._subject && BattleManager._subject.isEnemy();
So I tried these, but they don't seem to work as expected. I tried testing each state on their own and can confirm that the on-ally-turn works even outside an actor's turn, and the on-enemy-turn activates only after an enemy acts, and then turns itself off.
It's possible that the code which checks the passive state conditions isn't called at those times, so it doesn't update your states when you need them to.

If you explain (or give screenshots) of what the states actually do, we might be able to offer an alternate way to implement it in one state with different code that handles the effects.
The original plan: Class gains bonus to MDF during its turn, and MAT otherwise (this is why I initially started with Custom Start/End Turn effect tags). I realized that using the tags I mentioned doesn't give me the effect I want, hence my asking if there are ways to check who is currsntly acting instead.
The original plan: Class gains bonus to MDF during its turn, and MAT otherwise
So there are a number of ways you could achieve these effects, but my first question is - are you sure you typed that correctly? Typically a character doesn't need defense on its turn and doesn't need attack on enemy turns - you'd use it vice versa, so their attacks are boosted and they take less damage from spells. In a standard combat system, that ability would be useless.

If your combat system is doing something different where what you described is actually useful, then that's fine, but I'd put it out there.

For example, it would only take a little bit of copy-pasting for you to modify the damage formulae for your spells that are based on MAT.

If your spell damage formula was a.mat*4 - b.mdf*2, you could do instead:
Code:
a.isStateAffected(X) ? a.mat*5 - b.mdf*2 : a.mat*4 - b.mdf*2
So if they have state X on, their MAT is multiplied an additional time (and you can obviously replace all of those with whatever formula you actually use).

And then I would just have the state leave the bonus to MDF on all the time, since it doesn't make a difference on the turns it's not being used. But you could instead code it as a Custom React Effect that says if the attack is magic, reduce the incoming damage by this...but that gets more complicated.
So there are a number of ways you could achieve these effects, but my first question is - are you sure you typed that correctly?
Yes, I typed it correctly. The fantasy is that this class has "counterattacks" whenever they get hit by magic attacks: the MDF bonus on their turn 1) ensures that they take less damage from an incoming magical attack on their turn, allowing them to "counter" afterwards; and 2) this class has ways to hurt themselves with magical attacks, allowing them to proc their own "counter" skills even if the enemy chooses not to target them.

If the on-ally-turn proves too difficult to implement, I can just take my losses. The on-enemy-turn effect you provided earlier does work, and I could just balance the class from there.
this class has "counterattacks" whenever they get hit by magic attacks
That's fine - you can alter the damage formulae for the counterattack skills the same way I showed you above.
the MDF bonus on their turn 1) ensures that they take less damage from an incoming magical attack on their turn, allowing them to "counter" afterwards
This still sounds weird. Do you have chains of attack and counter going back and forth on one person's turn? Because the only way they'd be taking damage from an incoming magical attack on their turn is if the enemy is countering them, so they would then counter a counter?

Regardless, if that is in fact what you mean, you can use a Custom React as I described above.
2) this class has ways to hurt themselves with magical attacks, allowing them to proc their own "counter" skills even if the enemy chooses not to target them.
You should be able to compensate for that within the damage formula, also. Let me know if you can't figure out how.
This still sounds weird. Do you have chains of attack and counter going back and forth on one person's turn? Because the only way they'd be taking damage from an incoming magical attack on their turn is if the enemy is countering them, so they would then counter a counter?
Yes, there will be strings of counters in one battler's turn. It'll get crazy, but that's gonna be something the player must master to take full advantage of.
You should be able to compensate for that within the damage formula, also. Let me know if you can't figure out how.
I got this. Thanks.

Original thread: https://forums.rpgmakerweb.com/threads/yep-lunatic-mode-that-detects-if-actors-or-enemies-are-acting.140204/