Forcing a player action during battle without prompt

Hi all,

What I want to do

I want to fully automate a battle and am having trouble skipping the player inputting part of the turn cycle.

I basically want to implement my own AI - so I don't want to turn on the auto battle feature. This involves not prompting the player for their decision, but still executing an action.

What I've done

I am defining a plugin method that is called within a troop's battle script, per turn:

$gameParty.members()[index].forceAction(skillId, targetIndex);
BattleManager.forceAction($gameParty.members()[index]);

$gameTroop.members()[index].forceAction(skillId, targetIndex);
BattleManager.forceAction($gameTroop.members()[index]);


(they are from the call list: https://docs.google.com/spreadsheets/d/1-Oa0cRGpjC8L5JO8vdMwOaYMKO75dtfKDOetnvh7OHs/edit#gid=0 )

The above isn't the actual script, but the used one is executing those commands when the BattleManager._phase === "turn".

What happens

Only the troop's actions are executed, while the party's is not. What results is only the troop automatically choosing the action, but the party always skips it's turn.

I can explain the script in more detail if need be, but I wanted to post in case there's something wrong that is glaringly obvious.

I'm not even sure I can run the forceAction function on the gameParty inside the battle events of the troop for example; but I couldn't find a place to enter scripts for the party during battle, and I couldn't manage to find where in the engine code the player's actions are set.

Any help would be much appreciated!

Thanks.
Problem Solved!

I dug into the engine a bit more, and it turns out only one action can be forced per turn. (probably due to the animations).

To Solve my issue, I just create a switch that alternates per turn - allowing the troop to act, followed by the party. It seems a turn actually comprises of 2 action events initiated by two turns (correct me if I'm wrong).

Thanks,

Original thread: https://forums.rpgmakerweb.com/threads/forcing-a-player-action-during-battle-without-prompt.50446/