MV Chrono Engine ATB: State Restrictions & Auto-Removal

In Chrono Engine (at least ATB mode); inflicting a party member with a state that has a restriction (such as Rage, restricting the player to attacking enemies without player input), the party member doesn't do anything at all. Their ATB meter fills up until just below full and then freezes; there's definitely no player input, which is correct, but they're not adhering to what the state restriction says, not attacking enemies or anything. Their ATB meter remains frozen until the state is removed, and then the player can control them again.

I don't think this is a glitch on my end or even a weird technicality, I think it's just an inherent issue with Chrono Engine. I even tested it on the original demo project to be sure.

In addition (putting both of these issues in the same thread because I think they're very related), there doesn't seem to be a way to force a state to be removed after a certain number of actions rather than turns. I have an "Initiative" state that buffs the party leader's Agility and Attack, but is meant to be removed immediately after their first action.

Instead, the party leader has multiple turns with this attack buff before the rest of the party gets a single chance to move, thus completing the "turn" and removing the state. I understand that there's an "Action End" and "Turn End" option under state auto-removal settings, but in Chrono Engine, there doesn't seem to be a difference between the two. Even plugins designed to fix this exact problem for the default combat engine (such as Hime's Remove State on Action) don't seem to solve it; I assume because Chrono Engine battles aren't technically "battles" in any way these plugins are designed to recognize.

Is there any way to fix both/either of these issues? Has anyone else fixed them already? I can't imagine Cross Engine has, since that's specialized for ABS mode, not ATB.
I don't really work with ATB mode, but you can try Yanfly Buffs and States core, which does work with ChronoEngine.
I figured out at least half of my problem, and it's a little dumb that I didn't see it before, but I'll post it here in case anyone comes to this thread in the future with the same problem as me.

"Turns" in Chrono Engine aren't really "turns," even in ATB mode; everything in the engine that checks for a turn duration is actually updated based on a timer. The duration of a "turn" can be set in Chrono Engine's plugin parameters, under "States Duration," the default being 240. That many frames divided by 60fps equals 4 seconds, so a status effect that is set in the database to last "one turn" is really going to last four seconds. Keep in mind that this timer only moves as the ATB meter moves (if the ATB is set to Wait mode instead of Active, then that timer will pause while someone is taking their turn).

If you want a state to specifically remove itself after a single action, regardless of ATB time, you'll want to hard-code that into a plugin. (Though, I'm working on a Chrono Engine tweaks plugin myself; it's just for personal use but if I can make it look nice then I may post it sometime in the future 😀 )



However, this still doesn't help the other half of my question. Status effect restrictions are still nonfunctional in base Chrono Engine. Without them, states like Confusion and Rage are rendered useless. Has anyone else noticed this before, and tried to fix it? Are there any ways I could try to work around it?
What does confusion and rage normally do? I can probably get it working. I'm guessing confusion: pick a random target including yourself and do the regular attack? And rage: Regular attack to a random enemy as long as the user has the state?
That would be great! 😀 These are MV's restriction options; Chrono Engine is capable of distinguishing them (internally they're 0-4 down the list), it's just that there's no practical difference for any restriction over 0.

1697039821202.png


I actually tried to code it myself last night, though to limited success. I managed to force the player to select the default Attack if they have a restriction, but I haven't been able to force selecting targets or executing the attack. Here's my code; first, I changed the Game_Chrono.prototype.updateChronoATB function to look like this in the bottom half:

JavaScript:
//When a battler reaches max ATB, run the following
            if (battler.restriction() > 4) {battler.restriction() = 0};
            if (this.canStartCommandCN(battler)) {this.prepareCommandSelectionCN(battler,char)};
            if (this.canStartTurnCN(battler)) {this.prepareTurnCN(battler,char)};
            if (battler.restriction() > 0 || battler.restriction() < 4) {
                //Note: restriction 4 (sleep) does pause that actor's ATB meter, so no change is needed
                this.restrictionForceAttack(battler, char);
            };

Then I cobbled together a new function, restrictionForceAttack:

JavaScript:
Game_Chrono.prototype.restrictionForceAttack = function(battler, char) {
    console.log(battler, char);
    var actionID = battler._toolWeaponActionId;
    var tool = $gameMap.tool(actionID);
    $gameTemp._chronoCom.toolAction = tool;
    $gameTemp._chronoCom.skill = tool.skill;
    $gameTemp._chronoCom.phase === 1;
    this.selectAction(this.skill())
    if ($gameTemp._chronoCom.targets.length === 0) {$gameTemp._chronoCom.phase = 0;};   
    if (battler.restriction() === 1) {
        //"rage" attack random enemy
    } else if (battler.restriction() === 2) {
        //"confusion" attack anyone
    } else if (battler.restriction() === 3) {
        //"fascination" attack random ally
    }
};

I appreciate any help :LZScheeze:
Unfortunately this is going to take longer than I thought because I have a hard time following the ATB command structure, and it's not something I want to spend hours on when I don't use the ATB mode myself. Sorry I couldn't help you.
I understand, don't worry! 🙂 Was trying to fix it on my own in the meantime, and that's why I took so long to reply. I think I'm very close to getting this working but I've run into an issue.

After the party member with the restriction-state attacks, other party members without the state can attack each other voluntarily, except they can't attack the party member with the state. Also, even when the enemies are defeated, the battle doesn't end, and party members can keep attacking each other. (Pictures below are after selecting a regular attack.)

1697571676846.png
1697571695328.png
1697571802825.png


What's even more mysterious is that I set up a console.log to read out the list of possible targets for an actor with a restriction. The list is wiped every time, but the party members keep getting duplicated on it!

1697571843620.png


I have no idea how this is possible, though I assume it's something simple that's just blown over my head. I copied all of my code into the attached js file, if anyone would like to take a look. Any help is appreciated.



EDIT: I solved it myself! It was something weird with how I added the list of enemies to the list of targets. I even got it working so status-effected players can attack themselves as a toggleable option! I still need to do some testing with status restrictions on enemies, though. I removed the js plugin I embedded since it's obsolete, and I'll probably update with a complete and functional version in a few days 🙂

Original thread: https://forums.rpgmakerweb.com/threads/chrono-engine-atb-state-restrictions-auto-removal.161894/