VX/VXA More precise control on enemies with multiple actions per turn?

I'm having a lot of trouble trying to design boss enemies with more than one action per turn.

If I use states to control their actions, it will influence ALL of its actions, not just one, even if the action they took removed the status influencing them. Say for example that whenever the boss is poisoned, it is guaranteed to use cure poison at a priority of 10. However, after curing the poison, it will use its second action to try and cure themselves again no matter what. I tried using battle events, but forced actions completely erase all remaining actions, so they'll cure themselves and then the rest of the actions will simply not happen.

I also struggle to dynamically modify the amount of turns the boss can use. If a boss has 100% action times, giving them 2 actions total, there's no way I can make a stun status effect only take away one of the turns. Only all or none. I tried to use the aformentioned action patterns to force an enemy to use a dummy skill that does nothing except heal the condition, but like mentioned, the enemy will attempt to use all of its remaining turns to heal it even if its already healed. The opposite seemed impossible as well, as trying to give the foe a status that gives them 100% action times in the middle of their turn doesn't grant them an extra action until their next turn.

Does anyone know how to more precisely control the actions and/or turn amount of a multi-action foe? its been giving me headaches for months! and I don't wanna just give up and make bosses only use one action per turn. I don't mind if it requires scripts, but if it can be done without that would be ideal.

For a bit of context, the project uses Yanfly's Ace Battle Engine with the Free Turn Battle addon, in case any solution requires scripting. Million thanks if anyone has answers.

I think a shorter way to describe what im trying to achieve would be:
  • I want to be able to remove only 1 action using states, from an enemy who has more than 1 action.
  • I want to be able to increase the amount of actions a foe has in the middle of their own turn. Such that if they meet certain conditions, they may be able to act more times than normal. For example, using a skill that grants them 2 more turns.
  • Be able to control what each of the enemy's actions do if they have more than 1. For example, an enemy who will always use one, and only one of their actions to remove an ailment if they have one, then attack normally with the remaining actions.
Moved to ACE Support.

The biggest issue you are running into is because the battle system decides all actions for all enemies at the start of the battle turn. Not at any other time. So when turn starts it sees cannot act so it will not put in any actions no matter how many actions you have.

You might be able to cobble a work around for 2 actions with Yanfly's ACE Battle Engine, but this only works due to how they redid force actions. What I've done is in the battle troop event I put a force action command for that boss which fires at start of turn (you can do end of turn too). This also gives the appearance of the boss not doing both actions all at once, but they are instead spread out.

You might be able to cobble something with the conditional checks to have it skip a turn if they have a state or something, but it might also be a maze of conditionals if you have too many states. Otherwise you would need the battle system totally rewritten on when actions are set and I'm not sure its ever been done for ACE.

Oddly enough I didn't have force action wipe out the other actions when I used ACE Battle Engine (though I also have ACE Core, which might be the difference). But I only had my force actions add buffs or bebuffs and didn't try to alter actions (or cure things) so that may be the difference.
Moved to ACE Support.

The biggest issue you are running into is because the battle system decides all actions for all enemies at the start of the battle turn. Not at any other time. So when turn starts it sees cannot act so it will not put in any actions no matter how many actions you have.

You might be able to cobble a work around for 2 actions with Yanfly's ACE Battle Engine, but this only works due to how they redid force actions. What I've done is in the battle troop event I put a force action command for that boss which fires at start of turn (you can do end of turn too). This also gives the appearance of the boss not doing both actions all at once, but they are instead spread out.

You might be able to cobble something with the conditional checks to have it skip a turn if they have a state or something, but it might also be a maze of conditionals if you have too many states. Otherwise you would need the battle system totally rewritten on when actions are set and I'm not sure its ever been done for ACE.

Oddly enough I didn't have force action wipe out the other actions when I used ACE Battle Engine (though I also have ACE Core, which might be the difference). But I only had my force actions add buffs or bebuffs and didn't try to alter actions (or cure things) so that may be the difference.
Thanks for the reply. I wasn't aware that ace engine reworked forced actions. All I knew is that the script has an error that crashes the game when you use forced actions unless you comment out or remove a bunch of code regarding force actions. even when testing on a new project with nothing but ace engine completely unmodified, forced actions crash the game. So I opted to comment out the code, which lets me use forced actions without crashing the game, but vanilla forced actions suffer from the issue of deleting all remaining actions, which I tested on a new project with no scripts, so it doesn't seem to be an issue with the script. But if you know something that I'm missing like a version of ace battle engine that fixed that bug or some kind of setting that I completely overlooked, that would be nice to know since your version oddly doesn't seem to have that problem.

Otherwise, trying to cobble stuff with conditional checks has been exactly what I've been doing this entire time to no avail. I suppose fighting against the engine is not gonna work if the problem is so hard-coded. So I'll either have to design the mechanics around that limitation or look into the other versions of rpg maker, maybe one of those has seen a solution. I'm a bit dejected but Its not the first time i've struggled with the limitations of the engine.
Hello,
  • I want to be able to remove only 1 action using states, from an enemy who has more than 1 action.
  • I want to be able to increase the amount of actions a foe has in the middle of their own turn. Such that if they meet certain conditions, they may be able to act more times than normal. For example, using a skill that grants them 2 more turns.
  • Be able to control what each of the enemy's actions do if they have more than 1. For example, an enemy who will always use one, and only one of their actions to remove an ailment if they have one, then attack normally with the remaining actions.
I can consider making a script for this.
Like adding a notetag to skills/items such that when they are applied to the target, the target gains or loses available actions (refreshed on next turn). For states, I could do the same but taking effect the next time the actions are generated (usually on turn start). Would this be ok for you?

In default rpg maker (and it seems to remain the case with Yanfly's FTB), enemies will decide their actions when they are generated, I can change this behavior by making them consider which action to take after they've performed their last action (so similar to user's side of FTB except enemies will play in a fixed order because I'm lazy).
You can then combine this with actions conditions or with a more advanced targeting script like Archeia's Advanced AI Conditions.

I wasn't aware that ace engine reworked forced actions. All I knew is that the script has an error that crashes the game when you use forced actions unless you comment out or remove a bunch of code regarding force actions. even when testing on a new project with nothing but ace engine completely unmodified, forced actions crash the game.
Wow I wasn't aware of this bug, but I never used the battle engine without the core engine ahah. Having both don't make the game crash on forced actions. I wrote a tiny fix:
Ruby:
#==============================================================================
# YEA Ace Battle Engine fix (if Ace Core Engine is not in project)
#==============================================================================
if $imported["YEA-BattleEngine"] && !$imported["YEA-CoreEngine"]
#==============================================================================
# BattleManager
#==============================================================================
module BattleManager
  #--------------------------------------------------------------------------
  # overwrite method: force_action -> remove reference to
  # Switch.forced_action_remove defined in Ace Core Engine
  #--------------------------------------------------------------------------
  def self.force_action(battler)
    @action_forced ||= []
    @action_forced.push(battler)
    @action_battlers.delete(battler)
  end
end #BattleManager
end #$imported["YEA-BattleEngine"] && !$imported["YEA-CoreEngine"]

It might be nice to update the github repo with a bug fix to the battle engine for future users.
As an alternative, you should be able to control what actions a battler has lined up through event script commands at the start of the turn:
Ruby:
battler = $game_troop.members[0]
# Replace "battler" with...
# $game_troop.members[INDEX]  <- the INDEXth enemy (starting at index 0)
# $game_party.members[INDEX]  <- the INDEXth party member (starting at index 0)
# $game_actors[ID]   <- Actor with corresponding database ID


# Set the INDEXth action to Skill ID, if it exists
if battler.actions.length > INDEX
  battler.actions[INDEX].set_skill(ID)
end

# Remove the first/last/INDEXth (starting at 0) action:
battler.actions.shift
battler.actions.pop
battler.actions.delete_at(INDEX)

# Add a new action at the start/end:
action = Game_Action.new(battler)
action.set_skill(ID)
battler.actions.unshift(action) # <- Insert at the start
battler.actions.push(action)  # <- Insert at the end

# Remake an enemies remaining actions:
remaining = battler.actions.length
battler.make_actions
battler.actions.pop(battler.actions.length - remaining)

# Optional: Set the target index of an action (starting at 0; -1 = random)
if battler.actions.length > INDEX
  battler.actions[INDEX].target_index = INDEX2
end

# Optional: Redo action orders
# (May have undesired effects when done after the start of the turn)
BattleManager.make_action_orders

I would imagine having a script for your requirements would be helpful.
I only have looked briefly through Archeias Advanced AI script, right now I am not sure if it allows you to set different conditions for different actions in the same turn (like preventing the enemy from using an action more than once)?
Hello,

I can consider making a script for this.
Like adding a notetag to skills/items such that when they are applied to the target, the target gains or loses available actions (refreshed on next turn). For states, I could do the same but taking effect the next time the actions are generated (usually on turn start). Would this be ok for you?

In default rpg maker (and it seems to remain the case with Yanfly's FTB), enemies will decide their actions when they are generated, I can change this behavior by making them consider which action to take after they've performed their last action (so similar to user's side of FTB except enemies will play in a fixed order because I'm lazy).
You can then combine this with actions conditions or with a more advanced targeting script like Archeia's Advanced AI Conditions.


Wow I wasn't aware of this bug, but I never used the battle engine without the core engine ahah. Having both don't make the game crash on forced actions. I wrote a tiny fix:
Ruby:
#==============================================================================
# YEA Ace Battle Engine fix (if Ace Core Engine is not in project)
#==============================================================================
if $imported["YEA-BattleEngine"] && !$imported["YEA-CoreEngine"]
#==============================================================================
# BattleManager
#==============================================================================
module BattleManager
  #--------------------------------------------------------------------------
  # overwrite method: force_action -> remove reference to
  # Switch.forced_action_remove defined in Ace Core Engine
  #--------------------------------------------------------------------------
  def self.force_action(battler)
    @action_forced ||= []
    @action_forced.push(battler)
    @action_battlers.delete(battler)
  end
end #BattleManager
end #$imported["YEA-BattleEngine"] && !$imported["YEA-CoreEngine"]

It might be nice to update the github repo with a bug fix to the battle engine for future users.
Oh my god man, all these years I thought Yanfly's battle engine and the Core Engine were the same thing, I can't believe this... 😐 So many little fixes that I shoddily coded myself. But now that I know it exists, is time to play around with it hehe. (sadly the way core engine reworks forced actions doesn't replace the enemy's existing actions, it only adds one on top of their normal action pattern.)

And, yeah! I would love any help! I hope is not too much to ask! What i'm not fully sure yet is what the game considers "turn start", because it seems like its situated at the very start of the player phase when they're allowed to start choosing their actions, but enemy action patterns do react to conditions met before the end of the player phase, just not in the middle of the enemy phase. I'm still wrapping my head around the game logic, sorry if I get confused.

Oh and thats super awesome that you found a fix for the bug the battle engine bug! I'm certain there's gonna be someone else out there who's gonna appreciate it.
As an alternative, you should be able to control what actions a battler has lined up through event script commands at the start of the turn:
Ruby:
battler = $game_troop.members[0]
# Replace "battler" with...
# $game_troop.members[INDEX]  <- the INDEXth enemy (starting at index 0)
# $game_party.members[INDEX]  <- the INDEXth party member (starting at index 0)
# $game_actors[ID]   <- Actor with corresponding database ID


# Set the INDEXth action to Skill ID, if it exists
if battler.actions.length > INDEX
  battler.actions[INDEX].set_skill(ID)
end

# Remove the first/last/INDEXth (starting at 0) action:
battler.actions.shift
battler.actions.pop
battler.actions.delete_at(INDEX)

# Add a new action at the start/end:
action = Game_Action.new(battler)
action.set_skill(ID)
battler.actions.unshift(action) # <- Insert at the start
battler.actions.push(action)  # <- Insert at the end

# Remake an enemies remaining actions:
remaining = battler.actions.length
battler.make_actions
battler.actions.pop(battler.actions.length - remaining)

# Optional: Set the target index of an action (starting at 0; -1 = random)
if battler.actions.length > INDEX
  battler.actions[INDEX].target_index = INDEX2
end

# Optional: Redo action orders
# (May have undesired effects when done after the start of the turn)
BattleManager.make_action_orders

I would imagine having a script for your requirements would be helpful.
I only have looked briefly through Archeias Advanced AI script, right now I am not sure if it allows you to set different conditions for different actions in the same turn (like preventing the enemy from using an action more than once)?
Hi! Thank you for the help! But I'm not sure how to use the script you've shared, my scripting skills aren't quite up there yet to know what it does at a glance.
I'll look into the Archeias script you mentioned as well, maybe I'll find some luck there. Many thanks!
Alright, here is the first script, it should allow the enemies to reconsider the actions they pick (and it might even change their turn order a bit):
Ruby:
#==============================================================================
# YEA FTB - FTB for enemies
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 29/12/2025
# Requires: YEA Free Turn Battle v1.02 and its requirements
#==============================================================================

$imported ||= {}
$imported["TIM-YEA-FTB-EnemyFTB-addon"] = true
 
#==============================================================================
# Description: basic addon that allows enemies to decide new actions during
# their phase, simulating a FTB for enemies (but without the handling of ftb
# actions for the troop like the party).
# This script provides the basis for an ai but does not do much:
# When it is the troop turn, the enemies will take actions in order specified
# by choose_ftb_user. By default this is the speed of the original action used
# by the battler.
#==============================================================================
# Term of use: free for commercial and free games, credit must be given
#==============================================================================

#==============================================================================
# Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # override method: inputable? -> restore vanilla behavior
  #--------------------------------------------------------------------------
  def inputable?
    game_battlerbase_inputable_ftb
  end
 
  #--------------------------------------------------------------------------
  # new method: make_action_list -> returns all currently valid actions
  #--------------------------------------------------------------------------
  def make_action_list
    enemy.actions.select {|a| action_valid?(a) }   
  end
 
  #--------------------------------------------------------------------------
  # new method: make_action -> given a list of actions, set the selected
  # action to one value chosen
  #--------------------------------------------------------------------------
  def make_action(action, action_list)
    return if action_list.empty?
    rating_max = action_list.collect {|a| a.rating }.max
    rating_zero = rating_max - 3
    action_list.reject! {|a| a.rating <= rating_zero }
    action.set_enemy_action(select_enemy_action(action_list, rating_zero))
  end
 
  #--------------------------------------------------------------------------
  # new method: set_ftb_action -> set the selected action for ftb enemy addon
  # when the battler is selected to play
  #--------------------------------------------------------------------------
  def set_ftb_action(action)
    #puts "reconsidering life choices of #{self.name}"
    action.clear
    action_list = make_action_list
    make_action(action, action_list)
  end
end #Game_Enemy

#==============================================================================
# Game_troop
#==============================================================================
class Game_Troop < Game_Unit
  #--------------------------------------------------------------------------
  # new method: can_change_user?
  #--------------------------------------------------------------------------
  def can_change_user?(bat)
    bat && bat.enemy? && bat.inputable? && bat.current_action
  end
 
  #--------------------------------------------------------------------------
  # make_ftb_choice -> choose a battler in the troop with an available action,
  # set the action and return the battler, nil if no elligible battler or
  # the current subject cannot be changed
  #--------------------------------------------------------------------------
  def make_ftb_choice(current_subject)
    return nil unless can_change_user?(current_subject)
    battlers = members.select{|bat| bat.inputable? && bat.current_action}
    b = choose_ftb_user(battlers)
    b.set_ftb_action(b.current_action) if b
    return b
  end
 
  #--------------------------------------------------------------------------
  # new method: choose_ftb_user -> given a list of elligible battlers, pick
  # one to make an action or nil
  #--------------------------------------------------------------------------
  def choose_ftb_user(battlers)
    battlers.sort_by{|b| b.current_action.speed}.first
  end
end #Game_Troop

#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # alias method: update
  #--------------------------------------------------------------------------
  alias tim_ftb_enemy_update update
  def update
    return tim_ftb_enemy_update unless BattleManager.btype?(:ftb)
    super
    if BattleManager.in_turn?
      process_event
      process_troop_choice #new
      process_action
    end
    BattleManager.judge_win_loss
  end
 
  #--------------------------------------------------------------------------
  # new method: process_troop_choice
  #--------------------------------------------------------------------------
  def process_troop_choice
    @subject ||= BattleManager.next_subject
    until (!@subject || @subject && @subject.current_action)
      @subject = BattleManager.next_subject
    end
    @subject = $game_troop.make_ftb_choice(@subject) || @subject
  end
end #Scene_Battle

Here is an untested compatibility patch with archeia's advanced ai script if you want to use it:
Ruby:
#==============================================================================
# FTB for enemies patch with Archeia's Advanced AI Conditions v1.0d
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 29/12/2025
# Requires: my FTB for enemies addon to Yanfly's script and Archeia's script
#==============================================================================
# Description: advanced ai restrictions should be applied whenever the actions
# are modified during troop's turn in FTB (this script is not tested)
#==============================================================================
# Term of use: follow the required scripts term of use
#==============================================================================

if $imported['ARC-AdvAIConditions'] && $imported["TIM-YEA-FTB-EnemyFTB-addon"]
#==============================================================================
# Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # alias method: make_action_list -> apply turn pattern filter
  #--------------------------------------------------------------------------
  alias tim_arc_ai_make_action_list make_action_list
  def make_action_list
    action_list = tim_arc_ai_make_action_list
    if !enemy.t_patterns.keys.empty? && turn_patterns_ok?
      action_list = make_turn_patterns_list.select {|a| action_valid?(a)}
    end
    return action_list
  end
 
  #--------------------------------------------------------------------------
  # alias method: make_action -> apply absolute rating rule
  #--------------------------------------------------------------------------
  alias tim_arc_ai_make_action make_action
  def make_action(action, action_list)
    absolute_list = action_list.reject {|a| a.rating != ARC::ABSOLUTE_RATING}
    unless absolute_list.empty?
      return action.set_enemy_action(absolute_list[rand(absolute_list.size)])
    end
    tim_arc_ai_make_action(action, action_list)
  end
end #Game_Enemy
end #$imported['ARC-AdvAIConditions'] && $imported["TIM-YEA-FTB-EnemyFTB-addon"]

I will be back for the action +/- handling script, for now my script above won't do much unless you add skills/items that will affect with their effects the possible actions.
Alright, here is the first script, it should allow the enemies to reconsider the actions they pick (and it might even change their turn order a bit):
Ruby:
#==============================================================================
# YEA FTB - FTB for enemies
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 29/12/2025
# Requires: YEA Free Turn Battle v1.02 and its requirements
#==============================================================================

$imported ||= {}
$imported["TIM-YEA-FTB-EnemyFTB-addon"] = true
 
#==============================================================================
# Description: basic addon that allows enemies to decide new actions during
# their phase, simulating a FTB for enemies (but without the handling of ftb
# actions for the troop like the party).
# This script provides the basis for an ai but does not do much:
# When it is the troop turn, the enemies will take actions in order specified
# by choose_ftb_user. By default this is the speed of the original action used
# by the battler.
#==============================================================================
# Term of use: free for commercial and free games, credit must be given
#==============================================================================

#==============================================================================
# Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # override method: inputable? -> restore vanilla behavior
  #--------------------------------------------------------------------------
  def inputable?
    game_battlerbase_inputable_ftb
  end
 
  #--------------------------------------------------------------------------
  # new method: make_action_list -> returns all currently valid actions
  #--------------------------------------------------------------------------
  def make_action_list
    enemy.actions.select {|a| action_valid?(a) }  
  end
 
  #--------------------------------------------------------------------------
  # new method: make_action -> given a list of actions, set the selected
  # action to one value chosen
  #--------------------------------------------------------------------------
  def make_action(action, action_list)
    return if action_list.empty?
    rating_max = action_list.collect {|a| a.rating }.max
    rating_zero = rating_max - 3
    action_list.reject! {|a| a.rating <= rating_zero }
    action.set_enemy_action(select_enemy_action(action_list, rating_zero))
  end
 
  #--------------------------------------------------------------------------
  # new method: set_ftb_action -> set the selected action for ftb enemy addon
  # when the battler is selected to play
  #--------------------------------------------------------------------------
  def set_ftb_action(action)
    #puts "reconsidering life choices of #{self.name}"
    action.clear
    action_list = make_action_list
    make_action(action, action_list)
  end
end #Game_Enemy

#==============================================================================
# Game_troop
#==============================================================================
class Game_Troop < Game_Unit
  #--------------------------------------------------------------------------
  # new method: can_change_user?
  #--------------------------------------------------------------------------
  def can_change_user?(bat)
    bat && bat.enemy? && bat.inputable? && bat.current_action
  end
 
  #--------------------------------------------------------------------------
  # make_ftb_choice -> choose a battler in the troop with an available action,
  # set the action and return the battler, nil if no elligible battler or
  # the current subject cannot be changed
  #--------------------------------------------------------------------------
  def make_ftb_choice(current_subject)
    return nil unless can_change_user?(current_subject)
    battlers = members.select{|bat| bat.inputable? && bat.current_action}
    b = choose_ftb_user(battlers)
    b.set_ftb_action(b.current_action) if b
    return b
  end
 
  #--------------------------------------------------------------------------
  # new method: choose_ftb_user -> given a list of elligible battlers, pick
  # one to make an action or nil
  #--------------------------------------------------------------------------
  def choose_ftb_user(battlers)
    battlers.sort_by{|b| b.current_action.speed}.first
  end
end #Game_Troop

#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # alias method: update
  #--------------------------------------------------------------------------
  alias tim_ftb_enemy_update update
  def update
    return tim_ftb_enemy_update unless BattleManager.btype?(:ftb)
    super
    if BattleManager.in_turn?
      process_event
      process_troop_choice #new
      process_action
    end
    BattleManager.judge_win_loss
  end
 
  #--------------------------------------------------------------------------
  # new method: process_troop_choice
  #--------------------------------------------------------------------------
  def process_troop_choice
    @subject ||= BattleManager.next_subject
    until (!@subject || @subject && @subject.current_action)
      @subject = BattleManager.next_subject
    end
    @subject = $game_troop.make_ftb_choice(@subject) || @subject
  end
end #Scene_Battle

Here is an untested compatibility patch with archeia's advanced ai script if you want to use it:
Ruby:
#==============================================================================
# FTB for enemies patch with Archeia's Advanced AI Conditions v1.0d
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 29/12/2025
# Requires: my FTB for enemies addon to Yanfly's script and Archeia's script
#==============================================================================
# Description: advanced ai restrictions should be applied whenever the actions
# are modified during troop's turn in FTB (this script is not tested)
#==============================================================================
# Term of use: follow the required scripts term of use
#==============================================================================

if $imported['ARC-AdvAIConditions'] && $imported["TIM-YEA-FTB-EnemyFTB-addon"]
#==============================================================================
# Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # alias method: make_action_list -> apply turn pattern filter
  #--------------------------------------------------------------------------
  alias tim_arc_ai_make_action_list make_action_list
  def make_action_list
    action_list = tim_arc_ai_make_action_list
    if !enemy.t_patterns.keys.empty? && turn_patterns_ok?
      action_list = make_turn_patterns_list.select {|a| action_valid?(a)}
    end
    return action_list
  end
 
  #--------------------------------------------------------------------------
  # alias method: make_action -> apply absolute rating rule
  #--------------------------------------------------------------------------
  alias tim_arc_ai_make_action make_action
  def make_action(action, action_list)
    absolute_list = action_list.reject {|a| a.rating != ARC::ABSOLUTE_RATING}
    unless absolute_list.empty?
      return action.set_enemy_action(absolute_list[rand(absolute_list.size)])
    end
    tim_arc_ai_make_action(action, action_list)
  end
end #Game_Enemy
end #$imported['ARC-AdvAIConditions'] && $imported["TIM-YEA-FTB-EnemyFTB-addon"]

I will be back for the action +/- handling script, for now my script above won't do much unless you add skills/items that will affect with their effects the possible actions.
OMG OMG OMG OMG OMG
IT WORKS!!! You're a life saver!!!
It's been bothering me for so long and I was ready to give up. You have no idea how much I appreciate it, thank you so much Monsieur Timtrack!
I have yet to test the compatibility patch, but I'll mention something when that happens!
Alright, here is the first script, it should allow the enemies to reconsider the actions they pick (and it might even change their turn order a bit):
Ruby:
#==============================================================================
# YEA FTB - FTB for enemies
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 29/12/2025
# Requires: YEA Free Turn Battle v1.02 and its requirements
#==============================================================================

$imported ||= {}
$imported["TIM-YEA-FTB-EnemyFTB-addon"] = true
 
#==============================================================================
# Description: basic addon that allows enemies to decide new actions during
# their phase, simulating a FTB for enemies (but without the handling of ftb
# actions for the troop like the party).
# This script provides the basis for an ai but does not do much:
# When it is the troop turn, the enemies will take actions in order specified
# by choose_ftb_user. By default this is the speed of the original action used
# by the battler.
#==============================================================================
# Term of use: free for commercial and free games, credit must be given
#==============================================================================

#==============================================================================
# Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # override method: inputable? -> restore vanilla behavior
  #--------------------------------------------------------------------------
  def inputable?
    game_battlerbase_inputable_ftb
  end
 
  #--------------------------------------------------------------------------
  # new method: make_action_list -> returns all currently valid actions
  #--------------------------------------------------------------------------
  def make_action_list
    enemy.actions.select {|a| action_valid?(a) }  
  end
 
  #--------------------------------------------------------------------------
  # new method: make_action -> given a list of actions, set the selected
  # action to one value chosen
  #--------------------------------------------------------------------------
  def make_action(action, action_list)
    return if action_list.empty?
    rating_max = action_list.collect {|a| a.rating }.max
    rating_zero = rating_max - 3
    action_list.reject! {|a| a.rating <= rating_zero }
    action.set_enemy_action(select_enemy_action(action_list, rating_zero))
  end
 
  #--------------------------------------------------------------------------
  # new method: set_ftb_action -> set the selected action for ftb enemy addon
  # when the battler is selected to play
  #--------------------------------------------------------------------------
  def set_ftb_action(action)
    #puts "reconsidering life choices of #{self.name}"
    action.clear
    action_list = make_action_list
    make_action(action, action_list)
  end
end #Game_Enemy

#==============================================================================
# Game_troop
#==============================================================================
class Game_Troop < Game_Unit
  #--------------------------------------------------------------------------
  # new method: can_change_user?
  #--------------------------------------------------------------------------
  def can_change_user?(bat)
    bat && bat.enemy? && bat.inputable? && bat.current_action
  end
 
  #--------------------------------------------------------------------------
  # make_ftb_choice -> choose a battler in the troop with an available action,
  # set the action and return the battler, nil if no elligible battler or
  # the current subject cannot be changed
  #--------------------------------------------------------------------------
  def make_ftb_choice(current_subject)
    return nil unless can_change_user?(current_subject)
    battlers = members.select{|bat| bat.inputable? && bat.current_action}
    b = choose_ftb_user(battlers)
    b.set_ftb_action(b.current_action) if b
    return b
  end
 
  #--------------------------------------------------------------------------
  # new method: choose_ftb_user -> given a list of elligible battlers, pick
  # one to make an action or nil
  #--------------------------------------------------------------------------
  def choose_ftb_user(battlers)
    battlers.sort_by{|b| b.current_action.speed}.first
  end
end #Game_Troop

#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # alias method: update
  #--------------------------------------------------------------------------
  alias tim_ftb_enemy_update update
  def update
    return tim_ftb_enemy_update unless BattleManager.btype?(:ftb)
    super
    if BattleManager.in_turn?
      process_event
      process_troop_choice #new
      process_action
    end
    BattleManager.judge_win_loss
  end
 
  #--------------------------------------------------------------------------
  # new method: process_troop_choice
  #--------------------------------------------------------------------------
  def process_troop_choice
    @subject ||= BattleManager.next_subject
    until (!@subject || @subject && @subject.current_action)
      @subject = BattleManager.next_subject
    end
    @subject = $game_troop.make_ftb_choice(@subject) || @subject
  end
end #Scene_Battle

Here is an untested compatibility patch with archeia's advanced ai script if you want to use it:
Ruby:
#==============================================================================
# FTB for enemies patch with Archeia's Advanced AI Conditions v1.0d
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 29/12/2025
# Requires: my FTB for enemies addon to Yanfly's script and Archeia's script
#==============================================================================
# Description: advanced ai restrictions should be applied whenever the actions
# are modified during troop's turn in FTB (this script is not tested)
#==============================================================================
# Term of use: follow the required scripts term of use
#==============================================================================

if $imported['ARC-AdvAIConditions'] && $imported["TIM-YEA-FTB-EnemyFTB-addon"]
#==============================================================================
# Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # alias method: make_action_list -> apply turn pattern filter
  #--------------------------------------------------------------------------
  alias tim_arc_ai_make_action_list make_action_list
  def make_action_list
    action_list = tim_arc_ai_make_action_list
    if !enemy.t_patterns.keys.empty? && turn_patterns_ok?
      action_list = make_turn_patterns_list.select {|a| action_valid?(a)}
    end
    return action_list
  end
 
  #--------------------------------------------------------------------------
  # alias method: make_action -> apply absolute rating rule
  #--------------------------------------------------------------------------
  alias tim_arc_ai_make_action make_action
  def make_action(action, action_list)
    absolute_list = action_list.reject {|a| a.rating != ARC::ABSOLUTE_RATING}
    unless absolute_list.empty?
      return action.set_enemy_action(absolute_list[rand(absolute_list.size)])
    end
    tim_arc_ai_make_action(action, action_list)
  end
end #Game_Enemy
end #$imported['ARC-AdvAIConditions'] && $imported["TIM-YEA-FTB-EnemyFTB-addon"]

I will be back for the action +/- handling script, for now my script above won't do much unless you add skills/items that will affect with their effects the possible actions.
Hi! I wanted to report on my personal testing. I found one thing where the enemies don't seem to update, and its increasing the amount of actions they have during their turn.
Suppose an enemy uses a skill that grants an extra turn to one of their allies via a state. This state could be the +100% action times+, or it could use Yanfly's FTB features like the +1 ftb turns notetag or increasing its agility. If the state was obtained in the middle of the enemy phase, turns will not be increased until the next enemy phase.
This may be outside the scope of your script, and I understand if so. But I figured I should mention it just in case! I'll continue to share my findings if that's ok with you. Take care!
Hi! I wanted to report on my personal testing. I found one thing where the enemies don't seem to update, and its increasing the amount of actions they have during their turn.
Hello, that's because that was the second part of the script I wanted to write ahah, I thought I would make a separate script for the dynamic change of actions, but it turns out I had to rewrite the previous script anyway.
Here is a new version, you can replace my previous script with this one, the compatibility patch with Archeia's script from my previous post should hold:
Ruby:
#==============================================================================
# YEA FTB - FTB for enemies v1.1
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 31/12/2025
# Requires: YEA Free Turn Battle v1.02 and its requirements
#==============================================================================

$imported ||= {}
$imported["TIM-YEA-FTB-EnemyFTB-addon"] = true
 
#==============================================================================
# Updates:
# 29/12/2025 - v1.0 - Initial release
# 31/12/2025 - v1.1 - ftb system is applied to enemies more properly, actions
#                     change by notetags will apply to enemies too
#==============================================================================
# Description: basic addon that allows enemies to decide new actions during
# their phase, simulating a FTB for enemies.
# This script provides the basis for an ai but does not do much:
# When it is the troop turn, the enemies will take actions in order specified
# by choose_ftb_user. By default this takes a random enemy in the troop.
#==============================================================================
# Term of use: free for commercial and free games, credit must be given
#==============================================================================

module TIM
  module YEA_EnemyFTB
    #max amount of actions in the troop, same kind of parameter as
    #YEA::FTB::MAXIMUM_FTB_ACTIONS except this one is conditional, keep this to
    #nil or negative if you don't want a limit to the troop
    TROOP_MAXIMUM_FTB_ACTIONS = nil
    
    #do you want forced actions in ftb to cost action points?
    FORCED_ACTIONS_COST_FTB = false
  end #YEA_FTB
end #TIM

#==============================================================================
# DataManager
#==============================================================================
module DataManager
  #--------------------------------------------------------------------------
  # alias method: load_notetags_ftb -> now loads for enemies too
  #--------------------------------------------------------------------------
  class <<self; alias tim_enemies_load_notetags_ftb load_notetags_ftb; end
  def self.load_notetags_ftb
    tim_enemies_load_notetags_ftb
    $data_enemies.each {|e| e.load_notetags_ftb if e}
  end
end # DataManager

#==============================================================================
# BattleManager
#==============================================================================
module BattleManager
  #--------------------------------------------------------------------------
  # alias method: force_action -> if action costs points, now only remove
  # original action cost
  #--------------------------------------------------------------------------
  class << self; alias ftb_force_action force_action; end
  def self.force_action(battler)
    ftb_force_action(battler)
    return unless btype?(:ftb) && TIM::YEA_EnemyFTB::FORCED_ACTIONS_COST_FTB
    item = battler.current_action.item
    SceneManager.scene.consume_forced_ftb_action(battler, item)
  end
end #BattleManager

#==============================================================================
# Game_Unit -> rewrites the same methods as Game_Party from FTB
#==============================================================================
class Game_Unit
  #--------------------------------------------------------------------------
  # new method: inputable?
  #--------------------------------------------------------------------------
  def inputable?
    return false unless meet_ftb_requirements?
    members.any? {|bat| bat.inputable? }
  end
 
  #--------------------------------------------------------------------------
  # new method: meet_ftb_requirements?
  #--------------------------------------------------------------------------
  def meet_ftb_requirements?
    return true unless BattleManager.btype?(:ftb)
    return ftb_actions_remaining > 0
  end
 
  #--------------------------------------------------------------------------
  # new method: inputable_members
  #--------------------------------------------------------------------------
  def inputable_members
    members.select{|m| m.game_battlerbase_inputable_ftb}
  end
 
  #--------------------------------------------------------------------------
  # new method: ftb_actions_remaining
  #--------------------------------------------------------------------------
  def ftb_actions_remaining
    return ftb_actions_maximum - ftb_actions_used
  end
 
  #--------------------------------------------------------------------------
  # new method: ftb_actions_maximum
  #--------------------------------------------------------------------------
  def ftb_actions_maximum
    n = inputable_members.inject(0) {|r, m| r += m.max_ftb_actions}
    max = TIM::YEA_EnemyFTB::TROOP_MAXIMUM_FTB_ACTIONS
    n = [n, max].min if max && max >= 0
    return n
  end
 
  #--------------------------------------------------------------------------
  # new method: ftb_actions_used
  #--------------------------------------------------------------------------
  def ftb_actions_used
    inputable_members.inject(0) {|r, m| r += m.ftb_actions}
  end
end # Game_Unit

#==============================================================================
# Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # override method: ftb_item_conditions_met?
  #--------------------------------------------------------------------------
  def ftb_item_conditions_met?(item)
    return true unless SceneManager.scene_is?(Scene_Battle)
    return true unless BattleManager.btype?(:ftb)
    #don't check auto or restricted battlers:
    return true unless game_battlerbase_inputable_ftb
    $game_troop.ftb_actions_remaining >= item.ftb_cost
  end
 
  #--------------------------------------------------------------------------
  # override method: trait_bonus_max_ftb_actions -> add enemy notetag
  #--------------------------------------------------------------------------
  def trait_bonus_max_ftb_actions
    super + enemy.ftb_actions
  end
 
  #--------------------------------------------------------------------------
  # new method: make_action_list -> returns all currently valid actions
  #--------------------------------------------------------------------------
  def make_action_list
    enemy.actions.select {|a| action_valid?(a) }   
  end
 
  #--------------------------------------------------------------------------
  # new method: make_action -> given a list of actions, set the selected
  # action to one value chosen
  #--------------------------------------------------------------------------
  def make_action(action, action_list)
    return false if action_list.empty?
    rating_max = action_list.collect {|a| a.rating }.max
    rating_zero = rating_max - 3
    action_list.reject! {|a| a.rating <= rating_zero }
    action.set_enemy_action(select_enemy_action(action_list, rating_zero))
  end
 
  #--------------------------------------------------------------------------
  # new method: set_ftb_action -> creates an action for the considered enemy
  # to play during ftb
  #--------------------------------------------------------------------------
  def set_ftb_action
    #puts "reconsidering life choices of #{self.name}"
    action = Game_Action.new(self)
    action_list = make_action_list #list of valid actions
    return false unless make_action(action, action_list)
    @actions.unshift(action) #insert action at the begining of list
    return true
  end
end #Game_Enemy

#==============================================================================
# Game_troop
#==============================================================================
class Game_Troop < Game_Unit
  #--------------------------------------------------------------------------
  # new method: can_change_user? -> check that the subject is in the troop
  # and that it can decide actions (inputable? checking)
  #--------------------------------------------------------------------------
  def can_change_user?(bat)
    bat && bat.enemy? && bat.game_battlerbase_inputable_ftb
  end
 
  #--------------------------------------------------------------------------
  # make_ftb_choice -> choose a battler in the troop that can act,
  # set the action and return the battler, nil if no elligible battler or
  # the current subject cannot be changed
  #--------------------------------------------------------------------------
  def make_ftb_choice(current_subject)
    return nil unless can_change_user?(current_subject)
    #don't try to make choices if troop is not inputable
    return nil unless inputable?
    #list all playable battlers
    battlers = members.select{|bat| bat.inputable?}
    #clear all actions to ensure none remains between the valid battlers
    battlers.each {|b| b.clear_actions}
    until battlers.empty?
      b = choose_ftb_user(battlers)
      break unless b #no valid battler -> leave loop
      return b if b.set_ftb_action #if valid action, return b
      battlers.delete(b) #remove b and retry if no valid actions
    end
    return nil
  end
 
  #--------------------------------------------------------------------------
  # new method: choose_ftb_user -> given a list of elligible battlers, pick
  # one to make an action or nil.
  #--------------------------------------------------------------------------
  def choose_ftb_user(battlers)
    battlers.sample #current implementation is random
  end
end #Game_Troop

#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # alias method: update
  #--------------------------------------------------------------------------
  alias tim_ftb_enemy_update update
  def update
    return tim_ftb_enemy_update unless BattleManager.btype?(:ftb)
    super
    if BattleManager.in_turn?
      process_event
      process_ftb_action   #replaces process_action
    end
    BattleManager.judge_win_loss
  end
 
  #--------------------------------------------------------------------------
  # new method: process_ftb_action -> used by non-party members to use actions
  #--------------------------------------------------------------------------
  def process_ftb_action
    return if scene_changing?
    decide_ftb_subject
    return turn_end unless @subject
    return run_ftb_action if @subject.current_action
    process_action_end
    @subject = BattleManager.next_subject
  end
 
  #--------------------------------------------------------------------------
  # new method: decide_ftb_subject -> changes the subject if the troop can
  # say something, the new subject should have an action or they will be
  # discarded with next_subject
  #--------------------------------------------------------------------------
  def decide_ftb_subject
    @subject ||= BattleManager.next_subject
    @subject = $game_troop.make_ftb_choice(@subject) || @subject
  end
 
  #--------------------------------------------------------------------------
  # new method: run_ftb_action -> execute action if valid and apply ftb cost
  # and effects
  #--------------------------------------------------------------------------
  def run_ftb_action
    item = @subject.current_action.item
    @subject.current_action.prepare
    if @subject.current_action.valid?
      @status_window.open
      execute_action
    end
    consume_ftb_action(item)
    @subject.remove_current_action
    process_action_end
  end
 
  #--------------------------------------------------------------------------
  # new method: consume_forced_ftb_action
  #--------------------------------------------------------------------------
  def consume_forced_ftb_action(user, item)
    user.use_ftb_action(item.ftb_cost) unless item.nil?
    refresh_ftb_gauge
  end
end #Scene_Battle
There are some clunky stuff, like if you force actions and it should forbid the battler from acting this turn, well, here it doesn't work well (creates inconsistencies). So I suggest not using this feature? (I will fix it later) Instead you can use the tiny option I introduced that allows forced actions to cost ftb points, or simply disable this by using Ace Core Engine and not touching anything.
I also noticed that the number of calls to process_ftb_action (a new method I wrote) was higher than expected, so there's probably a bug somewhere that I've yet to understand.

Regardless, you can now use the ftb points features with enemies, and also put the same notetags in them to affect their action count! I did not test everything so feel free to report bugs you encounter.
Hello, that's because that was the second part of the script I wanted to write ahah, I thought I would make a separate script for the dynamic change of actions, but it turns out I had to rewrite the previous script anyway.
Here is a new version, you can replace my previous script with this one, the compatibility patch with Archeia's script from my previous post should hold:
Ruby:
#==============================================================================
# YEA FTB - FTB for enemies v1.1
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 31/12/2025
# Requires: YEA Free Turn Battle v1.02 and its requirements
#==============================================================================

$imported ||= {}
$imported["TIM-YEA-FTB-EnemyFTB-addon"] = true
 
#==============================================================================
# Updates:
# 29/12/2025 - v1.0 - Initial release
# 31/12/2025 - v1.1 - ftb system is applied to enemies more properly, actions
#                     change by notetags will apply to enemies too
#==============================================================================
# Description: basic addon that allows enemies to decide new actions during
# their phase, simulating a FTB for enemies.
# This script provides the basis for an ai but does not do much:
# When it is the troop turn, the enemies will take actions in order specified
# by choose_ftb_user. By default this takes a random enemy in the troop.
#==============================================================================
# Term of use: free for commercial and free games, credit must be given
#==============================================================================

module TIM
  module YEA_EnemyFTB
    #max amount of actions in the troop, same kind of parameter as
    #YEA::FTB::MAXIMUM_FTB_ACTIONS except this one is conditional, keep this to
    #nil or negative if you don't want a limit to the troop
    TROOP_MAXIMUM_FTB_ACTIONS = nil
   
    #do you want forced actions in ftb to cost action points?
    FORCED_ACTIONS_COST_FTB = false
  end #YEA_FTB
end #TIM

#==============================================================================
# DataManager
#==============================================================================
module DataManager
  #--------------------------------------------------------------------------
  # alias method: load_notetags_ftb -> now loads for enemies too
  #--------------------------------------------------------------------------
  class <<self; alias tim_enemies_load_notetags_ftb load_notetags_ftb; end
  def self.load_notetags_ftb
    tim_enemies_load_notetags_ftb
    $data_enemies.each {|e| e.load_notetags_ftb if e}
  end
end # DataManager

#==============================================================================
# BattleManager
#==============================================================================
module BattleManager
  #--------------------------------------------------------------------------
  # alias method: force_action -> if action costs points, now only remove
  # original action cost
  #--------------------------------------------------------------------------
  class << self; alias ftb_force_action force_action; end
  def self.force_action(battler)
    ftb_force_action(battler)
    return unless btype?(:ftb) && TIM::YEA_EnemyFTB::FORCED_ACTIONS_COST_FTB
    item = battler.current_action.item
    SceneManager.scene.consume_forced_ftb_action(battler, item)
  end
end #BattleManager

#==============================================================================
# Game_Unit -> rewrites the same methods as Game_Party from FTB
#==============================================================================
class Game_Unit
  #--------------------------------------------------------------------------
  # new method: inputable?
  #--------------------------------------------------------------------------
  def inputable?
    return false unless meet_ftb_requirements?
    members.any? {|bat| bat.inputable? }
  end
 
  #--------------------------------------------------------------------------
  # new method: meet_ftb_requirements?
  #--------------------------------------------------------------------------
  def meet_ftb_requirements?
    return true unless BattleManager.btype?(:ftb)
    return ftb_actions_remaining > 0
  end
 
  #--------------------------------------------------------------------------
  # new method: inputable_members
  #--------------------------------------------------------------------------
  def inputable_members
    members.select{|m| m.game_battlerbase_inputable_ftb}
  end
 
  #--------------------------------------------------------------------------
  # new method: ftb_actions_remaining
  #--------------------------------------------------------------------------
  def ftb_actions_remaining
    return ftb_actions_maximum - ftb_actions_used
  end
 
  #--------------------------------------------------------------------------
  # new method: ftb_actions_maximum
  #--------------------------------------------------------------------------
  def ftb_actions_maximum
    n = inputable_members.inject(0) {|r, m| r += m.max_ftb_actions}
    max = TIM::YEA_EnemyFTB::TROOP_MAXIMUM_FTB_ACTIONS
    n = [n, max].min if max && max >= 0
    return n
  end
 
  #--------------------------------------------------------------------------
  # new method: ftb_actions_used
  #--------------------------------------------------------------------------
  def ftb_actions_used
    inputable_members.inject(0) {|r, m| r += m.ftb_actions}
  end
end # Game_Unit

#==============================================================================
# Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # override method: ftb_item_conditions_met?
  #--------------------------------------------------------------------------
  def ftb_item_conditions_met?(item)
    return true unless SceneManager.scene_is?(Scene_Battle)
    return true unless BattleManager.btype?(:ftb)
    #don't check auto or restricted battlers:
    return true unless game_battlerbase_inputable_ftb
    $game_troop.ftb_actions_remaining >= item.ftb_cost
  end
 
  #--------------------------------------------------------------------------
  # override method: trait_bonus_max_ftb_actions -> add enemy notetag
  #--------------------------------------------------------------------------
  def trait_bonus_max_ftb_actions
    super + enemy.ftb_actions
  end
 
  #--------------------------------------------------------------------------
  # new method: make_action_list -> returns all currently valid actions
  #--------------------------------------------------------------------------
  def make_action_list
    enemy.actions.select {|a| action_valid?(a) }  
  end
 
  #--------------------------------------------------------------------------
  # new method: make_action -> given a list of actions, set the selected
  # action to one value chosen
  #--------------------------------------------------------------------------
  def make_action(action, action_list)
    return false if action_list.empty?
    rating_max = action_list.collect {|a| a.rating }.max
    rating_zero = rating_max - 3
    action_list.reject! {|a| a.rating <= rating_zero }
    action.set_enemy_action(select_enemy_action(action_list, rating_zero))
  end
 
  #--------------------------------------------------------------------------
  # new method: set_ftb_action -> creates an action for the considered enemy
  # to play during ftb
  #--------------------------------------------------------------------------
  def set_ftb_action
    #puts "reconsidering life choices of #{self.name}"
    action = Game_Action.new(self)
    action_list = make_action_list #list of valid actions
    return false unless make_action(action, action_list)
    @actions.unshift(action) #insert action at the begining of list
    return true
  end
end #Game_Enemy

#==============================================================================
# Game_troop
#==============================================================================
class Game_Troop < Game_Unit
  #--------------------------------------------------------------------------
  # new method: can_change_user? -> check that the subject is in the troop
  # and that it can decide actions (inputable? checking)
  #--------------------------------------------------------------------------
  def can_change_user?(bat)
    bat && bat.enemy? && bat.game_battlerbase_inputable_ftb
  end
 
  #--------------------------------------------------------------------------
  # make_ftb_choice -> choose a battler in the troop that can act,
  # set the action and return the battler, nil if no elligible battler or
  # the current subject cannot be changed
  #--------------------------------------------------------------------------
  def make_ftb_choice(current_subject)
    return nil unless can_change_user?(current_subject)
    #don't try to make choices if troop is not inputable
    return nil unless inputable?
    #list all playable battlers
    battlers = members.select{|bat| bat.inputable?}
    #clear all actions to ensure none remains between the valid battlers
    battlers.each {|b| b.clear_actions}
    until battlers.empty?
      b = choose_ftb_user(battlers)
      break unless b #no valid battler -> leave loop
      return b if b.set_ftb_action #if valid action, return b
      battlers.delete(b) #remove b and retry if no valid actions
    end
    return nil
  end
 
  #--------------------------------------------------------------------------
  # new method: choose_ftb_user -> given a list of elligible battlers, pick
  # one to make an action or nil.
  #--------------------------------------------------------------------------
  def choose_ftb_user(battlers)
    battlers.sample #current implementation is random
  end
end #Game_Troop

#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # alias method: update
  #--------------------------------------------------------------------------
  alias tim_ftb_enemy_update update
  def update
    return tim_ftb_enemy_update unless BattleManager.btype?(:ftb)
    super
    if BattleManager.in_turn?
      process_event
      process_ftb_action   #replaces process_action
    end
    BattleManager.judge_win_loss
  end
 
  #--------------------------------------------------------------------------
  # new method: process_ftb_action -> used by non-party members to use actions
  #--------------------------------------------------------------------------
  def process_ftb_action
    return if scene_changing?
    decide_ftb_subject
    return turn_end unless @subject
    return run_ftb_action if @subject.current_action
    process_action_end
    @subject = BattleManager.next_subject
  end
 
  #--------------------------------------------------------------------------
  # new method: decide_ftb_subject -> changes the subject if the troop can
  # say something, the new subject should have an action or they will be
  # discarded with next_subject
  #--------------------------------------------------------------------------
  def decide_ftb_subject
    @subject ||= BattleManager.next_subject
    @subject = $game_troop.make_ftb_choice(@subject) || @subject
  end
 
  #--------------------------------------------------------------------------
  # new method: run_ftb_action -> execute action if valid and apply ftb cost
  # and effects
  #--------------------------------------------------------------------------
  def run_ftb_action
    item = @subject.current_action.item
    @subject.current_action.prepare
    if @subject.current_action.valid?
      @status_window.open
      execute_action
    end
    consume_ftb_action(item)
    @subject.remove_current_action
    process_action_end
  end
 
  #--------------------------------------------------------------------------
  # new method: consume_forced_ftb_action
  #--------------------------------------------------------------------------
  def consume_forced_ftb_action(user, item)
    user.use_ftb_action(item.ftb_cost) unless item.nil?
    refresh_ftb_gauge
  end
end #Scene_Battle
There are some clunky stuff, like if you force actions and it should forbid the battler from acting this turn, well, here it doesn't work well (creates inconsistencies). So I suggest not using this feature? (I will fix it later) Instead you can use the tiny option I introduced that allows forced actions to cost ftb points, or simply disable this by using Ace Core Engine and not touching anything.
I also noticed that the number of calls to process_ftb_action (a new method I wrote) was higher than expected, so there's probably a bug somewhere that I've yet to understand.

Regardless, you can now use the ftb points features with enemies, and also put the same notetags in them to affect their action count! I did not test everything so feel free to report bugs you encounter.
It works wonderfully! It's everything I could've ever wanted from an FTB system. It works perfectly for the scope of the mechanics I was trying to achieve. A million thanks! I hope you post this somewhere for other people to see, I think I'm not the only one would appreciate it. Let me know if you make a standalone post so I can share any bugs over there!
Otherwise, I'd say this script singlehandedly solves the issues with multi-turns that I was having. Many thanks to you, mister Bgillisp and Another Fen for the help and understanding!

​

Hi! Thank you for the help! But I'm not sure how to use the script you've shared, my scripting skills aren't quite up there yet to know what it does at a glance.
Probably no longer relevant, since it seems you have a solution, and some of the codes will likely be incompatible with Timtracks solution.

The code itself is a collection of event script calls (although sometimes badly separated). Those would probably be most useful if you only need them for a few battles, but for example, you could set up an event to run at the beginning of the turn and run
Ruby:
enemy = $game_troop.enemies[0]
enemy.actions.pop
BattleManager.make_action_orders
to remove one of the first enemies' scheduled actions and remake the turn order.
Alternatively
Ruby:
enemy = $game_troop.enemies[0]
if enemy.actions.length > 0
  enemies.actions[0].set_skill(2)
end
BattleManager.make_action_orders
should set the first action of the first enemy to "Defend" (definitely won't work anymore with Timtracks script, but should also not be necessary)


I had kind of already forgotten that you used the Free Turn system. I think it should still run after all party members have selected and executed their actions, but before any of the enemies get their turn. But I am not 100% sure at this moment.
In case anyone would like to know, while testing I found that an annoying default behavior of rpg maker is that if a foe is inflicted with a state that restricts them to attack, like "attack anyone", the foe will stand around doing nothing until the next turn because all of the actions it wanted to do became invalid and won't update until the next turn.
The incredible script made by Timtack helps enemies recalculate their actions mid-turn, but it does not address this edge-case.

As a workaround I have made a really bad script that checks if enemies have received or lost any states, and if so, update them using set_ftb_action. This allows them to immediately start attacking their friends on the same turn the state was inflicted.
Its crude and borderline untested, but so far seems to have worked for me so I'll leave it here in case anyone needs it. If I find any glaring issues (and can figure out how to fix it) then I'll update this.

Ruby:
class Game_Battler < Game_BattlerBase
  alias ftb_add_state add_state
  def add_state(state_id)
    had_state = state?(state_id)
    ftb_add_state(state_id)
    if self.is_a?(Game_Enemy) && !had_state && state?(state_id)
      set_ftb_action
    end
  end

  alias ftb_remove_state remove_state
  def remove_state(state_id)
    had_state = state?(state_id)
    ftb_remove_state(state_id)
    if self.is_a?(Game_Enemy) && had_state && !state?(state_id)
      set_ftb_action
    end
  end
end
Well I had to look into this because I could not understand why the battlers were not performing actions.
Turns out, whenever a restriction is applied, all actions from the battler are removed. But actually, this happen as long as there is at least one restriction on the battler! So if you have a confused battler that gets another state, then they also lose all their actions even if that state does not do much.
It could be argued that it's somewhat RP to have an enraged battler stops their actions when someone else do something on them, but I don't know, this feels arbitrary.

Anyway, I wrote two small scripts.

This one is optional, it changes when on_restrict is called to ensure it is only called when the state added is a restriction state, meaning actions will be cleared only if the new state is a restriction, it can be of interest for the actors or enemies if you are not using FTB system.
Ruby:
#put this script high in your load order to ensure it does not break other
#scripts

#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # overwrite method: add_new_state -> only performs on_restrict if the state
  # is a restriction instead of using 'restriction' which checks all states
  #--------------------------------------------------------------------------
  def add_new_state(state_id)
    die if state_id == death_state_id
    @states.push(state_id)
    on_restrict if $data_states[state_id].restriction > 0 #restriction
    sort_states
    refresh
  end
end #Game_Battler

This one should fix your action issue, when a restriction is applied to an enemy, they won't remove their actions unless the state forbids them to act.
Ruby:
#==============================================================================
# Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # override method: add_new_state -> restore actions if restriction is not
  # forbid to move
  #--------------------------------------------------------------------------
  def on_restrict
    old_actions = @actions.dup
    super
    @actions = old_actions if restriction < 4
  end
end #Game_Enemy

I had kind of already forgotten that you used the Free Turn system. I think it should still run after all party members have selected and executed their actions, but before any of the enemies get their turn. But I am not 100% sure at this moment.
If you are using FTB without my addon, then selecting the enemy actions with events at the start of the turn will work.
With my addon, your action choices will be overridden by my script, unless you are selecting actions for non-inputable enemies (auto-battle or state-restricted enemies).
Well I had to look into this because I could not understand why the battlers were not performing actions.
Turns out, whenever a restriction is applied, all actions from the battler are removed. But actually, this happen as long as there is at least one restriction on the battler! So if you have a confused battler that gets another state, then they also lose all their actions even if that state does not do much.
It could be argued that it's somewhat RP to have an enraged battler stops their actions when someone else do something on them, but I don't know, this feels arbitrary.

Anyway, I wrote two small scripts.

This one is optional, it changes when on_restrict is called to ensure it is only called when the state added is a restriction state, meaning actions will be cleared only if the new state is a restriction, it can be of interest for the actors or enemies if you are not using FTB system.
Ruby:
#put this script high in your load order to ensure it does not break other
#scripts

#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # overwrite method: add_new_state -> only performs on_restrict if the state
  # is a restriction instead of using 'restriction' which checks all states
  #--------------------------------------------------------------------------
  def add_new_state(state_id)
    die if state_id == death_state_id
    @states.push(state_id)
    on_restrict if $data_states[state_id].restriction > 0 #restriction
    sort_states
    refresh
  end
end #Game_Battler

This one should fix your action issue, when a restriction is applied to an enemy, they won't remove their actions unless the state forbids them to act.
Ruby:
#==============================================================================
# Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # override method: add_new_state -> restore actions if restriction is not
  # forbid to move
  #--------------------------------------------------------------------------
  def on_restrict
    old_actions = @actions.dup
    super
    @actions = old_actions if restriction < 4
  end
end #Game_Enemy


If you are using FTB without my addon, then selecting the enemy actions with events at the start of the turn will work.
With my addon, your action choices will be overridden by my script, unless you are selecting actions for non-inputable enemies (auto-battle or state-restricted enemies).
I wasn't expecting a reply but wow! You're a saint for all the help you've given me so far! I don't know how to repay 😢I feel very lucky to receive help like this...
I'll be replacing my script with yours since its much cleaner and I only barely know what I was doing with mine lol. As always, I'll try to bring up anything major that I can find.

Original thread: https://forums.rpgmakerweb.com/threads/more-precise-control-on-enemies-with-multiple-actions-per-turn.181661/